MAT1051 · Week 6 · The Derivative of Trigonometric Functions, the Chain Rule and Implicit Differentiation

Trigonometric derivatives, the chain rule and implicit differentiation

Derivatives of the six trigonometric functions, the chain rule for nested functions, and implicit differentiation for curves where y cannot be written in terms of x. The longest derivative questions on the midterm come from here.

derivative of sinechain ruleouter functioninner functionLeibniz notationimplicit differentiationimplicit curvetangent linesecond derivative

Last week you differentiated polynomial and rational functions. This week the toolbox is completed: trigonometric functions, nested functions and curves where yy cannot be written explicitly. The chain rule is everywhere for the rest of the semester: logarithmic differentiation, related rates and substitution in integrals are all built on it. This week, make these four automatic:

  1. Memorize the six trigonometric derivatives. The ones starting with “c” have a minus sign in the derivative.
  2. The chain rule works from the outside in. Take the derivative of each layer, leave its inside as it is, and multiply them all.
  3. sin⁡3(2x)\sin^3(2x) has three layers: cube, sine, 2x2x.
  4. In implicit differentiation every term containing yy is multiplied by y′y', because yy is actually a function of xx.

Derivatives of the trigonometric functions

Everything comes from a single limit. If you put the addition formula sin⁡(x+h)=sin⁡xcos⁡h+cos⁡xsin⁡h\sin(x+h)=\sin x\cos h+\cos x\sin h into the definition:

sin⁡(x+h)−sin⁡xh=sin⁡x⋅cos⁡h−1h+cos⁡x⋅sin⁡hh\frac{\sin(x+h)-\sin x}{h}=\sin x\cdot\frac{\cos h-1}{h}+\cos x\cdot\frac{\sin h}{h}

As h→0h\to0, cos⁡h−1h→0\dfrac{\cos h-1}{h}\to0 and sin⁡hh→1\dfrac{\sin h}{h}\to1. The result is (sin⁡x)′=cos⁡x(\sin x)'=\cos x. Cosine follows the same way, and the other four come from the quotient rule.

FunctionDerivative
sin⁡x\sin xcos⁡x\cos x
cos⁡x\cos x−sin⁡x-\sin x
tan⁡x\tan xsec⁡2x\sec^2 x
sec⁡x\sec xsec⁡xtan⁡x\sec x\tan x
csc⁡x\csc x−csc⁡xcot⁡x-\csc x\cot x
cot⁡x\cot x−csc⁡2x-\csc^2 x

Example 1 (derive the tan⁡\tan derivative yourself).

(tan⁡x)′=(sin⁡xcos⁡x)′=cos⁡xcos⁡x−sin⁡x(−sin⁡x)cos⁡2x=cos⁡2x+sin⁡2xcos⁡2x=1cos⁡2x=sec⁡2x(\tan x)'=\left(\frac{\sin x}{\cos x}\right)'=\frac{\cos x\cos x-\sin x(-\sin x)}{\cos^2 x}=\frac{\cos^2x+\sin^2x}{\cos^2x}=\frac{1}{\cos^2 x}=\sec^2 x

Example 2. y=x3cos⁡xy=x^3\cos x: y′=3x2cos⁡x−x3sin⁡xy'=3x^2\cos x-x^3\sin x.

Example 3. y=sin⁡x1+cos⁡xy=\dfrac{\sin x}{1+\cos x}.

y′=cos⁡x(1+cos⁡x)−sin⁡x(−sin⁡x)(1+cos⁡x)2=cos⁡x+cos⁡2x+sin⁡2x(1+cos⁡x)2=1+cos⁡x(1+cos⁡x)2=11+cos⁡xy'=\frac{\cos x(1+\cos x)-\sin x(-\sin x)}{(1+\cos x)^2}=\frac{\cos x+\cos^2x+\sin^2x}{(1+\cos x)^2}=\frac{1+\cos x}{(1+\cos x)^2}=\frac{1}{1+\cos x}

The identity sin⁡2x+cos⁡2x=1\sin^2x+\cos^2x=1 is the key to simplifying trigonometric derivatives. Look for it before you leave the answer.

PITFALL · degrees and derivatives. The formulas are for radians. If xx were in degrees, sin⁡x∘=sin⁡πx180\sin x^\circ=\sin\frac{\pi x}{180} and its derivative would be π180cos⁡x∘\frac{\pi}{180}\cos x^\circ. In a calculus exam, angles are in radians.

