# 2.8: Derivatives of Trigonometric Functions

- Page ID
- 89720

We are now going to compute the derivatives of the various trigonometric functions, \(\sin x\text{,}\) \(\cos x\) and so on. The computations are more involved than the others that we have done so far and will take several steps. Fortunately, the final answers will be very simple.

Observe that we only need to work out the derivatives of \(\sin x\) and \(\cos x\text{,}\) since the other trigonometric functions are really just quotients of these two functions. Recall:

\begin{align*} \tan x &= \frac{\sin x}{\cos x} & \cot x &= \frac{\cos x}{\sin x} & \csc x &= \frac{1}{\sin x} & \sec x &= \frac{1}{\cos x}. \end{align*}

The first steps towards computing the derivatives of \(\sin x, \cos x\) is to find their derivatives at \(x=0\text{.}\) The derivatives at general points \(x\) will follow quickly from these, using trig identities. It is important to note that we must measure angles in radians ^{1}, rather than degrees, in what follows. Indeed — unless explicitly stated otherwise, any number that is put into a trigonometric function is measured in radians.

## These Proofs are Optional, the Results are Not.

While we expect you to read and follow these proofs, we do not expect you to be able to reproduce them. You will be required to know the results, in particular Theorem 2.8.5 below.

## Step 1: \(\mathbf{\dfrac{d}{dx} \{ \sin x \} \big|_{x=0}}\)

By definition, the derivative of \(\sin x\) evaluated at \(x=0\) is

\begin{gather*} \dfrac{d}{dx} \{ \sin x \} \Big|_{x=0} =\lim_{h\rightarrow 0}\frac{\sin h-\sin 0}{h} =\lim_{h\rightarrow 0}\frac{\sin h}{h} \end{gather*}

We will prove this limit by use of the squeeze theorem (Theorem 1.4.18). To get there we will first need to do some geometry. But first we will build some intuition.

The figure below contains part of a circle of radius 1. Recall that an arc of length \(h\) on such a circle subtends an angle of \(h\)** radians** at the centre of the circle. So the darkened arc in the figure has length \(h\) and the darkened vertical line in the figure has length \(\sin h\text{.}\) We must determine what happens to the ratio of the lengths of the darkened vertical line and darkened arc as \(h\) tends to zero.

Here is a magnified version of the part of the above figure that contains the darkened arc and vertical line.

This particular figure has been drawn with \(h=.4\) radians. Here are three more such blow ups. In each successive figure, the value of \(h\) is smaller. To make the figures clearer, the degree of magnification was increased each time \(h\) was decreased.

As we make \(h\) smaller and smaller and look at the figure with ever increasing magnification, the arc of length \(h\) and vertical line of length \(\sin h\) look more and more alike. We would guess from this that

\[ \lim_{h\rightarrow 0}\frac{\sin h}{h}=1 \nonumber \]

The following tables of values

\(h\) | \(\sin h\) | \(\tfrac{\sin h}{h}\) |

0.4 | .3894 | .9735 |

0.2 | .1987 | .9934 |

0.1 | .09983 | .9983 |

0.05 | .049979 | .99958 |

0.01 | .00999983 | .999983 |

0.001 | .0099999983 | .9999983 |

h | \(\sin h\) | \(\tfrac{\sin h}{h}\) |

\(-0.4\) | \(-.3894\) | .9735 |

\(-0.2\) | \(-.1987\) | .9934 |

\(-0.1\) | \(-.09983\) | .9983 |

\(-0.05\) | \(-.049979\) | .99958 |

\(-0.01\) | \(-.00999983\) | .999983 |

\(-0.001\) | \(-.0099999983\) | .9999983 |

suggests the same guess. Here is an argument that shows that the guess really is correct.

## Proof that \(\mathbf{\lim\limits_{h\rightarrow 0}\tfrac{\sin h}{h}=1}\)

The circle in the figure above has radius \(1\text{.}\) Hence

\begin{align*} |OP|=|OR|&=1 & |PS|&=\sin h\\ |OS|&= \cos h & |QR|&=\tan h \end{align*}

