TExcelTAD
Home › Calculus in Depth › Derivatives of Trigonometric Functions

Derivatives of Trigonometric Functions

The derivatives of sine and cosine rest on two special limits. This lesson proves those limits with a geometric squeeze, derives sin⁡′=cos⁡\sin' = \cos and cos⁡′=−sin⁡\cos' = -\sin from the addition formulas, and gets the other four trigonometric derivatives from the quotient rule.

For a gentler first look, see Derivatives of Trig Functions. Throughout, angles are in radians; the formulas below are false in degrees.

Two special limits

lim⁡h→0sin⁡hh=1lim⁡h→0cos⁡h−1h=0\lim_{h \to 0} \frac{\sin h}{h} = 1 \qquad\qquad \lim_{h \to 0} \frac{\cos h - 1}{h} = 0

Proof of the first (for h→0+h \to 0^+). Draw the unit circle and an angle hh with 0<h<π/20 < h < \pi/2. Compare three areas:

triangle inside the sector≤sector≤triangle tangent to the circle12⋅sin⁡h≤12⋅h≤12⋅tan⁡h\begin{array}{ccccc} \text{triangle inside the sector} & \le & \text{sector} & \le & \text{triangle tangent to the circle} \\ \tfrac{1}{2} \cdot \sin h & \le & \tfrac{1}{2} \cdot h & \le & \tfrac{1}{2} \cdot \tan h \end{array}

Multiply by 2/sin⁡h2/\sin h (positive) and take reciprocals, which flips the inequalities:

1≤hsin⁡h≤1cos⁡h  ⟹  cos⁡h≤sin⁡hh≤11 \le \frac{h}{\sin h} \le \frac{1}{\cos h} \qquad\implies\qquad \cos h \le \frac{\sin h}{h} \le 1

As h→0+h \to 0^+, cos⁡h→1\cos h \to 1, so the Squeeze Theorem from Calculating Limits Using the Limit Laws gives sin⁡h/h→1\sin h / h \to 1. The function sin⁡h/h\sin h / h is even, so the left-hand limit is the same. ∎

Proof of the second. Multiply by the conjugate:

cos⁡h−1h=cos⁡2h−1h(cos⁡h+1)=−sin⁡2hh(cos⁡h+1)=−sin⁡hh⋅sin⁡hcos⁡h+1→−1⋅02=0■\begin{aligned} \frac{\cos h - 1}{h} &= \frac{\cos^2 h - 1}{h(\cos h + 1)} = -\frac{\sin^2 h}{h(\cos h + 1)} \\ &= -\frac{\sin h}{h} \cdot \frac{\sin h}{\cos h + 1} \to -1 \cdot \frac{0}{2} = 0 && \blacksquare \end{aligned}

The numbers agree:

python · try it yourself
import math

print(f"{'h':>8} {'sin h / h':>14} {'(cos h − 1)/h':>16}")
for h in [0.5, 0.1, 0.01, 0.001]:
    print(f"{h:>8} {math.sin(h)/h:>14.10f} {(math.cos(h) - 1)/h:>16.10f}")
deg = math.pi / 180
print("in degrees, sin(1°)/1 ≈", round(math.sin(deg), 6), " vs π/180 ≈", round(deg, 6))
       h      sin h / h    (cos h − 1)/h
     0.5   0.9588510772    -0.2448348762
     0.1   0.9983341665    -0.0499583472
    0.01   0.9999833334    -0.0049999583
   0.001   0.9999998333    -0.0005000000
in degrees, sin(1°)/1 ≈ 0.017452  vs π/180 ≈ 0.017453

The last line is why radians matter: measured in degrees, the slope of sine at 0 would be π/180≈0.01745\pi/180 \approx 0.01745 instead of 1.

The derivative of sine and cosine

Using sin⁡(x+h)=sin⁡xcos⁡h+cos⁡xsin⁡h\sin(x + h) = \sin x \cos h + \cos x \sin h:

sin⁡(x+h)−sin⁡xh=sin⁡x⋅cos⁡h−1h+cos⁡x⋅sin⁡hh→sin⁡x⋅0+cos⁡x⋅1=cos⁡x\begin{aligned} \frac{\sin(x+h) - \sin x}{h} &= \sin x \cdot \frac{\cos h - 1}{h} + \cos x \cdot \frac{\sin h}{h} \\ &\to \sin x \cdot 0 + \cos x \cdot 1 = \cos x \end{aligned}

So ddxsin⁡x=cos⁡x\frac{d}{dx} \sin x = \cos x. The same steps with cos⁡(x+h)=cos⁡xcos⁡h−sin⁡xsin⁡h\cos(x + h) = \cos x \cos h - \sin x \sin h give

