23.4 Derivatives of Trigonometric Functions

IB Math AA SL and HL: the derivatives of sin x and cos x, and why x must be in radians; how to use the chain, product and quotient rules with… Worked examples and solutions.

SL 5.6

In this section you will learn
  • the derivatives of \(\sin x\) and \(\cos x\), and why \(x\) must be in radians
  • how to use the chain, product and quotient rules with trigonometric functions

In calculus, angles are always measured in radians. The formulae on this page are not true in degrees. (For radians and the trigonometric graphs, see Unit 13.)

Derivatives of sin x and cos x

Derivatives of \(\sin x\) and \(\cos x\) (\(x\) in radians) In the formula booklet

\[ f(x) = \sin x \;\Rightarrow\; f'(x) = \cos x \qquad\qquad f(x) = \cos x \;\Rightarrow\; f'(x) = -\sin x \]

You can see the first result on the graphs: where \(y = \sin x\) has a maximum or minimum (gradient \(0\)), \(\cos x = 0\); at \(x = 0\) the sine curve is steepest, with gradient \(1 = \cos 0\).

Use the compound angle formula \(\sin(x + h) = \sin x \cos h + \cos x \sin h\):

\[ \frac{\sin(x + h) - \sin x}{h} = \sin x \cdot \frac{\cos h - 1}{h} + \cos x \cdot \frac{\sin h}{h} . \]

When \(h\) is in radians, \(\displaystyle\lim_{h \to 0}\frac{\sin h}{h} = 1\) and \(\displaystyle\lim_{h \to 0}\frac{\cos h - 1}{h} = 0\) (see Unit 25). So the limit is \(\sin x \cdot 0 + \cos x \cdot 1 = \cos x\). In degrees the first limit is \(\dfrac{\pi}{180}\), not \(1\) — this is why we use radians.

Using the chain rule

Example 1 Differentiate with respect to \(x\):

(a) \(\sin 4x\) \(\qquad\) (b) \(\cos\left(5x + \dfrac{\pi}{3}\right)\)

(a) The inside is \(4x\), with derivative \(4\): \(\;\dfrac{\mathrm{d}}{\mathrm{d}x}(\sin 4x) = 4\cos 4x\).

(b) The inside is \(5x + \dfrac{\pi}{3}\), with derivative \(5\): \(\;\dfrac{\mathrm{d}}{\mathrm{d}x}\cos\left(5x + \dfrac{\pi}{3}\right) = -5\sin\left(5x + \dfrac{\pi}{3}\right)\).

In general, if \(f(x)\) is any function, the chain rule gives the following.

Trigonometric functions of a function Not in the formula booklet

\(y\) \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\)
\(\sin f(x)\) \(f'(x)\cos f(x)\)
\(\cos f(x)\) \(-f'(x)\sin f(x)\)

In particular, \(\dfrac{\mathrm{d}}{\mathrm{d}x}\sin(ax + b) = a\cos(ax + b)\) and \(\dfrac{\mathrm{d}}{\mathrm{d}x}\cos(ax + b) = -a\sin(ax + b)\).

  • \(f(x)\): the inside function
  • \(f'(x)\): the derivative of the inside function
  • \(a\), \(b\): constants

Remember that \(\sin^n x\) means \((\sin x)^n\). To differentiate it, use the power-of-a-function rule from 23.3.

Example 2 Differentiate with respect to \(x\):

(a) \(\cos\sqrt{2x + 9}\)

(b) \(\sin^3 2x \cos x\)

(a) The inside is \((2x + 9)^{\frac{1}{2}}\), with derivative \(\dfrac{1}{2}(2x + 9)^{-\frac{1}{2}} \times 2 = \dfrac{1}{\sqrt{2x + 9}}\). So

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = -\frac{\sin\sqrt{2x + 9}}{\sqrt{2x + 9}} . \]

(b) Product rule with \(u = \sin^3 2x\) and \(v = \cos x\). By the chain rule \(u' = 3\sin^2 2x \times 2\cos 2x = 6\sin^2 2x\cos 2x\).

\[ \begin{aligned} \frac{\mathrm{d}y}{\mathrm{d}x} &= 6\sin^2 2x\cos 2x\cos x - \sin^3 2x\sin x \\ &= \sin^2 2x\,(6\cos 2x\cos x - \sin 2x\sin x) . \end{aligned} \]

Example 3 Find the gradient of the curve \(y = x^2\cos x\) at the point where \(x = \pi\).

Product rule: \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2x\cos x - x^2\sin x\).

At \(x = \pi\): \(\;2\pi\cos\pi - \pi^2\sin\pi = 2\pi(-1) - 0 = -2\pi\).

Check that the calculator is in radian mode. The angle mode is shown at the top right of the screen (DEG or RAD). Click on it to switch between degrees and radians: it must show RAD.

This calculator is in degree mode (DEG). Click on DEG to change it to RAD.

You can also open Document Settings and change Angle to Radian.

Document Settings: the Angle box (here Degree).

Then use Menu → Calculus → Numerical Derivative at a Point. For example, for \(x^2\cos x\) at \(x = \pi\) the result is \(-6.28319\), which is \(-2\pi\). In degree mode you would get a wrong answer.

HL students: continue with 23.5 Derivatives of Further Trigonometric Functions.

Common errors

✗ Wrong ✓ Right Why
\(\dfrac{\mathrm{d}}{\mathrm{d}x}(\cos x) = \sin x\) \(-\sin x\) The derivative of \(\cos\) has a minus sign.
\(\dfrac{\mathrm{d}}{\mathrm{d}x}(\sin 4x) = \cos 4x\) \(4\cos 4x\) Multiply by the derivative of the inside, \(4\).
\(\dfrac{\mathrm{d}}{\mathrm{d}x}(\sin 4x) = 4\cos x\) \(4\cos 4x\) The inside \(4x\) stays the same.
\(\dfrac{\mathrm{d}}{\mathrm{d}x}(\sin^2 x) = \cos^2 x\) \(2\sin x\cos x\) \(\sin^2 x = (\sin x)^2\): use the power rule and the chain rule.
Working in degrees Radians The formulae are only true in radians.

Exercises

1 Differentiate \(y = \cos(4 - 2x)\).

The inside has derivative \(-2\): \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = -\sin(4 - 2x) \times (-2) = 2\sin(4 - 2x)\).

2 Differentiate \(y = \sin^2 x\), and show that your answer equals \(\sin 2x\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2\sin x \times \cos x = 2\sin x\cos x = \sin 2x\) (double angle identity).

3 Show that \(\dfrac{\mathrm{d}}{\mathrm{d}x}\left(\dfrac{\cos x}{1 + \sin x}\right) = -\dfrac{1}{1 + \sin x}\).

\[ \frac{(1 + \sin x)(-\sin x) - \cos x\cos x}{(1 + \sin x)^2} = \frac{-\sin x - (\sin^2 x + \cos^2 x)}{(1 + \sin x)^2} = \frac{-(1 + \sin x)}{(1 + \sin x)^2} = -\frac{1}{1 + \sin x} . \]

4 Find the gradient of the curve \(y = \sin 2x + \cos x\) at the point where \(x = \dfrac{\pi}{6}\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2\cos 2x - \sin x\). At \(x = \dfrac{\pi}{6}\): \(\;2\cos\dfrac{\pi}{3} - \sin\dfrac{\pi}{6} = 1 - \dfrac{1}{2} = \dfrac{1}{2}\).