Now we can use a few geometric facts about this figure to establish both an upper bound and a lower bound on \(\frac{\sin h}{h}\) with both the upper and lower bounds tending to \(1\) as \(h\) tends to \(0\text{.}\) So the squeeze theorem will tell us that \(\frac{\sin h}{h}\) also tends to \(1\) as \(h\) tends to \(0\text{.}\)

- The triangle \(OPR\) has base \(1\) and height \(\sin h\text{,}\) and hence
\begin{align*} \text{area of }\triangle OPR &=\frac{1}{2}\times1\times\sin h=\frac{\sin h}{2}. \end{align*}

- The triangle \(OQR\) has base \(1\) and height \(\tan h\text{,}\) and hence
\begin{align*} \text{area of }\triangle OQR &= \frac{1}{2}\times1\times\tan h=\frac{\tan h}{2}. \end{align*}

- The “piece of pie” \(OPR\) cut out of the circle is the fraction \(\frac{h}{2\pi}\) of the whole circle (since the angle at the corner of the piece of pie is \(h\) radians and the angle for the whole circle is \(2\pi\) radians). Since the circle has radius \(1\) we have
\begin{align*} \text{area of pie } OPR &= \frac{h}{2\pi} \cdot (\text{area of circle}) = \frac{h}{2\pi} \pi \cdot 1^2= \frac{h}{2} \end{align*}

Now the triangle \(OPR\) is contained inside the piece of pie \(OPR\text{.}\) and so the area of the triangle is smaller than the area of the piece of pie. Similarly, the piece of pie \(OPR\) is contained inside the triangle \(OQR\text{.}\) Thus we have

\begin{gather*} \text{area of triangle } OPR \leq \text{ area of pie } OPR \leq \text{ area of triangle } OQR \end{gather*}

Substituting in the areas we worked out gives

\begin{align*} \frac{\sin h}{2} &\leq \frac{h}{2} \leq \frac{\tan h}{2}\\ \end{align*}

which cleans up to give

\begin{align*} \sin h &\leq h \leq \frac{\sin h}{\cos h} \end{align*}

We rewrite these two inequalities so that \(\frac{\sin h}{h}\) appears in both.

- Since \(\sin h \leq h\text{,}\) we have that \(\displaystyle \frac{\sin h}{h} \leq 1\text{.}\)
- Since \(\displaystyle h \leq \frac{\sin h}{\cos h}\) we have that \(\displaystyle \cos h \leq \frac{\sin h}{h}\text{.}\)

Thus we arrive at the “squeezable” inequality

\begin{gather*} \cos h \leq \frac{\sin h}{h} \leq 1 \end{gather*}

We know ^{2} that

\begin{align*} \lim_{h \to 0} \cos h &=1. \end{align*}

Since \(\tfrac{\sin h}{h}\) is sandwiched between \(\cos h\) and 1, we can apply the squeeze theorem for limits (Theorem 1.4.18) to deduce the following lemma:

\begin{align*} \lim_{h \to 0} \frac{\sin h}{h} &= 1. \end{align*}

Since this argument took a bit of work, perhaps we should remind ourselves why we needed it in the first place. We were computing

\begin{align*} \dfrac{d}{dx} \{ \sin x\}\Big|_{x=0} &= \lim_{h \to 0} \frac{\sin h - \sin 0}{h}\\ &= \lim_{h \to 0} \frac{\sin h}{h} & \text{(This is why!)}\\ &= 1 \end{align*}

This concludes Step 1. We now know that \(\dfrac{d}{dx}\sin x\big|_{x=0}=1\text{.}\) The remaining steps are easier.

## Step 2: \(\mathbf{\dfrac{d}{dx} \{ \cos x \} \big|_{x=0}}\)

By definition, the derivative of \(\cos x\) evaluated at \(x=0\) is

\begin{align*} \lim_{h\rightarrow 0}\frac{\cos h-\cos 0}{h} &=\lim_{h\rightarrow 0}\frac{\cos h - 1}{h} \end{align*}