cos⁡(x+h)−cos⁡xh=cos⁡x⋅cos⁡h−1h−sin⁡x⋅sin⁡hh→−sin⁡x\frac{\cos(x+h) - \cos x}{h} = \cos x \cdot \frac{\cos h - 1}{h} - \sin x \cdot \frac{\sin h}{h} \to -\sin x

so ddxcos⁡x=−sin⁡x\frac{d}{dx} \cos x = -\sin x. Differentiating four times brings you back to the start: sin⁡→cos⁡→−sin⁡→−cos⁡→sin⁡\sin \to \cos \to -\sin \to -\cos \to \sin. Hence the 4-cycle d4dx4sin⁡x=sin⁡x\frac{d^4}{dx^4} \sin x = \sin x.

The other four

Each follows from the quotient rule in The Product and Quotient Rules and sin⁡2x+cos⁡2x=1\sin^2 x + \cos^2 x = 1. For tangent:

ddxtan⁡x=ddx(sin⁡xcos⁡x)=cos⁡x⋅cos⁡x−sin⁡x⋅(−sin⁡x)cos⁡2x=1cos⁡2x=sec⁡2x\frac{d}{dx} \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{1}{\cos^2 x} = \sec^2 x
Function Derivative Function Derivative
sin⁡x\sin x cos⁡x\cos x csc⁡x\csc x −csc⁡x⋅cot⁡x-\csc x \cdot \cot x
cos⁡x\cos x −sin⁡x-\sin x sec⁡x\sec x sec⁡x⋅tan⁡x\sec x \cdot \tan x
tan⁡x\tan x sec⁡2x\sec^2 x cot⁡x\cot x −csc⁡2x-\csc^2 x

Tip: The "co" functions (cos⁡\cos, cot⁡\cot, csc⁡\csc) all get a minus sign. If you remember the left column, the right column is the left column with "co" swapped in and a minus sign added.

Checking in SymPy

python · try it yourself
import sympy as sp

x = sp.symbols('x')
for f in [sp.sin(x), sp.cos(x), sp.tan(x), sp.sec(x), sp.csc(x), sp.cot(x)]:
    print(f"d/dx {str(f):7} = {sp.diff(f, x)}")
print("4th derivative of sin:", sp.diff(sp.sin(x), x, 4))
print("d/dx x² sin x =", sp.diff(x**2 * sp.sin(x), x))
d/dx sin(x)  = cos(x)
d/dx cos(x)  = -sin(x)
d/dx tan(x)  = tan(x)**2 + 1
d/dx sec(x)  = tan(x)*sec(x)
d/dx csc(x)  = -cot(x)*csc(x)
d/dx cot(x)  = -cot(x)**2 - 1
4th derivative of sin: sin(x)
d/dx x² sin x = x**2*cos(x) + 2*x*sin(x)

SymPy writes sec⁡2x\sec^2 x as tan⁡2x+1\tan^2 x + 1 and −csc⁡2x-\csc^2 x as −cot⁡2x−1-\cot^2 x - 1; these are the Pythagorean identities, so the answers match the table.

A limit you can now evaluate

Many limits reduce to the special ones by rewriting. For example

lim⁡x→0sin⁡(5x)3x=53⋅lim⁡x→0sin⁡(5x)5x=53⋅1=53\lim_{x \to 0} \frac{\sin(5x)}{3x} = \frac{5}{3} \cdot \lim_{x \to 0} \frac{\sin(5x)}{5x} = \frac{5}{3} \cdot 1 = \frac{5}{3}

with the substitution h=5xh = 5x, which tends to 0 when xx does.

Simple harmonic motion

A mass on a spring with position s(t)=2cos⁡t+3sin⁡ts(t) = 2\cos t + 3\sin t has velocity v=−2sin⁡t+3cos⁡tv = -2\sin t + 3\cos t and acceleration a=−2cos⁡t−3sin⁡t=−s(t)a = -2\cos t - 3\sin t = -s(t). The acceleration always points back towards the rest position and is proportional to the distance from it: that is the defining equation s′′=−ss'' = -s of simple harmonic motion, met again in Second-Order Linear Equations.

In software

  • Animation and audio: oscillators, bobbing sprites and camera shake use A⋅sin⁡(ωt)A \cdot \sin(\omega t). Its velocity is Aω⋅cos⁡(ωt)A\omega \cdot \cos(\omega t), so doubling the frequency doubles the peak speed.
  • Rotation: the derivative of the rotation (cos⁡θ,sin⁡θ)(\cos\theta, \sin\theta) is (−sin⁡θ,cos⁡θ)(-\sin\theta, \cos\theta), the same vector turned 90°. That is the tangent direction a game uses for circular motion (Game Math).
  • Positional encodings: transformer models encode token positions with sines and cosines of several frequencies; their derivatives stay bounded, which keeps training stable (Generative AI & LLMs).
  • np.sinc: implements sin⁡(πx)/(πx)\sin(\pi x)/(\pi x) with the special limit value 1 at x=0x = 0, avoiding 0/00/0.

