Derivatives of trigonometric functions

Sine and cosine describe anything that repeats, such as waves, sound, and a mass on a spring. In this section, we find the derivatives of all six trigonometric functions.

All angles are in radians. The formulas on this page are true only in radians. When you compute values, set your calculator to radian mode.

We will use two limits from the Squeeze Theorem:

$\displaystyle\lim_{h\to 0}\dfrac{\sin h}{h}=1$   and   $\displaystyle\lim_{h\to 0}\dfrac{1-\cos h}{h}=0$.

A first look at the graph

Look at the slopes of the graph of $y=\sin x$.

π/2π3π/22π1−1y = sin xxy
The graph of $y=\sin x$, with tangent lines at five points. From left to right, their slopes are $1$, $0$, $-1$, $0$, and $1$.

Now compare these slopes with the graph of $y=\cos x$.

π/2π3π/22π1−1y = cos xxy
The graph of $y=\cos x$. At the same $x$ values, its heights are $1$, $0$, $-1$, $0$, and $1$. These are the slopes of $\sin x$.

The slopes of $\sin x$ match the heights of $\cos x$. This suggests that the derivative of $\sin x$ is $\cos x$.

The derivative of sine

$\dfrac{d}{dx}(\sin x)=\cos x$

Why: Let $f(x)=\sin x$. Use the definition of the derivative:

$\begin{align*}&f'(x)\\&=\lim_{h\to 0}\dfrac{\sin(x+h)-\sin x}{h}\end{align*}$

Expand $\sin(x+h)$ with the angle sum formula from trigonometry:

$\sin(x+h)=\sin x\cos h+\cos x\sin h$

So

$\begin{align*}&f'(x)\\&=\lim_{h\to 0}\dfrac{\sin x\cos h+\cos x\sin h-\sin x}{h}\end{align*}$

Factor $\sin x$ out of the first and third terms:

$\begin{align*}&=\lim_{h\to 0}\dfrac{\sin x\,(\cos h-1)+\cos x\sin h}{h}\end{align*}$

Split the fraction into two:

$\begin{align*}&=\lim_{h\to 0}\Big[\sin x\,\dfrac{\cos h-1}{h}\\&\qquad+\cos x\,\dfrac{\sin h}{h}\Big]\end{align*}$

Now let $h\to 0$. The values $\sin x$ and $\cos x$ do not depend on $h$, so they stay the same. From the Squeeze Theorem:

So

$\begin{align*}&f'(x)=\sin x\cdot 0+\cos x\cdot 1=\cos x\end{align*}$

The derivative of cosine

$\dfrac{d}{dx}(\cos x)=-\sin x$

Notice the minus sign. Check it with the graph of $\cos x$. Just after $x=0$, $\cos x$ falls, so its slope is negative. And $-\sin x$ is negative there.

Optional Why the derivative of cosine is $-\sin x$

The steps are the same as for sine. Let $f(x)=\cos x$. Use the definition of the derivative:

$\begin{align*}&f'(x)\\&=\lim_{h\to 0}\dfrac{\cos(x+h)-\cos x}{h}\end{align*}$

Expand $\cos(x+h)$ with the angle sum formula:

$\cos(x+h)=\cos x\cos h-\sin x\sin h$

So

$\begin{align*}&f'(x)\\&=\lim_{h\to 0}\dfrac{\cos x\cos h-\sin x\sin h-\cos x}{h}\end{align*}$

Factor $\cos x$ out of the first and third terms:

$\begin{align*}&=\lim_{h\to 0}\dfrac{\cos x\,(\cos h-1)-\sin x\sin h}{h}\end{align*}$

Split the fraction into two:

$\begin{align*}&=\lim_{h\to 0}\Big[\cos x\,\dfrac{\cos h-1}{h}\\&\qquad-\sin x\,\dfrac{\sin h}{h}\Big]\end{align*}$

Now let $h\to 0$. As for sine:

  • ${\dfrac{\cos h-1}{h}\to 0}$ (it is the negative of $\dfrac{1-\cos h}{h}$)
  • ${\dfrac{\sin h}{h}\to 1}$

So

$\begin{align*}&f'(x)=\cos x\cdot 0-\sin x\cdot 1=-\sin x\end{align*}$

Example 1: Find each derivative.

(a) $y=4\sin x-3\cos x$

(b) $f(x)=x^2\cos x$

Solution:

(a) Differentiate one term at a time:

$\begin{align*}&y'\\&=4\cos x-3(-\sin x)\\&=4\cos x+3\sin x\end{align*}$

