This note covers the chain rule for composite functions and the product and quotient rules for products and fractions of functions. Together they let you differentiate almost any function you will meet, including models built from exponentials, logarithms and trigonometric functions.
Key ideas
Chain rule. A composite function has one function inside another, such as \((3x^2-2)^4\) or \(\sin(5x)\) or \(\ln(x^2+1)\). Call the inside \(u\). Then \(y\) is a function of \(u\), and \(u\) is a function of \(x\), so \[\frac{dy}{dx}=\frac{dy}{du}\times\frac{du}{dx}.\] In words: differentiate the outside, leaving the inside alone, then multiply by the derivative of the inside. Useful patterns follow from this:
- \(\dfrac{d}{dx}\sin(ax+b)=a\cos(ax+b)\) and \(\dfrac{d}{dx}\cos(ax+b)=-a\sin(ax+b)\).
- \(\dfrac{d}{dx}e^{g(x)}=g'(x)\,e^{g(x)}\).
- \(\dfrac{d}{dx}\ln g(x)=\dfrac{g'(x)}{g(x)}\).
- \(\dfrac{d}{dx}[g(x)]^n=n\,g'(x)\,[g(x)]^{n-1}\).
Product rule. When two functions of \(x\) are multiplied, \(y=uv\), then \(\dfrac{dy}{dx}=u\dfrac{dv}{dx}+v\dfrac{du}{dx}\). Differentiate one factor at a time, keep the other unchanged, and add the results.
Quotient rule. For a fraction \(y=\dfrac uv\), \(\dfrac{dy}{dx}=\dfrac{v\dfrac{du}{dx}-u\dfrac{dv}{dx}}{v^2}\). The order in the numerator matters because of the subtraction. The numerator is "bottom times derivative of top, minus top times derivative of bottom".
Choosing a rule. Look at the outermost operation. If it is a product, start with the product rule. If it is a fraction, start with the quotient rule. If it is a function applied to a function, start with the chain rule. Many questions need two rules, for example a product where one factor is itself a composite function.
Using the results. After differentiating, you use the derivative exactly as before: evaluate it for a gradient, build a tangent or normal, or set it to zero to find stationary points. Factorising the derivative often makes the equation \(f'(x)=0\) much easier to solve. Factors such as \(e^{-x}\) can never be zero, so you can ignore them when solving.
Building a chain. Some functions need the chain rule more than once, such as \(e^{\sin x}\) or \((\ln x)^3\). Work from the outside inwards, writing down each derivative, and multiply them all together. For \((\ln x)^3\) the answer is \(3(\ln x)^2\times\dfrac1x\).
Checking your work. A quick check is to pick a value of \(x\), then compare your derivative with the gradient found on your GDC at that point. If the two values agree, your algebra is almost certainly right.
Simplifying. After using the product or quotient rule, take out common factors. This is especially helpful when finding stationary points, as the factorised form shows the solutions at once.
Second derivatives. To find \(f''(x)\), differentiate \(f'(x)\) again, using the same rules. This is needed to classify stationary points.
Definitions and formulae
| Term or formula | Meaning / when to use |
|---|---|
| \(\dfrac{dy}{dx}=\dfrac{dy}{du}\times\dfrac{du}{dx}\) | Chain rule, for a function of a function. |
| \(\dfrac{d}{dx}(uv)=u\dfrac{dv}{dx}+v\dfrac{du}{dx}\) | Product rule, for two factors containing \(x\). |
| \(\dfrac{d}{dx}\!\left(\dfrac uv\right)=\dfrac{v\,u'-u\,v'}{v^2}\) | Quotient rule, for a fraction with \(x\) in the denominator. |
| \(\dfrac{d}{dx}\ln g(x)=\dfrac{g'(x)}{g(x)}\) | Chain rule applied to a logarithm. |
| \(\dfrac{d}{dx}e^{g(x)}=g'(x)e^{g(x)}\) | Chain rule applied to an exponential. |
Worked examples
Example 1 Differentiate (a) \(y=(3x^2-2)^4\) and (b) \(y=\ln(x^2+1)\). Find the gradient of each at \(x=1\).
(a) Let \(u=3x^2-2\), so \(y=u^4\). Then \(\dfrac{dy}{du}=4u^3\) and \(\dfrac{du}{dx}=6x\).
Multiply: \(\dfrac{dy}{dx}=4(3x^2-2)^3\times 6x=24x(3x^2-2)^3\).
At \(x=1\): \(24\times 1\times(1)^3=24\).
(b) Use \(\dfrac{d}{dx}\ln g=\dfrac{g'}{g}\) with \(g=x^2+1\): \(\dfrac{dy}{dx}=\dfrac{2x}{x^2+1}\).
At \(x=1\): \(\dfrac{2}{2}=1\).
Answer: (a) \(24x(3x^2-2)^3\), gradient 24; (b) \(\dfrac{2x}{x^2+1}\), gradient 1
Example 2 The concentration of a drug in the blood, in mg per litre, is \(C(t)=t^2e^{-t}\), where \(t\) is the time in hours after an injection. Find when the concentration is greatest and its maximum value.
Use the product rule with \(u=t^2\) and \(v=e^{-t}\). Then \(u'=2t\) and, by the chain rule, \(v'=-e^{-t}\).
\(C'(t)=t^2(-e^{-t})+e^{-t}(2t)=e^{-t}(2t-t^2)=te^{-t}(2-t)\).
Set \(C'(t)=0\). Since \(e^{-t}\gt 0\), either \(t=0\) or \(t=2\). The value \(t=0\) is the start, where \(C=0\).
For \(0\lt t\lt 2\), \(C'\gt 0\) (rising). For \(t\gt 2\), \(C'\lt 0\) (falling). So \(t=2\) gives the maximum.
\(C(2)=4e^{-2}=0.5413\).
Answer: greatest after 2 hours, at about 0.541 mg per litre
Example 3 Let \(f(x)=\dfrac{2x+1}{x^2+3}\). Find \(f'(x)\), then the gradient at \(x=1\) and the \(x\)-coordinates of the stationary points.
Take \(u=2x+1\) and \(v=x^2+3\), so \(u'=2\) and \(v'=2x\).
\(f'(x)=\dfrac{(x^2+3)(2)-(2x+1)(2x)}{(x^2+3)^2}=\dfrac{2x^2+6-4x^2-2x}{(x^2+3)^2}=\dfrac{-2x^2-2x+6}{(x^2+3)^2}\).
At \(x=1\): \(\dfrac{-2-2+6}{16}=\dfrac{2}{16}=0.125\).
Stationary points: the denominator is never zero, so set the numerator to zero. \(-2x^2-2x+6=0\) gives \(x^2+x-3=0\).
Use the quadratic formula: \(x=\dfrac{-1\pm\sqrt{13}}{2}\), so \(x\approx 1.30\) or \(x\approx -2.30\).
Answer: \(f'(1)=0.125\); stationary points at \(x\approx 1.30\) and \(x\approx-2.30\)
Example 4 Differentiate \(y=\sin(3x^2)\).
The inside is \(u=3x^2\), with \(\dfrac{du}{dx}=6x\). The outside is \(\sin u\), with derivative \(\cos u\).
Multiply: \(\dfrac{dy}{dx}=\cos(3x^2)\times 6x\).
Answer: \(6x\cos(3x^2)\)
Example 5 Find the equation of the tangent to \(y=xe^{2x}\) at the point where \(x=1\).
This is a product, and the second factor needs the chain rule. Take \(u=x\) and \(v=e^{2x}\), so \(u'=1\) and \(v'=2e^{2x}\).
\(\dfrac{dy}{dx}=x(2e^{2x})+e^{2x}(1)=e^{2x}(2x+1)\).
At \(x=1\): \(y=e^2\approx 7.389\) and the gradient is \(3e^2\approx 22.167\).
Tangent: \(y-7.389=22.167(x-1)\), so \(y=22.167x-14.778\).
Answer: \(y\approx 22.2x-14.8\)
Common errors
- Forgetting the factor \(\dfrac{du}{dx}\) in the chain rule. For example, writing the derivative of \(\sin(5x)\) as \(\cos(5x)\) instead of \(5\cos(5x)\).
- Reversing the numerator of the quotient rule and writing \(u\,v'-v\,u'\), which changes the sign of the answer.
- Using the product rule as "differentiate each factor and multiply", giving \(u'v'\).
- Differentiating the inside function as well as the outside when you only meant to use the power rule, or failing to reduce the power by one on the outside.
- Cancelling terms across a sum, such as treating \(\dfrac{x^2+3}{x^2}\) as \(1+3\) after cancelling \(x^2\).
Exam tip: Write down \(u\), \(v\), \(u'\) and \(v'\) on separate lines before you substitute into the product or quotient rule. This keeps signs and brackets under control, and your method can be followed even if one value slips.
Check yourself
- Differentiate \(y=\ln(5x-2)\).
Answer
\(\dfrac{dy}{dx}=\dfrac{5}{5x-2}\). - Differentiate \(y=x\cos 2x\).
Answer
Product rule with \(u=x\), \(v=\cos2x\), \(v'=-2\sin2x\): \(\dfrac{dy}{dx}=x(-2\sin 2x)+\cos 2x=\cos2x-2x\sin2x\). - Differentiate \(y=\dfrac{e^x}{x+1}\) and simplify.
Answer
\(\dfrac{dy}{dx}=\dfrac{(x+1)e^x-e^x(1)}{(x+1)^2}=\dfrac{xe^x}{(x+1)^2}\). - Find the gradient of \(y=\sqrt{4x^2+9}\) at \(x=2\).
Answer
Write \(y=(4x^2+9)^{1/2}\). Then \(\dfrac{dy}{dx}=\dfrac12(4x^2+9)^{-1/2}\times 8x=\dfrac{4x}{\sqrt{4x^2+9}}\). At \(x=2\): \(\dfrac{8}{\sqrt{25}}=\dfrac85=1.6\).