Fortunately we don't have to wade through geometry like we did for the previous step. Instead we can recycle our work and massage the above limit to rewrite it in terms of expressions involving \(\frac{\sin h}{h}\text{.}\) Thanks to Lemma 2.8.1 the work is then easy.

We'll show you two ways to proceed — one uses a method similar to “multiplying by the conjugate” that we have already used a few times (see Example 1.4.17 and 2.2.9 ), while the other uses a nice trick involving the double–angle formula ^{3}.

###### Method 1 — Multiply by the “Conjugate”

Start by multiplying the expression inside the limit by 1, written as \(\displaystyle \frac{\cos h + 1}{\cos h +1}\text{:}\)

\begin{align*} \frac{\cos h - 1}{h} &= \frac{\cos h - 1}{h} \cdot\frac{\cos h + 1}{\cos h +1}\\ &= \frac{\cos^2 h - 1}{h (1+ \cos h)} &&\text{$\big($since $(a-b)(a+b)=a^2-b^2\big)$}\\ &= -\frac{\sin^2 h}{h(1+\cos h)} &&\text{(since $\sin^2 h + \cos^2 h=1$)}\\ &= - \frac{\sin h}{h} \cdot \frac{\sin h}{1 + \cos h} \end{align*}

Now we can take the limit as \(h \to 0\) via Lemma 2.8.1.

\begin{align*} \lim_{h \to 0} \frac{\cos h - 1}{h} &= \lim_{h \to 0} \left( \frac{-\sin h}{h} \cdot \frac{\sin h}{1 + \cos h} \right)\\ &= -\lim_{h \to 0}\left( \frac{\sin h}{h} \right) \cdot \lim_{h \to0} \left( \frac{\sin h}{1 + \cos h} \right)\\ &= - 1 \cdot \frac{0}{2}\\ &= 0 \end{align*}

###### Method 2 — via the Double Angle Formula

The other way involves the double angle formula ^{4},

\begin{gather*} \cos 2\theta = 1 - 2 \sin^2(\theta) \qquad\text{or}\qquad \cos 2\theta -1 = - 2 \sin^2(\theta) \end{gather*}

Setting \(\theta = h/2\text{,}\) we have

\begin{align*} \frac{\cos h - 1}{h} &= \frac{-2\big(\sin\tfrac{h}{2}\big)^2}{h}\\ \end{align*}

Now this begins to look like \(\frac{\sin h?}{h}\text{,}\) except that inside the \(\sin(\cdot)\) we have \(h/2\text{.}\) So, setting \(\theta =h/2\text{,}\)

\begin{align*} \frac{\cos h - 1}{h} &= - \frac{\sin^2 \theta}{\theta} = - \theta \cdot\frac{ \sin^2 \theta}{\theta^2}\\ &= - \theta \cdot \frac{\sin \theta}{\theta} \cdot \frac{\sin \theta}{\theta} \end{align*}When we take the limit as \(h \to 0\text{,}\) we are also taking the limit as \(\theta=h/2 \to 0\text{,}\) and so

\begin{align*} \lim_{h \to 0} \frac{\cos h - 1}{h} &= \lim_{\theta \to 0} \left[ - \theta \cdot \frac{\sin \theta}{\theta} \cdot \frac{\sin \theta}{\theta} \right]\\ &= \lim_{\theta \to 0} \left[- \theta \right] \cdot \lim_{\theta \to 0} \left[\frac{\sin \theta}{\theta}\right] \cdot \lim_{\theta \to 0} \left[\frac{\sin \theta}{\theta}\right]\\ &= 0 \cdot 1 \cdot 1\\ &= 0 \end{align*}

where we have used the fact that \(\displaystyle \lim_{h \to 0} \frac{\sin h}{h} = 1\) and that the limit of a product is the product of limits (i.e. Lemma 2.8.1 and Theorem 1.4.3).

Thus we have now produced two proofs of the following lemma:

\begin{align*} \lim_{h \to 0} \frac{\cos h -1}{h} &= 0 \end{align*}

Again, there has been a bit of work to get to here, so we should remind ourselves why we needed it. We were computing