(b) This is a product, so use the product rule. The first factor is $x^2$, with derivative $2x$. The second factor is $\cos x$, with derivative $-\sin x$.

$\begin{align*}&f'(x)\\&=2x\cos x+x^2(-\sin x)\\&=2x\cos x-x^2\sin x\end{align*}$

Example 2: Find the equation of the tangent line to $y=\sin x$ at $x=\pi$.

Solution:

The point: $\sin\pi=0$, so the point is $(\pi,0)$.

The slope: $y'=\cos x$, so the slope is $\cos\pi=-1$.

The tangent line:

$\begin{align*}y-0&=-1(x-\pi)\\y&=-x+\pi\end{align*}$

This is the falling tangent line at $x=\pi$ in the graph of $\sin x$ above.

The other four trigonometric functions

The other four functions are made from sine and cosine:

$\tan x=\dfrac{\sin x}{\cos x}$,   $\cot x=\dfrac{\cos x}{\sin x}$,

$\sec x=\dfrac{1}{\cos x}$,   $\csc x=\dfrac{1}{\sin x}$.

So we can find their derivatives with the quotient rule. We will also use the Pythagorean identity

$\sin^2 x+\cos^2 x=1$.

Here $\sin^2 x$ means $(\sin x)^2$.

The derivative of tangent

$\begin{align*}&\dfrac{d}{dx}(\tan x)\\&=\dfrac{d}{dx}\left(\dfrac{\sin x}{\cos x}\right)\end{align*}$

Use the quotient rule. The numerator is $\sin x$, with derivative $\cos x$. The denominator is $\cos x$, with derivative $-\sin x$:

$\begin{align*}&=\dfrac{\cos x\cos x-\sin x(-\sin x)}{\cos^2 x}\\&=\dfrac{\cos^2 x+\sin^2 x}{\cos^2 x}\end{align*}$

Use the Pythagorean identity:

$\begin{align*}&=\dfrac{1}{\cos^2 x}\end{align*}$

Since $\dfrac{1}{\cos x}=\sec x$,

$\begin{align*}&\dfrac{d}{dx}(\tan x)=\sec^2 x\end{align*}$

The derivative of secant

$\begin{align*}&\dfrac{d}{dx}(\sec x)\\&=\dfrac{d}{dx}\left(\dfrac{1}{\cos x}\right)\end{align*}$

Use the quotient rule. The numerator is $1$, with derivative $0$. The denominator is $\cos x$, with derivative $-\sin x$:

$\begin{align*}&=\dfrac{0\cdot\cos x-1\cdot(-\sin x)}{\cos^2 x}\\&=\dfrac{\sin x}{\cos^2 x}\end{align*}$

Split it into a product of two fractions:

$\begin{align*}&=\dfrac{1}{\cos x}\cdot\dfrac{\sin x}{\cos x}\end{align*}$

Since $\dfrac{1}{\cos x}=\sec x$ and $\dfrac{\sin x}{\cos x}=\tan x$,

$\begin{align*}&\dfrac{d}{dx}(\sec x)=\sec x\tan x\end{align*}$

Example 3: Find the derivatives of $\cot x$ and $\csc x$.

Solution:

(a)

$\begin{align*}&\dfrac{d}{dx}(\cot x)\\&=\dfrac{d}{dx}\left(\dfrac{\cos x}{\sin x}\right)\end{align*}$

Use the quotient rule. The numerator is $\cos x$, with derivative $-\sin x$. The denominator is $\sin x$, with derivative $\cos x$:

$\begin{align*}&=\dfrac{-\sin x\sin x-\cos x\cos x}{\sin^2 x}\\&=\dfrac{-(\sin^2 x+\cos^2 x)}{\sin^2 x}\end{align*}$

Use the Pythagorean identity:

$\begin{align*}&=-\dfrac{1}{\sin^2 x}\end{align*}$

Since $\dfrac{1}{\sin x}=\csc x$,

$\begin{align*}&\dfrac{d}{dx}(\cot x)=-\csc^2 x\end{align*}$

(b)

$\begin{align*}&\dfrac{d}{dx}(\csc x)\\&=\dfrac{d}{dx}\left(\dfrac{1}{\sin x}\right)\end{align*}$

Use the quotient rule. The numerator is $1$, with derivative $0$. The denominator is $\sin x$, with derivative $\cos x$:

$\begin{align*}&=\dfrac{0\cdot\sin x-1\cdot\cos x}{\sin^2 x}\\&=-\dfrac{\cos x}{\sin^2 x}\end{align*}$

Split it into a product of two fractions:

$\begin{align*}&=-\dfrac{1}{\sin x}\cdot\dfrac{\cos x}{\sin x}\end{align*}$

Since $\dfrac{1}{\sin x}=\csc x$ and $\dfrac{\cos x}{\sin x}=\cot x$,

$\begin{align*}&\dfrac{d}{dx}(\csc x)=-\csc x\cot x\end{align*}$

A memory tip: The three functions that start with "co" are cosine, cotangent, and cosecant. Their derivatives all have a minus sign.

More examples

Example 4: Find $y'$ for

$y=\dfrac{\sin x}{1+\cos x}$.

Solution:

Use the quotient rule. The numerator is $\sin x$, with derivative $\cos x$. The denominator is $1+\cos x$, with derivative $-\sin x$:

$\begin{align*}&y'\\&=\dfrac{\cos x(1+\cos x)-\sin x(-\sin x)}{(1+\cos x)^2}\end{align*}$

Multiply out the numerator:

$\begin{align*}&=\dfrac{\cos x+\cos^2 x+\sin^2 x}{(1+\cos x)^2}\end{align*}$

Use the Pythagorean identity, ${\cos^2 x+\sin^2 x=1}$:

$\begin{align*}&=\dfrac{\cos x+1}{(1+\cos x)^2}\end{align*}$

Cancel the common factor $1+\cos x$:

$\begin{align*}&y'=\dfrac{1}{1+\cos x}\end{align*}$

Example 5: Find the points on the graph of $f(x)=x+2\sin x$ where the tangent line is horizontal. Use $0\le x\le 2\pi$.

Solution:

The derivative is $f'(x)=1+2\cos x$. A horizontal tangent line has slope $0$:

$\begin{align*}1+2\cos x&=0\\\cos x&=-\dfrac{1}{2}\end{align*}$

Between $0$ and $2\pi$, $\cos x=-\tfrac{1}{2}$ at two angles:

$x=\dfrac{2\pi}{3}$   and   $x=\dfrac{4\pi}{3}$.

Now find the $y$-values. Use these sine values:

$\sin\dfrac{2\pi}{3}=\dfrac{\sqrt{3}}{2}$   and   $\sin\dfrac{4\pi}{3}=-\dfrac{\sqrt{3}}{2}$

Then

$f\left(\dfrac{2\pi}{3}\right)=\dfrac{2\pi}{3}+\sqrt{3}\approx 3.83$

$f\left(\dfrac{4\pi}{3}\right)=\dfrac{4\pi}{3}-\sqrt{3}\approx 2.46$

So the tangent line is horizontal at $\left(\dfrac{2\pi}{3},\ \dfrac{2\pi}{3}+\sqrt{3}\right)$ and $\left(\dfrac{4\pi}{3},\ \dfrac{4\pi}{3}-\sqrt{3}\right)$.

Example 6: A mass on a spring moves up and down. Its position after $t$ seconds is $s(t)=4\cos t$ centimeters. Position $0$ is the middle, and up is positive.

(a) Find the velocity $v(t)$.

(b) Find the velocity at $t=\dfrac{\pi}{2}$ and at $t=\pi$. Describe the motion at these times.

Solution:

(a) Velocity is the derivative of position:

$v(t)=s'(t)=-4\sin t$ cm/s.

(b) At $t=\dfrac{\pi}{2}$:

$s=4\cos\dfrac{\pi}{2}=0$ cm

$v=-4\sin\dfrac{\pi}{2}=-4$ cm/s

The mass passes through the middle. It moves down (negative velocity) at $4$ cm/s. This is its fastest speed, because $-4\sin t$ is never less than $-4$ or more than $4$.

At $t=\pi$:

$s=4\cos\pi=-4$ cm

$v=-4\sin\pi=0$ cm/s

The mass is at its lowest point. It stops for an instant and then turns around.

Why radians?

The formulas on this page come from $\displaystyle\lim_{h\to 0}\dfrac{\sin h}{h}=1$. This limit is true only when $h$ is in radians. In degrees, the limit is $\dfrac{\pi}{180}\approx 0.01745$ (see the Squeeze Theorem).

So in degrees, every formula would have an extra factor of $\dfrac{\pi}{180}$. For example, if $x$ is in degrees, then the derivative of $\sin x$ is $\dfrac{\pi}{180}\cos x$. This is why calculus always uses radians.

Summary

Here $x$ is in radians:

FunctionDerivative
$\sin x$$\cos x$
$\cos x$$-\sin x$
$\tan x$$\sec^2 x$
$\cot x$$-\csc^2 x$
$\sec x$$\sec x\tan x$
$\csc x$$-\csc x\cot x$