The chain rule

If y=f(g(x))y=f(g(x)), then

dydx=f′(g(x))⋅g′(x)\frac{dy}{dx}=f'\big(g(x)\big)\cdot g'(x)

In Leibniz notation, with u=g(x)u=g(x):

dydx=dydu⋅dudx\frac{dy}{dx}=\frac{dy}{du}\cdot\frac{du}{dx}

Intuition: if uu changes 3 times as fast as xx, and yy changes 2 times as fast as uu, then yy changes 2⋅3=62\cdot3=6 times as fast as xx.

Separating the layers

In the chain rule the real work is seeing the layers of the function. Ask yourself “what is the last operation performed?” That is the outer function.

ExpressionOuterInnerDerivative
(x2+5x)4(x^2+5x)^4u4u^4x2+5xx^2+5x4(x2+5x)3(2x+5)4(x^2+5x)^3(2x+5)
sin⁡(x2)\sin(x^2)sin⁡u\sin ux2x^22xcos⁡(x2)2x\cos(x^2)
sin⁡2x\sin^2 xu2u^2sin⁡x\sin x2sin⁡xcos⁡x=sin⁡2x2\sin x\cos x=\sin 2x
tan⁡3x\sqrt{\tan 3x}u\sqrt utan⁡3x\tan 3x3sec⁡23x2tan⁡3x\dfrac{3\sec^2 3x}{2\sqrt{\tan 3x}}

Note the difference between sin⁡(x2)\sin(x^2) and sin⁡2x\sin^2 x. In the first, you square first and then apply the sine; in the second, sine first, then square.

Example 4 (three layers). y=cos⁡3(4x2−1)y=\cos^3(4x^2-1).

layer 1:  u^3            derivative  3u^2         -> 3 cos^2(4x^2 - 1)
layer 2:  cos v          derivative  -sin v       -> -sin(4x^2 - 1)
layer 3:  4x^2 - 1       derivative  8x
multiply: y' = 3 cos^2(4x^2 - 1) · (-sin(4x^2 - 1)) · 8x
              = -24x cos^2(4x^2 - 1) sin(4x^2 - 1)

Example 5 (chain + product). y=x21−xy=x^2\sqrt{1-x}.

y′=2x1−x+x2⋅−121−x=4x(1−x)−x221−x=4x−5x221−xy'=2x\sqrt{1-x}+x^2\cdot\frac{-1}{2\sqrt{1-x}}=\frac{4x(1-x)-x^2}{2\sqrt{1-x}}=\frac{4x-5x^2}{2\sqrt{1-x}}

First the product rule, then the chain rule inside each piece where needed. To simplify, use the common denominator 21−x2\sqrt{1-x}.

PITFALL · forgetting to differentiate the inside. Writing (sin⁡5x)′=cos⁡5x(\sin 5x)'=\cos 5x is the most common way to lose points on an exam. The correct answer is 5cos⁡5x5\cos 5x. At every chain step ask “what is the derivative of the inside?”

The chain rule with table values

If a table of values is given instead of formulas, the same rule applies: for h(x)=f(g(x))h(x)=f(g(x)), h′(a)=f′(g(a))⋅g′(a)h'(a)=f'(g(a))\cdot g'(a). f′f' is evaluated at g(a)g(a), not at aa. First find g(a)g(a), then look up that value in the f′f' table.

Implicit differentiation

In the circle x2+y2=25x^2+y^2=25 you cannot write yy in terms of xx with a single formula (y=±25−x2y=\pm\sqrt{25-x^2}, two pieces). In implicit differentiation you differentiate without solving for yy.

Method:

  1. Differentiate both sides of the equation with respect to xx.
  2. In every term containing yy use the chain rule: ddx[yn]=nyn−1y′\dfrac{d}{dx}[y^n]=ny^{n-1}y'.
  3. Collect the terms containing y′y' on one side, factor out y′y', and divide.

Example 6 (circle). x2+y2=25x^2+y^2=25, tangent at the point (3,−4)(3,-4).

2x+2yy′=0⇒y′=−xy2x+2yy'=0 \Rightarrow y'=-\frac xy