\begin{align*} \dfrac{d}{dx} \{ \cos x \} \Big|_{x=0} &= \lim_{h \to 0} \frac{\cos h - \cos 0}{h}\\ &= \lim_{h \to 0} \frac{\cos h - 1}{h}\\ &= 0 \end{align*}

Armed with these results we can now build up the derivatives of sine and cosine.

## Step 3: \(\dfrac{d}{dx} \{ \sin x \}\) and \(\dfrac{d}{dx} \{ \cos x\}\) for General \(x\)

To proceed to the general derivatives of \(\sin x\) and \(\cos x\) we are going to use the above two results and a couple of trig identities. Remember the addition formulae ^{5}

\begin{align*} \sin(a+b) &= \sin(a) \cos(b) + \cos(a) \sin(b)\\ \cos(a+b) &= \cos(a) \cos(b) - \sin(a) \sin(b) \end{align*}

To compute the derivative of \(\sin(x)\) we just start from the definition of the derivative:

\begin{align*} \dfrac{d}{dx}\sin x &=\lim_{h\rightarrow 0}\frac{\sin (x+h)-\sin x}{h}\\ &=\lim_{h\rightarrow 0}\frac{\sin x\cos h +\cos x\sin h-\sin x}{h}\\ &=\lim_{h\rightarrow 0}\bigg[\sin x\frac{\cos h-1}{h} +\cos x\frac{\sin h-0}{h}\bigg]\\ &=\sin x\ \lim_{h\rightarrow 0}\frac{\cos h-1}{h} \ +\ \cos x\ \lim_{h\rightarrow 0}\frac{\sin h-0}{h}\\ &=\sin x\ \underbrace{\bigg[\dfrac{d}{dx}\cos x\bigg]_{x=0}}_{=0} \ +\ \cos x\ \underbrace{\bigg[\dfrac{d}{dx}\sin x\bigg]_{x=0}}_{=1}\\ &=\cos x \end{align*}

The computation of the derivative of \(\cos x\) is very similar.

\begin{align*} \dfrac{d}{dx}\cos x &=\lim_{h\rightarrow 0}\frac{\cos (x+h)-\cos x}{h}\\ &=\lim_{h\rightarrow 0}\frac{\cos x\cos h -\sin x\sin h-\cos x}{h}\\ &=\lim_{h\rightarrow 0}\bigg[\cos x\frac{\cos h-1}{h} -\sin x\frac{\sin h-0}{h}\bigg]\\ &=\cos x\ \lim_{h\rightarrow 0}\frac{\cos h-1}{h} \ -\ \sin x\ \lim_{h\rightarrow 0}\frac{\sin h-0}{h}\\ &=\cos x\ \underbrace{\bigg[\dfrac{d}{dx}\cos x\bigg]_{x=0}}_{=0} \ -\ \sin x\ \underbrace{\bigg[\dfrac{d}{dx}\sin x\bigg]_{x=0}}_{=1}\\ &=-\sin x \end{align*}

We have now found the derivatives of both \(\sin x\) and \(\cos x\text{,}\) *provided \(x\) is measured in radians*.

\begin{align*} \dfrac{d}{dx}\sin x &=\cos x & \dfrac{d}{dx}\cos x &=-\sin x \end{align*}

The above formulas hold provided \(x\) is measured in radians.

These formulae are pretty easy to remember — applying \(\dfrac{d}{dx}\) to \(\sin x\) and \(\cos x\) just exchanges \(\sin x\) and \(\cos x\text{,}\) except for the minus sign ^{6} in the derivative of \(\cos x\text{.}\)

We remark that, once one knows that \(\dfrac{d}{dx}\sin x =\cos x\text{,}\) it is easy to use it and the trig identity \(\cos(x) = \sin\big(\frac{\pi}{2}-x\big)\) to derive \(\dfrac{d}{dx}\cos x =-\sin x\text{.}\) Here is how^{ 7}.

