Derivatives of Trig Functions

The derivatives of trig functions are: the derivative of sin x is cos x, of cos x is −sin x, and of tan x is sec²x. The other three are \frac{d}{dx}\sec x = \sec x\tan x, \frac{d}{dx}\csc x = -\csc x\cot x and \frac{d}{dx}\cot x = -\csc^2 x. These formulas work only when x is in radians.

Before this lesson: Chain Rule, Quotient Rule, Unit Circle and Squeeze Theorem

Why the derivative of sine is cosine

Look at the graph of y = sin x. At x = 0 it climbs with slope 1. At x = \frac{\pi}{2} it is at its peak, so its slope is 0. At x = π it falls with slope −1. Those slopes, 1, 0 and −1, are exactly the values of cos x at the same points.

Graph of y = sin x (solid blue) and y = cos x (dashed orange) for x from 0 to 2π. Points on the sine curve at x = 0, π/2, π, 3π/2 and 2π are labeled with their slopes 1, 0, −1, 0 and 1, which match the heights of the cosine curve at those x-values.
At every x, the slope of sin x equals the height of cos x.

The proof uses the limit \lim_{h \to 0} \frac{\sin h}{h} = 1, which comes from the squeeze theorem. That limit is true only when angles are measured in radians, so calculus with trig functions always uses radians.

Trig derivative formulas

FunctionDerivativeFunctionDerivative
\sin x\cos x\csc x-\csc x \cot x
\cos x-\sin x\sec x\sec x \tan x
\tan x\sec^2 x\cot x-\csc^2 x

A memory trick: the three “co” functions (cosine, cosecant, cotangent) have derivatives with a minus sign. Each one is the matching formula with every function swapped for its co-function and a minus sign added.

With the chain rule, an inside function u adds a factor of u′:

\frac{d}{dx}\left[\sin u\right] = \cos u \cdot u', \qquad \frac{d}{dx}\left[\cos u\right] = -\sin u \cdot u', \qquad \frac{d}{dx}\left[\tan u\right] = \sec^2 u \cdot u'

Derivatives of trig functions examples

Example 1: A sum of trig functions

Differentiate y = 3\sin x - 2\cos x.

y' = 3\cos x - 2(-\sin x)

Differentiate each term: sin x gives cos x and cos x gives −sin x.

y' = 3\cos x + 2\sin x

Simplify the signs.

Answer: y' = 3\cos x + 2\sin x.

Example 2: Product rule with sine

Differentiate y = x^2\sin x.

y' = (2x)(\sin x) + (x^2)(\cos x)

Product rule: the derivative of x² is 2x and of sin x is cos x (see product rule).

y' = 2x\sin x + x^2\cos x

Remove the parentheses.

Answer: y' = 2x\sin x + x^2\cos x.

Example 3: Chain rule with sine

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

u = 3x^2, \; u' = 6x

The inside function is 3x².

y' = \cos(3x^2) \cdot 6x

The derivative of sin u is cos u · u′. Keep the inside the same.

y' = 6x\cos(3x^2)

Write the factor in front.

Answer: y' = 6x\cos(3x^2). A common slip is writing \cos(6x). The inside stays 3x².

Example 4: Tangent line to y = tan x

Find the tangent line to y = \tan x at x = \frac{\pi}{4}.

y = \tan\frac{\pi}{4} = 1

Find the point (see trig values of special angles).

y' = \sec^2 x

Differentiate tan x.

\sec\frac{\pi}{4} = \frac{1}{\cos\frac{\pi}{4}} = \sqrt{2}

Secant is 1 over cosine, and \cos\frac{\pi}{4} = \frac{\sqrt{2}}{2}.

y'\left(\frac{\pi}{4}\right) = (\sqrt{2})^2 = 2

Square it. The slope is 2.

y - 1 = 2\left(x - \frac{\pi}{4}\right)

Use point-slope form (see point-slope form).

y = 2x - \frac{\pi}{2} + 1

Distribute and add 1 to both sides.

Answer: y = 2x - \frac{\pi}{2} + 1, or about y = 2x − 0.571.

Example 5: Word problem with a spring

A weight on a spring moves up and down. Its position is s(t) = 4\sin(2t) cm after t seconds. Find its velocity and acceleration at t = \frac{\pi}{6}.

v(t) = 4\cos(2t) \cdot 2 = 8\cos(2t)

Velocity is s′(t). Chain rule: the inside 2t has derivative 2.

a(t) = 8(-\sin(2t)) \cdot 2 = -16\sin(2t)

Acceleration is v′(t). Chain rule again.

v\left(\frac{\pi}{6}\right) = 8\cos\frac{\pi}{3} = 8 \cdot \frac{1}{2} = 4

Substitute t = π/6, so 2t = π/3.

a\left(\frac{\pi}{6}\right) = -16\sin\frac{\pi}{3} = -16 \cdot \frac{\sqrt{3}}{2}

Substitute t = π/6.

a\left(\frac{\pi}{6}\right) = -8\sqrt{3} \approx -13.86

Multiply, then estimate with √3 ≈ 1.732.

Answer: at t = \frac{\pi}{6} s, the weight moves up at 4 cm/s, and its acceleration is about −13.86 cm/s². See position, velocity and acceleration for what these signs mean.

Common mistakes