At (3,−4)(3,-4), y′=−3−4=34y'=-\dfrac{3}{-4}=\dfrac34. Tangent: y+4=34(x−3)y+4=\dfrac34(x-3). Geometry says the same: the tangent is perpendicular to the radius; the slope of the radius is −43-\tfrac43 and that of the tangent is 34\tfrac34.

Example 7 (with a product). x2y+y3=10x^2y+y^3=10, y′y' at (3,1)(3,1).

d/dx[x^2 y] = 2x y + x^2 y'        (product rule)
d/dx[y^3]   = 3y^2 y'              (chain rule)
2xy + x^2 y' + 3y^2 y' = 0
y'(x^2 + 3y^2) = -2xy
y' = -2xy / (x^2 + 3y^2)
(3,1):  y' = -6 / 12 = -1/2

The second derivative by implicit differentiation

For y′′y'', differentiate the y′y' expression again. Replace the resulting y′y' with the formula you found, then simplify using the curve equation.

Example 8. For x2+y2=25x^2+y^2=25, y′=−xyy'=-\dfrac xy.

y′′=−1⋅y−x⋅y′y2=−y−x(−xy)y2=−y2+x2y3=−25y3y''=-\frac{1\cdot y-x\cdot y'}{y^2}=-\frac{y-x\left(-\frac xy\right)}{y^2}=-\frac{y^2+x^2}{y^3}=-\frac{25}{y^3}

In the last step x2+y2=25x^2+y^2=25 was used. At (3,4)(3,4), y′′=−2564<0y''=-\dfrac{25}{64}<0: the upper semicircle is concave down, which makes sense.

The rational power rule

Implicit differentiation is also the proof of the rule (xp/q)′=pqxp/q−1(x^{p/q})'=\frac pq x^{p/q-1}: if y=xp/qy=x^{p/q}, then yq=xpy^q=x^p; differentiate: qyq−1y′=pxp−1qy^{q-1}y'=px^{p-1}, and solve for y′y'. For example (x2/3)′=23x−1/3(x^{2/3})'=\frac23x^{-1/3}.

PITFALL · differentiating yy as if it were a constant. Writing ddx[y2]=2y\dfrac{d}{dx}[y^2]=2y is wrong; the correct answer is 2yy′2yy'. Likewise ddx[xy]\dfrac{d}{dx}[xy] is not yy, it is y+xy′y+xy'. Every time yy appears, a y′y' is born.

Common mistakes

Wrong thinkingCorrect
(cos⁡x)′=sin⁡x(\cos x)'=\sin x−sin⁡x-\sin x
(sin⁡5x)′=cos⁡5x(\sin 5x)'=\cos 5x5cos⁡5x5\cos 5x, the derivative of the inside
(sin⁡2x)′=2cos⁡x(\sin^2x)'=2\cos x2sin⁡xcos⁡x2\sin x\cos x
(sin⁡x2)′=cos⁡2x(\sin x^2)'=\cos 2x2xcos⁡(x2)2x\cos(x^2)
[(x2+1)5]′=5(2x)4[(x^2+1)^5]'=5(2x)^45(x2+1)4⋅2x5(x^2+1)^4\cdot 2x
h′(a)=f′(a)g′(a)h'(a)=f'(a)g'(a)f′(g(a)) g′(a)f'(g(a))\,g'(a)
ddxy3=3y2\dfrac{d}{dx}y^3=3y^23y2y′3y^2y'
ddx(xy)=xy′\dfrac{d}{dx}(xy)=xy'y+xy′y+xy' (product rule)
In implicit differentiation, the derivative of the constant on the right side is a constantThe derivative of a constant is 00
Substituting the point without checking itFirst verify that the point is on the curve

Test yourself

Exam-style questions. Solve them on paper first, then reveal the answer.

Question 1easy

Differentiate y=x2sin⁡xy=x^2\sin x.

Show answer
y′=2xsin⁡x+x2cos⁡xy'=2x\sin x+x^2\cos x

Product rule: (x2)′sin⁡x+x2(sin⁡x)′=2xsin⁡x+x2cos⁡x(x^2)'\sin x+x^2(\sin x)'=2x\sin x+x^2\cos x.

Question 2medium

Differentiate y=sec⁡xtan⁡xy=\sec x\tan x.

Show answer
y′=sec⁡xtan⁡2x+sec⁡3xy'=\sec x\tan^2 x+\sec^3 x

Product rule: (sec⁡x)′tan⁡x+sec⁡x(tan⁡x)′=(sec⁡xtan⁡x)tan⁡x+sec⁡x⋅sec⁡2x=sec⁡xtan⁡2x+sec⁡3x(\sec x)'\tan x+\sec x(\tan x)'=(\sec x\tan x)\tan x+\sec x\cdot\sec^2 x=\sec x\tan^2 x+\sec^3 x. If you like, you can also write it as 2sec⁡3x−sec⁡x2\sec^3x-\sec x using tan⁡2x=sec⁡2x−1\tan^2 x=\sec^2x-1.

Question 3easy

Differentiate y=(3x2−5)7y=(3x^2-5)^7.

Show answer
y′=42x(3x2−5)6y'=42x(3x^2-5)^6

The outer function is u7u^7, the inner function is u=3x2−5u=3x^2-5. Chain rule: 7u6⋅u′=7(3x2−5)6⋅6x=42x(3x2−5)67u^6\cdot u'=7(3x^2-5)^6\cdot 6x=42x(3x^2-5)^6.

Question 4medium

Differentiate y=sin⁡3(2x)y=\sin^3(2x).

Show answer
y′=6sin⁡2(2x)cos⁡(2x)y'=6\sin^2(2x)\cos(2x)

Three layers: cube, sine, 2x2x. From outside to inside: 3sin⁡2(2x)⋅cos⁡(2x)⋅2=6sin⁡2(2x)cos⁡(2x)3\sin^2(2x)\cdot\cos(2x)\cdot 2=6\sin^2(2x)\cos(2x).

Question 5medium

Differentiate y=1+cos⁡2xy=\sqrt{1+\cos^2 x}.

Show answer
y′=−sin⁡xcos⁡x1+cos⁡2xy'=-\dfrac{\sin x\cos x}{\sqrt{1+\cos^2 x}}

y=(1+cos⁡2x)1/2y=(1+\cos^2x)^{1/2}. Root: 12(1+cos⁡2x)−1/2\tfrac12(1+\cos^2x)^{-1/2}. Derivative of the inside: 2cos⁡x⋅(−sin⁡x)2\cos x\cdot(-\sin x). Multiply: −2sin⁡xcos⁡x21+cos⁡2x=−sin⁡xcos⁡x1+cos⁡2x\dfrac{-2\sin x\cos x}{2\sqrt{1+\cos^2x}}=-\dfrac{\sin x\cos x}{\sqrt{1+\cos^2x}}.

Question 6medium

Differentiate y=cos⁡(x2+1)y=\cos\left(\sqrt{x^2+1}\right).

Show answer
y′=−xsin⁡x2+1x2+1y'=-\dfrac{x\sin\sqrt{x^2+1}}{\sqrt{x^2+1}}

Outer: cos⁡u\cos u, its derivative is −sin⁡u-\sin u. Middle: u=vu=\sqrt{v}, its derivative is 12v\dfrac{1}{2\sqrt v}. Inner: v=x2+1v=x^2+1, its derivative is 2x2x. Multiply: −sin⁡x2+1⋅2x2x2+1-\sin\sqrt{x^2+1}\cdot\dfrac{2x}{2\sqrt{x^2+1}}.

Question 7medium

Find dydx\dfrac{dy}{dx} at the point (1,2)(1,2) on the curve x2+xy+y2=7x^2+xy+y^2=7.

Show answer
−45-\dfrac45

First check that the point is on the curve: 1+2+4=71+2+4=7. Differentiate every term with respect to xx (product rule for xyxy): 2x+(y+xy′)+2yy′=02x+(y+xy')+2yy'=0. Collect y′y': y′(x+2y)=−(2x+y)y'(x+2y)=-(2x+y), y′=−2x+yx+2yy'=-\dfrac{2x+y}{x+2y}. At (1,2)(1,2): −45-\dfrac{4}{5}.

Question 8medium

Find the equation of the tangent line to x3+y3=9x^3+y^3=9 at (1,2)(1,2).

Show answer
y=−14x+94y=-\dfrac14x+\dfrac94

3x2+3y2y′=0⇒y′=−x2y23x^2+3y^2y'=0 \Rightarrow y'=-\dfrac{x^2}{y^2}. At (1,2)(1,2), y′=−14y'=-\dfrac14. Line: y−2=−14(x−1)y-2=-\dfrac14(x-1), that is y=−14x+94y=-\dfrac14x+\dfrac94.

Question 9hard

Find dydx\dfrac{dy}{dx} if sin⁡(xy)=x\sin(xy)=x.

Show answer
dydx=1−ycos⁡(xy)xcos⁡(xy)\dfrac{dy}{dx}=\dfrac{1-y\cos(xy)}{x\cos(xy)}

Chain rule on the left side, product rule for the inner xyxy: cos⁡(xy)⋅(y+xy′)=1\cos(xy)\cdot(y+xy')=1. Expand: ycos⁡(xy)+xcos⁡(xy) y′=1y\cos(xy)+x\cos(xy)\,y'=1. Isolate y′y': y′=1−ycos⁡(xy)xcos⁡(xy)y'=\dfrac{1-y\cos(xy)}{x\cos(xy)}.

Question 10hard

For the curve x2−y2=9x^2-y^2=9, show that d2ydx2=−9y3\dfrac{d^2y}{dx^2}=-\dfrac{9}{y^3}, and evaluate it at (5,4)(5,4).

Show answer
y′′(5,4)=−964y''(5,4)=-\dfrac{9}{64}

First derivative: 2x−2yy′=0⇒y′=xy2x-2yy'=0 \Rightarrow y'=\dfrac xy. Differentiate again with the quotient rule, remembering that yy depends on xx: y′′=y−xy′y2=y−x⋅xyy2=y2−x2y3y''=\dfrac{y-xy'}{y^2}=\dfrac{y-x\cdot\frac xy}{y^2}=\dfrac{y^2-x^2}{y^3}. By the curve equation y2−x2=−9y^2-x^2=-9, so y′′=−9y3y''=-\dfrac{9}{y^3}. At (5,4)(5,4): −964-\dfrac{9}{64}.

Question 11easy

Let h(x)=f(g(x))h(x)=f(g(x)), where g(1)=3g(1)=3, g′(1)=2g'(1)=2, and f′(3)=−4f'(3)=-4. Find h′(1)h'(1).

Show answer
-8

Chain rule: h′(1)=f′(g(1))⋅g′(1)=f′(3)⋅2=(−4)(2)=−8h'(1)=f'(g(1))\cdot g'(1)=f'(3)\cdot 2=(-4)(2)=-8. Note that you evaluate f′f' at g(1)=3g(1)=3, not at 11.

Question 12hard

Find all points on the curve x2−xy+y2=3x^2-xy+y^2=3 where the tangent line is horizontal.

Show answer
(1, 2) and (-1, -2)

2x−(y+xy′)+2yy′=0⇒y′(2y−x)=y−2x⇒y′=y−2x2y−x2x-(y+xy')+2yy'=0 \Rightarrow y'(2y-x)=y-2x \Rightarrow y'=\dfrac{y-2x}{2y-x}. Horizontal tangent: the numerator is zero, y=2xy=2x. Substitute into the curve: x2−2x2+4x2=3⇒3x2=3⇒x=±1x^2-2x^2+4x^2=3 \Rightarrow 3x^2=3 \Rightarrow x=\pm1. The points are (1,2)(1,2) and (−1,−2)(-1,-2). Check the denominator: 2y−x=32y-x=3 and −3-3, not zero.

Verification: All derivatives were checked with node (verify/MAT1051/06.mjs): explicit derivatives by the central difference at five points; for implicit derivatives the curve was solved locally as y(x) with Newton's method, and dy/dx and y'' were computed numerically and compared with the formula.

Review card

(sin x)' = cos x (cos x)' = -sin x (tan x)' = sec^2 x (sec x)' = sec x tan x (csc x)' = -csc x cot x (cot x)' = -csc^2 x The ones starting with "c" (cos, csc, cot) have a MINUS in the derivative All valid in RADIANS CHAIN: [f(g(x))]' = f'(g(x)) · g'(x) outside to inside, multiply the derivative of each layer dy/dx = dy/du · du/dx sin^n(u)' = n sin^(n-1)(u) · cos(u) · u' [u^n]' = n u^(n-1) u' [sqrt(u)]' = u' / (2 sqrt(u)) IMPLICIT: d/dx of both sides; every term containing y gets multiplied by y' (y^2)' = 2y y' (xy)' = y + x y' sin(y)' = cos(y) y' Isolate y'; if a point is given, substitute afterwards y'': differentiate the y' expression again, then replace the resulting y' with the expression you found