\begin{align*} \dfrac{d}{dx}\cos x &=\lim_{h\rightarrow 0}\frac{\cos (x+h)-\cos x}{h} =\lim_{h\rightarrow 0}\frac{\sin\big(\frac{\pi}{2}-x-h) -\sin\big(\frac{\pi}{2}- x\big)}{h} \\ &=-\lim_{h'\rightarrow 0}\frac{\sin\big(x'+h')-\sin(x')}{h'} \qquad\text{with }x'=\tfrac{\pi}{2}-x,\ h'=-h\\ &=-\dfrac{d}{dx'}\sin x'\Big|_{x'=\tfrac{\pi}{2}-x} =-\cos\big(\tfrac{\pi}{2}- x\big)\\ &=-\sin x \end{align*}

Note that if \(x\) is measured in degrees, then the formulas of Lemma 2.8.3 are wrong. There are similar formulas, but we need the chain rule to build them — that is the subject of the next section. But first we should find the derivatives of the other trig functions.

## Step 4: the Remaining Trigonometric Functions

It is now an easy matter to get the derivatives of the remaining trigonometric functions using basic trig identities and the quotient rule. Remember ^{8} that

\begin{align*} \tan x&= \frac{\sin x}{\cos x} & \cot x &= \frac{\cos x}{\sin x}= \frac{1}{\tan x}\\ \csc x&= \frac{1}{\sin x} & \sec x &= \frac{1}{\cos x} \end{align*}

So, by the quotient rule,

\begin{alignat*}{3} \dfrac{d}{dx}\tan x &=\dfrac{d}{dx}\,\frac{\sin x}{\cos x} & &=\frac{\overbrace{\big({\dfrac{d}{dx}}\sin x\big)}^{\cos x}\cos x -\sin x\overbrace{\big({\dfrac{d}{dx}\cos x}\big)}^{-\sin x}} {\cos^2 x} & &=\sec^2 x\\ \dfrac{d}{dx}\,\csc x &=\dfrac{d}{dx}\,\frac{1}{\sin x} & &=-\frac{\overbrace{\big({\dfrac{d}{dx}}\sin x\big)}^{\cos x}} {\sin^2 x} & &=-\csc x\cot x\\ \dfrac{d}{dx}\,\sec x &=\dfrac{d}{dx}\,\frac{1}{\cos x} & &=-\frac{\overbrace{\big({\dfrac{d}{dx}}\cos x\big)}^{-\sin x}} {\cos^2 x} & &=\sec x\tan x\\ \dfrac{d}{dx}\cot x &=\dfrac{d}{dx}\,\frac{\cos x}{\sin x} & &=\frac{ \overbrace{\big({\dfrac{d}{dx}}\cos x\big)}^{-\sin x}\sin x -\cos x \overbrace{ {\big(\dfrac{d}{dx}}\sin x\big)}^{\cos x}} {\sin^2 x} & &=-\csc^2 x \end{alignat*}

## Summary

To summarise all this work, we can write this up as a theorem:

The derivatives of \(\sin x\) and \(\cos x\) are

\begin{align*} \dfrac{d}{dx} \sin x &= \cos x & \dfrac{d}{dx} \cos x &= - \sin x \end{align*}

Consequently the derivatives of the other trigonometric functions are

\begin{align*} \dfrac{d}{dx} \tan x &= \sec^2 x & \dfrac{d}{dx} \cot x &= -\csc^2 x\\ \dfrac{d}{dx} \csc x &= -\csc x \cot x & \dfrac{d}{dx} \sec x &= \sec x \tan x \end{align*}

Of these 6 derivatives you should really memorise those of sine, cosine and tangent. We certainly expect you to be able to work out those of cotangent, cosecant and secant.

## Exercises

Stage 1

Graph sine and cosine on the same axes, from \(x=-2\pi\) to \(x=2\pi\text{.}\) Mark the points where \(\sin x\) has a horizontal tangent. What do these points correspond to, on the graph of cosine?

Graph sine and cosine on the same axes, from \(x=-2\pi\) to \(x=2\pi\text{.}\) Mark the points where \(\sin x\) has a tangent line of maximum (positive) slope. What do these points correspond to, on the graph of cosine?