Exercises

Exercise 1: A product with trig

Differentiate y=x3cos⁡xy = x^3 \cos x.

Answer

y′=3x2cos⁡x−x3sin⁡xy' = 3x^2 \cos x - x^3 \sin x

Solution
product rule: (x3)′cos⁡x+x3(cos⁡x)′=3x2cos⁡x−x3sin⁡x\text{product rule: } (x^3)' \cos x + x^3 (\cos x)' = 3x^2 \cos x - x^3 \sin x

Exercise 2: Derive the secant rule

Use the quotient rule on sec⁡x=1/cos⁡x\sec x = 1/\cos x to show ddxsec⁡x=sec⁡xtan⁡x\frac{d}{dx} \sec x = \sec x \tan x.

Answer

(1/cos⁡x)′=sin⁡x/cos⁡2x=sec⁡x⋅tan⁡x(1/\cos x)' = \sin x / \cos^2 x = \sec x \cdot \tan x

Solution
reciprocal rule: (1/g)′=−g′/g2 with g=cos⁡x, g′=−sin⁡x(1/cos⁡x)′=sin⁡xcos⁡2x=1cos⁡x⋅sin⁡xcos⁡x=sec⁡x⋅tan⁡x\begin{aligned} &\text{reciprocal rule: } (1/g)' = -g'/g^2 \text{ with } g = \cos x,\ g' = -\sin x \\ &(1/\cos x)' = \frac{\sin x}{\cos^2 x} = \frac{1}{\cos x} \cdot \frac{\sin x}{\cos x} = \sec x \cdot \tan x \end{aligned}

Exercise 3: Special limit

Find lim⁡tan⁡(4x)/x\lim \tan(4x)/x as x→0x \to 0.

Answer

4

Solution
tan⁡(4x)x=4⋅sin⁡(4x)4x⋅1cos⁡(4x)→4⋅1⋅1=4\frac{\tan(4x)}{x} = 4 \cdot \frac{\sin(4x)}{4x} \cdot \frac{1}{\cos(4x)} \to 4 \cdot 1 \cdot 1 = 4

Exercise 4: Horizontal tangents

Find every xx in [0,2π][0, 2\pi] where f(x)=x+2sin⁡xf(x) = x + 2\sin x has a horizontal tangent, and check numerically.

Answer

x=2π/3≈2.0944x = 2\pi/3 \approx 2.0944 and x=4π/3≈4.1888x = 4\pi/3 \approx 4.1888

Solution
f′(x)=1+2cos⁡x=0  ⟺  cos⁡x=−12  ⟺  x=2π3 or 4π3 in [0,2π]f'(x) = 1 + 2\cos x = 0 \iff \cos x = -\tfrac{1}{2} \iff x = \tfrac{2\pi}{3} \text{ or } \tfrac{4\pi}{3} \text{ in } [0, 2\pi]
python · try it yourself
import sympy as sp

x = sp.symbols('x')
sols = sp.solveset(1 + 2*sp.cos(x), x, sp.Interval(0, 2*sp.pi))
print(sols, [round(float(s), 4) for s in sols])
{2*pi/3, 4*pi/3} [2.0944, 4.1888]

Exercise 5: The 100th derivative

What is d100dx100cos⁡x\frac{d^{100}}{dx^{100}} \cos x? And d103dx103sin⁡x\frac{d^{103}}{dx^{103}} \sin x?

Answer

cos⁡x\cos x and −cos⁡x-\cos x

Solution

The derivatives repeat with period 4. 100=4⋅25100 = 4 \cdot 25, so the 100th derivative of cos⁡x\cos x is cos⁡x\cos x. 103=4⋅25+3103 = 4 \cdot 25 + 3, and the third derivative of sin⁡x\sin x is −cos⁡x-\cos x.

Test yourself

What is ddxcot⁡x\frac{d}{dx} \cot x?

  1. sec⁡2x\sec^2 x
  2. −csc⁡2x-\csc^2 x
  3. csc⁡x⋅cot⁡x\csc x \cdot \cot x
  4. −sec⁡2x-\sec^2 x

Which inequality, squeezed as h→0+h \to 0^+, proves sin⁡h/h→1\sin h / h \to 1?

  1. sin⁡h≤h≤1\sin h \le h \le 1
  2. 0≤sin⁡h/h≤h0 \le \sin h / h \le h
  3. cos⁡h≤sin⁡h/h≤1\cos h \le \sin h / h \le 1
  4. 1≤sin⁡h/h≤tan⁡h1 \le \sin h / h \le \tan h

Why must angles be in radians for (sin⁡x)′=cos⁡x(\sin x)' = \cos x?

  1. Degrees cannot be negative
  2. Because sin⁡h/h→1\sin h / h \to 1 only when hh is in radians
  3. Calculators require it
  4. Cosine is undefined in degrees