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 and 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
Proof of the first (for ). Draw the unit circle and an angle with . Compare three areas:
Multiply by (positive) and take reciprocals, which flips the inequalities:
As , , so the Squeeze Theorem from Calculating Limits Using the Limit Laws gives . The function is even, so the left-hand limit is the same. ∎
Proof of the second. Multiply by the conjugate:
The numbers agree:
python · try it yourselfimport 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 instead of 1.
The derivative of sine and cosine
Using :
So . The same steps with give
so . Differentiating four times brings you back to the start: . Hence the 4-cycle .
The other four
Each follows from the quotient rule in The Product and Quotient Rules and . For tangent:
| Function |
Derivative |
Function |
Derivative |
|
|
|
|
|
|
|
|
|
|
|
|
Tip: The "co" functions (, , ) 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 yourselfimport 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 as and as ; 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
with the substitution , which tends to 0 when does.
Simple harmonic motion
A mass on a spring with position has velocity and acceleration . The acceleration always points back towards the rest position and is proportional to the distance from it: that is the defining equation of simple harmonic motion, met again in Second-Order Linear Equations.
In software
- Animation and audio: oscillators, bobbing sprites and camera shake use . Its velocity is , so doubling the frequency doubles the peak speed.
- Rotation: the derivative of the rotation is , 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 with the special limit value 1 at , avoiding .
Exercises
Exercise 1: A product with trig
Differentiate .
Answer
Solution
Exercise 2: Derive the secant rule
Use the quotient rule on to show .
Answer
Solution
Exercise 3: Special limit
Find as .
Answer
4
Solution
Exercise 4: Horizontal tangents
Find every in where has a horizontal tangent, and check numerically.
Answer
and
Solution
python · try it yourselfimport 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 ? And ?
Answer
and
Solution
The derivatives repeat with period 4. , so the 100th derivative of is . , and the third derivative of is .
Test yourself
What is ?
Which inequality, squeezed as , proves ?
Why must angles be in radians for ?
- Degrees cannot be negative
- Because only when is in radians
- Calculators require it
- Cosine is undefined in degrees