Stage 2

Differentiate \(f(x)=\sin x + \cos x +\tan x\text{.}\)

For which values of \(x\) does the function \(f(x)=\sin x + \cos x\) have a horizontal tangent?

Differentiate \(f(x)=\sin^2 x + \cos^2 x\text{.}\)

Differentiate \(f(x)=2\sin x \cos x\text{.}\)

Differentiate \(f(x)=e^x\cot x\text{.}\)

Differentiate \(f(x) = \dfrac{2\sin x + 3 \tan x}{\cos x + \tan x}\)

Differentiate \(f(x) = \dfrac{5\sec x+1}{e^x}\text{.}\)

Differentiate \(f(x)=(e^x+\cot x)(5x^6-\csc x)\text{.}\)

Differentiate \(f(\theta)=\sin\left(\frac{\pi}{2}-\theta \right)\text{.}\)

Differentiate \(f(x)=\sin(-x)+\cos(-x)\text{.}\)

Differentiate \(s(\theta)=\dfrac{\cos \theta + \sin \theta}{\cos \theta - \sin\theta}\text{.}\)

Find the values of the constants \(a\) and \(b\) for which

\[ f(x) = \left\{ \begin{array}{cc} \cos(x) & x\le 0\\ ax + b & x \gt 0\end{array} \right. \nonumber \]

is differentiable everywhere.

Find the equation of the line tangent to the graph of \(y=\cos(x)+2x\) at \(x=\dfrac{\pi}{2}\text{.}\)

Stage 3

Evaluate \(\displaystyle \lim_{x\to \pi/3}\left( \dfrac{\cos(x)-1/2}{x-\pi/3}\right).\) Use any method.

Show how you can use the quotient rule to find the derivative of tangent, if you already know the derivatives of sine and cosine.

The derivative of the function

\[ f(x)=\left\{\begin{array}{ll} ax+b& \mbox{for }x \lt 0\\ \frac{6\cos x}{2+\sin x+\cos x}& \mbox{for }x\ge 0 \end{array}\right. \nonumber \]

exists for all \(x\text{.}\) Determine the values of the constants \(a\) and \(b\text{.}\)

For which values of \(x\) does the derivative of \(f(x) = \tan x\) exist?

For what values of \(x\) does the derivative of \(\dfrac{10\sin(x)}{x^2+x-6}\) exist? Explain your answer.

For what values of \(x\) does the derivative of \(\dfrac{x^2+6x+5}{\sin(x)}\) exist? Explain your answer.

Find the equation of the line tangent to the graph of \(y=\tan(x)\) at \(x=\dfrac{\pi}{4}\text{.}\)

Find the equation of the line tangent to the graph of \(y=\sin(x)+\cos(x)+e^x\) at \(x=0\text{.}\)

For which values of \(x\) does the function \(f(x)=e^x\sin x\) have a horizontal tangent line?

Let

\[ f(x)=\left\{\begin{array}{ccc} \frac{\sin x}{x}&,&x \neq 0\\ 1&,&x=0 \end{array}\right. \nonumber \]

Find \(f'(0)\text{,}\) or show that it does not exist.

Differentiate the function

\[ h(x) = \sin(|x|) \nonumber \]

and give the domain where the derivative exists.

For the function

\[ f(x) =\left\{\begin{array}{ll} 0 & x\le 0\\ \frac{\sin(x)}{\sqrt{x}} & x \gt 0\end{array}\right. \nonumber \]

which of the following statements is correct?

- \(f\) is undefined at \(x = 0\text{.}\)
- \(f\) is neither continuous nor differentiable at \(x = 0\text{.}\)
- \(f\) is continuous but not differentiable at \(x = 0\text{.}\)
- \(f\) is differentiable but not continuous at \(x = 0\text{.}\)
- \(f\) is both continuous and differentiable at \(x = 0\text{.}\)

Evaluate \(\lim\limits_{x\rightarrow 0} \dfrac{\sin x^{27}+2x^5 e^{x^{99}}}{\sin^5 x}\text{.}\)