MistakeExample of the errorFix
Wrong sign on the derivative of cosine\frac{d}{dx}\cos x = \sin xIt is -\sin x. Cosine starts by falling.
Forgetting the inside derivative\frac{d}{dx}\sin(3x^2) = \cos(3x^2)Multiply by u′ = 6x.
Changing the inside\frac{d}{dx}\sin(3x^2) = \cos(6x)Keep the inside: 6x\cos(3x^2).
Using degreesSlope of sin x at 90 as cos 90° = 0Use radians. The formulas are false in degrees.
Confusing sec²x and sec(x²)Writing \sec(x^2) for the derivative of tan x\sec^2 x means (\sec x)^2.

Related methods

Getting the other four from sine and cosine

Once you know the derivatives of sin x and cos x, the quotient rule gives the rest. For tan x:

\frac{d}{dx}\left[\frac{\sin x}{\cos x}\right] = \frac{\cos x \cdot \cos x - \sin x \cdot (-\sin x)}{\cos^2 x} = \frac{\cos^2 x + \sin^2 x}{\cos^2 x} = \frac{1}{\cos^2 x} = \sec^2 x

The step \cos^2 x + \sin^2 x = 1 is the Pythagorean identity (see fundamental trig identities). The same method works for sec x, csc x and cot x.

The cycle of derivatives

Differentiating sin x over and over gives a cycle of four: sin x, cos x, −sin x, −cos x, then back to sin x. So the 4th derivative of sin x is sin x, and the 10th derivative is the same as the 2nd, −sin x (see higher-order derivatives).

Practice problems

  1. Differentiate y = 5\cos x + x^3.
  2. Differentiate y = \sin x\cos x.
  3. Differentiate y = x\tan x.
  4. Differentiate y = \sin(4x).
  5. Differentiate y = \cos(x^2 + 1).
  6. Differentiate y = \sin^2 x.
  7. Differentiate y = \sec(3x).
  8. Differentiate y = \frac{\sin x}{x}.
  9. Find every x in [0, 2\pi] where f(x) = 2\sin x + x has a horizontal tangent.
  10. Find the tangent line to y = \cos x at x = \frac{\pi}{3}.
Show answers

1.

y' = -5\sin x + 3x^2

The derivative of cos x is −sin x; power rule on x³.

Answer: y' = -5\sin x + 3x^2

2.

y' = \cos x \cdot \cos x + \sin x \cdot (-\sin x)

Product rule.

y' = \cos^2 x - \sin^2 x

Simplify. This also equals cos 2x (see double-angle formulas).

Answer: y' = \cos^2 x - \sin^2 x

3.

y' = 1 \cdot \tan x + x\sec^2 x

Product rule: the derivative of tan x is sec²x.

Answer: y' = \tan x + x\sec^2 x

4.

y' = \cos(4x) \cdot 4

Chain rule: the inside 4x has derivative 4.

Answer: y' = 4\cos(4x)

5.

y' = -\sin(x^2 + 1) \cdot 2x

Chain rule: the inside has derivative 2x.

Answer: y' = -2x\sin(x^2 + 1)

6.

y = (\sin x)^2

Read sin²x as (sin x)².

y' = 2\sin x \cdot \cos x

General power rule: the inside sin x has derivative cos x.

Answer: y' = 2\sin x\cos x, which also equals sin 2x

7.

y' = \sec(3x)\tan(3x) \cdot 3

The derivative of sec u is sec u tan u · u′, with u′ = 3.

Answer: y' = 3\sec(3x)\tan(3x)

8.

y' = \frac{\cos x \cdot x - \sin x \cdot 1}{x^2}

Quotient rule.

Answer: y' = \frac{x\cos x - \sin x}{x^2}

9.

f'(x) = 2\cos x + 1

Differentiate.

2\cos x + 1 = 0

A horizontal tangent needs f′(x) = 0.

\cos x = -\frac{1}{2}

Subtract 1, then divide by 2.

x = \frac{2\pi}{3} \text{ or } x = \frac{4\pi}{3}

Use the unit circle: cosine is −½ in Quadrants II and III (see solving trig equations).

Answer: x = \frac{2\pi}{3} and x = \frac{4\pi}{3}

10.

y = \cos\frac{\pi}{3} = \frac{1}{2}

Find the point.

y' = -\sin x

Differentiate cos x.

y'\left(\frac{\pi}{3}\right) = -\frac{\sqrt{3}}{2}

Substitute: \sin\frac{\pi}{3} = \frac{\sqrt{3}}{2}.

y - \frac{1}{2} = -\frac{\sqrt{3}}{2}\left(x - \frac{\pi}{3}\right)

Point-slope form.

Answer: y = -\frac{\sqrt{3}}{2}\left(x - \frac{\pi}{3}\right) + \frac{1}{2}, or about y = −0.866x + 1.407

Derivatives of trig functions FAQ

What is the derivative of sin x?

The derivative of sin x is cos x, when x is in radians. With an inside function, \frac{d}{dx}\sin u = \cos u \cdot u'.

Why is the derivative of cos x negative?

Right after x = 0, the cosine graph falls from its peak of 1, so its slope is negative. The formula -\sin x matches: it is negative for x between 0 and π.

Why do trig derivatives need radians?

The key limit \frac{\sin h}{h} \to 1 is true only in radians. In degrees the derivative of sin x would be \frac{\pi}{180}\cos x, which is messy.

How do you remember the six trig derivatives?

Learn sin → cos, tan → sec² and sec → sec tan. For the co-functions, swap each function for its co-function and add a minus sign.

Summary

  • (\sin x)' = \cos x and (\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 co-functions have derivatives with a minus sign.
  • Use the chain rule for inside functions: (\sin u)' = \cos u \cdot u'.
  • Always work in radians.

Previous lesson: Derivatives of Inverse Functions

Next lesson: Derivatives of Exponential Functions

Back to the Calculus 1 Index