Skip to main content

CLP-1 Differential Calculus

Section 2.8 Derivatives of Trigonometric Functions

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 
In science, radians is the standard unit for measuring angles. While you may be more familiar with degrees, radians should be used in any computation involving calculus. Using degrees will cause errors. Thankfully it is easy to translate between these two measures since \(360^\circ = 2\pi\) radians. See Appendix B.2.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.

Subsection 2.8.1 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.

Subsection 2.8.2 Step 1: \(\mathbf{\diff{}{x} \{ \sin x \} \big|_{x=0}}\)

By definition, the derivative of \(\sin x\) evaluated at \(x=0\) is
\begin{gather*} \diff{}{x} \{ \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
\begin{equation*} \lim_{h\rightarrow 0}\frac{\sin h}{h}=1 \end{equation*}
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.

Subsection 2.8.3 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 &= \half\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 &= \half\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 \(\ds \frac{\sin h}{h} \leq 1\text{.}\)
  • Since \(\ds h \leq \frac{\sin h}{\cos h}\) we have that \(\ds \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 
Again, refresh your memory by looking up Appendix A.5.
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:
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*} \diff{}{x} \{ \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 \(\diff{}{x}\sin x\big|_{x=0}=1\text{.}\) The remaining steps are easier.

Subsection 2.8.4 Step 2: \(\mathbf{\diff{}{x} \{ \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 
See Appendix A.14 if you have forgotten. You should also recall that \(\sin^2\theta + \cos^2\theta = 1\text{.}\) Sorry for nagging.
.

Subsubsection 2.8.4.1 Method 1 — Multiply by the “Conjugate”

Start by multiplying the expression inside the limit by 1, written as \(\ds \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*}

Subsubsection 2.8.4.2 Method 2 — via the Double Angle Formula

The other way involves the double angle formula
 4 
We hope you looked this up in in Appendix A.14. Nag.
,
\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 \(\ds \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:
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*} \diff{}{x} \{ \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.

Subsection 2.8.5 Step 3: \(\diff{}{x} \{ \sin x \}\) and \(\diff{}{x} \{ \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 
You really should. Look this up in Appendix A.8 if you have forgotten.
\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*} \diff{}{x}\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[\diff{}{x}\cos x\bigg]_{x=0}}_{=0} \ +\ \cos x\ \underbrace{\bigg[\diff{}{x}\sin x\bigg]_{x=0}}_{=1}\\ &=\cos x \end{align*}
The computation of the derivative of \(\cos x\) is very similar.
\begin{align*} \diff{}{x}\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[\diff{}{x}\cos x\bigg]_{x=0}}_{=0} \ -\ \sin x\ \underbrace{\bigg[\diff{}{x}\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.
These formulae are pretty easy to remember — applying \(\diff{}{x}\) to \(\sin x\) and \(\cos x\) just exchanges \(\sin x\) and \(\cos x\text{,}\) except for the minus sign
 6 
There is a bad pun somewhere in here about sine errors and sign errors.
in the derivative of \(\cos x\text{.}\)

Remark 2.8.4. Optional — Another derivation of \(\diff{}{x}\cos x =-\sin x\).

We remark that, once one knows that \(\diff{}{x}\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 \(\diff{}{x}\cos x =-\sin x\text{.}\) Here is how
 7 
We thank Serban Raianu for suggesting that we include this.
.
\begin{align*} \diff{}{x}\cos x \amp=\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} \\ \amp=-\lim_{h'\rightarrow 0}\frac{\sin\big(x'+h')-\sin(x')}{h'} \qquad\text{with }x'=\tfrac{\pi}{2}-x,\ h'=-h\\ \amp=-\diff{}{x'}\sin x'\Big|_{x'=\tfrac{\pi}{2}-x} =-\cos\big(\tfrac{\pi}{2}- x\big)\\ \amp=-\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.

Subsection 2.8.6 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 
You really should. If you do not then take a quick look at the appropriate appendix.
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} \diff{}{x}\tan x &=\diff{}{x}\,\frac{\sin x}{\cos x} & &=\frac{\overbrace{\big({\ts\diff{}{x}}\sin x\big)}^{\cos x}\cos x -\sin x\overbrace{\big({\ts\diff{}{x}\cos x}\big)}^{-\sin x}} {\cos^2 x} & &=\sec^2 x\\ \diff{}{x}\,\csc x &=\diff{}{x}\,\frac{1}{\sin x} & &=-\frac{\overbrace{\big({\ts\diff{}{x}}\sin x\big)}^{\cos x}} {\sin^2 x} & &=-\csc x\cot x\\ \diff{}{x}\,\sec x &=\diff{}{x}\,\frac{1}{\cos x} & &=-\frac{\overbrace{\big({\ts\diff{}{x}}\cos x\big)}^{-\sin x}} {\cos^2 x} & &=\sec x\tan x\\ \diff{}{x}\cot x &=\diff{}{x}\,\frac{\cos x}{\sin x} & &=\frac{ \overbrace{\big({\ts\diff{}{x}}\cos x\big)}^{-\sin x}\sin x -\cos x\overbrace{{\ts\big(\diff{}{x}}\sin x\big)}^{\cos x}} {\sin^2 x} & &=-\csc^2 x \end{alignat*}

Subsection 2.8.7 Summary

To summarise all this work, we can write this up as a theorem:
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 2.8.8 Exercises

Exercises — Stage 1 .

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?
2.
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?

Exercises — Stage 2 .

3.
Differentiate \(f(x)=\sin x + \cos x +\tan x\text{.}\)
4.
For which values of \(x\) does the function \(f(x)=\sin x + \cos x\) have a horizontal tangent?
5.
Differentiate \(f(x)=\sin^2 x + \cos^2 x\text{.}\)
6.
Differentiate \(f(x)=2\sin x \cos x\text{.}\)
7.
Differentiate \(f(x)=e^x\cot x\text{.}\)
8.
Differentiate \(f(x) = \dfrac{2\sin x + 3 \tan x}{\cos x + \tan x}\)
9.
Differentiate \(f(x) = \dfrac{5\sec x+1}{e^x}\text{.}\)
10.
Differentiate \(f(x)=(e^x+\cot x)(5x^6-\csc x)\text{.}\)
11.
Differentiate \(f(\theta)=\sin\left(\frac{\pi}{2}-\theta \right)\text{.}\)
12.
Differentiate \(f(x)=\sin(-x)+\cos(-x)\text{.}\)
13.
Differentiate \(s(\theta)=\dfrac{\cos \theta + \sin \theta}{\cos \theta - \sin\theta}\text{.}\)
14. (✳).
Find the values of the constants \(a\) and \(b\) for which
\begin{equation*} f(x) = \left\{ \begin{array}{cc} \cos(x) & x\le 0\\ ax + b & x \gt 0\end{array} \right. \end{equation*}
is differentiable everywhere.
15. (✳).
Find the equation of the line tangent to the graph of \(y=\cos(x)+2x\) at \(x=\dfrac{\pi}{2}\text{.}\)

Exercises — Stage 3 .

16. (✳).
Evaluate \(\displaystyle \lim_{x\to 2015}\left( \dfrac{\cos(x)-\cos(2015)}{x-2015}\right).\)
17. (✳).
Evaluate \(\displaystyle \lim_{x\to \pi/3}\left( \dfrac{\cos(x)-1/2}{x-\pi/3}\right).\)
18. (✳).
Evaluate \(\displaystyle \lim_{x\to \pi}\left(\dfrac{\sin(x)}{x-\pi}\right).\)
19.
Show how you can use the quotient rule to find the derivative of tangent, if you already know the derivatives of sine and cosine.
20. (✳).
The derivative of the function
\begin{equation*} 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. \end{equation*}
exists for all \(x\text{.}\) Determine the values of the constants \(a\) and \(b\text{.}\)
21. (✳).
For which values of \(x\) does the derivative of \(f(x) = \tan x\) exist?
22. (✳).
For what values of \(x\) does the derivative of \(\dfrac{10\sin(x)}{x^2+x-6}\) exist? Explain your answer.
23. (✳).
For what values of \(x\) does the derivative of \(\dfrac{x^2+6x+5}{\sin(x)}\) exist? Explain your answer.
24. (✳).
Find the equation of the line tangent to the graph of \(y=\tan(x)\) at \(x=\dfrac{\pi}{4}\text{.}\)
25. (✳).
Find the equation of the line tangent to the graph of \(y=\sin(x)+\cos(x)+e^x\) at \(x=0\text{.}\)
26.
For which values of \(x\) does the function \(f(x)=e^x\sin x\) have a horizontal tangent line?
27.
Let
\begin{equation*} f(x)=\left\{\begin{array}{ccc} \frac{\sin x}{x}&,&x \neq 0\\ 1&,&x=0 \end{array}\right. \end{equation*}
Find \(f'(0)\text{,}\) or show that it does not exist.
28. (✳).
Differentiate the function
\begin{equation*} h(x) = \sin(|x|) \end{equation*}
and give the domain where the derivative exists.
29. (✳).
For the function
\begin{equation*} f(x) =\left\{\begin{array}{ll} 0 & x\le 0\\ \frac{\sin(x)}{\sqrt{x}} & x \gt 0\end{array}\right. \end{equation*}
which of the following statements is correct?
  1. \(f\) is undefined at \(x = 0\text{.}\)
  2. \(f\) is neither continuous nor differentiable at \(x = 0\text{.}\)
  3. \(f\) is continuous but not differentiable at \(x = 0\text{.}\)
  4. \(f\) is differentiable but not continuous at \(x = 0\text{.}\)
  5. \(f\) is both continuous and differentiable at \(x = 0\text{.}\)
30. (✳).
Evaluate \(\lim\limits_{x\rightarrow 0} \dfrac{\sin x^{27}+2x^5 e^{x^{99}}}{\sin^5 x}\text{.}\)