Derivatives of the trigonometric functions
Sine and cosine describe everything that goes around or back and forth. How fast are they changing at each moment, and what does that give for tangent, secant, cosecant and cotangent?
Where you are 3 in Derivatives of trig, exponential and log functions
Why this exists
A point on a turning flywheel, the height of a tide, the swing of a weight on a spring: each repeats, and each is modeled by sine and cosine. Asking how fast such a thing is moving at one instant is asking for the derivative of \sin x or \cos x. The power rule and the exponential rules say nothing about these functions, and computing a limit of difference quotients at every new point is no way to work.
This lesson finds both derivatives once, from the definition of the derivative. The other four trigonometric functions are quotients of sine and cosine, so the quotient rule then gives theirs with no new limits at all. The lesson runs over two days: sine and cosine first, then the other four and their uses.
Definition
With x measured in radians, the derivatives of the six trigonometric functions are
Each holds at every x where the function itself is defined. Every function starting with “co” has a minus sign in its derivative, and each pair of lines matches a function with its “co” partner: swap sine for cosine, tangent for cotangent, secant for cosecant, and put a minus sign in front.
Intuition
Day 1: reading slopes off the graph. In Figure 1, the sine curve climbs most steeply where it crosses the axis going up, at x = 0 and x = 2\pi, with slope 1; it is level at its peak \displaystyle x = \frac{\pi}{2} and its trough \displaystyle x = \frac{3\pi}{2}; and it falls with slope -1 at x = \pi. Those five slopes, 1, 0, -1, 0, 1, are exactly the heights of the cosine curve at the same inputs. Read the cosine curve the same way: it is level at 0 and \pi, falls with slope -1 at \displaystyle \frac{\pi}{2} and rises with slope 1 at \displaystyle \frac{3\pi}{2}, which are the heights of -\sin x.
A point going around the circle. Let a point travel around the unit circle at one radian per second, so at time t it is at (\cos t, \sin t). Because an angle in radians is the arc length it cuts on the unit circle (Radian measure), the point covers one unit of arc per second: its speed is 1. Its velocity points along the circle, perpendicular to the radius, so it is the radius turned a quarter turn counterclockwise, (-\sin t, \cos t). The second coordinate says the height \sin t changes at rate \cos t; the first says \cos t changes at rate -\sin t.
Why radians. The speed is 1 only because radians measure arc length. Measure the angle in degrees and the point covers \displaystyle \frac{\pi}{180} of a unit per degree, and that factor rides into every derivative (Example 3).
Results
Day 1: sine and cosine
For every real number x, in radians,
Degrees. With \theta in degrees,
Day 2: the other four
For every integer k,
- \dfrac{d}{dx}\big[\tan x\big] = \sec^2 x and \dfrac{d}{dx}\big[\sec x\big] = \sec x \tan x, for \displaystyle x \ne \frac{\pi}{2} + k\pi;
- \dfrac{d}{dx}\big[\cot x\big] = -\csc^2 x and \dfrac{d}{dx}\big[\csc x\big] = -\csc x \cot x, for x \ne k\pi.
Since \sec^2 x \ge 1, the tangent function has slope at least 1 everywhere it is defined, with slope exactly 1 at x = k\pi.
Why it is true
Two facts from The squeeze theorem and the limit of sine x over x carry the proof. With h in radians,
The other tools are the sum formulas \sin(x + h) = \sin x \cos h + \cos x \sin h (Sine and tangent of a sum or difference) and \cos(x + h) = \cos x \cos h - \sin x \sin h (Cosine of a sum or difference).
Sine. Fix x. Expand \sin(x + h) and regroup the terms holding \sin x:
Only h moves, so \cos x and \sin x are constants, and the sum and constant multiple laws for limits give \cos x \cdot 1 - \sin x \cdot 0 = \cos x.
Cosine. The same steps with the cosine sum formula:
which tends to -\cos x \cdot 0 - \sin x \cdot 1 = -\sin x.
Tangent. Where \cos x \ne 0, \displaystyle \tan x = \frac{\sin x}{\cos x} is a quotient of differentiable functions, so the quotient rule applies. The Pythagorean identity \sin^2 x + \cos^2 x = 1 (The Pythagorean identities) finishes it:
Secant. Where \cos x \ne 0, the reciprocal rule \displaystyle \left(\frac{1}{g}\right)' = -\frac{g'}{g^2} with g = \cos x gives
Cotangent and cosecant follow the same way from \displaystyle \cot x = \frac{\cos x}{\sin x} and \displaystyle \csc x = \frac{1}{\sin x}, where \sin x \ne 0; Exercises 22 and 23 carry them out.
Worked examples
Day 1: a tangent line to a sum
Find the tangent line to y = 2\sin x + \cos x at \displaystyle x = \frac{\pi}{2}.
SolutionThe sum and constant multiple rules apply to trigonometric terms as to any others, so
At \displaystyle x = \frac{\pi}{2}: y = 2 \cdot 1 + 0 = 2, and the slope is 2 \cdot 0 - 1 = -1. As in tangent lines, the line is
Day 1: where the graph rises and falls
Let f(x) = x + 2\cos x on 0 \le x \le 2\pi. Find where the tangent is horizontal and where f is rising.
SolutionThe derivative is f'(x) = 1 - 2\sin x. It is 0 where \displaystyle \sin x = \frac{1}{2}, which on this interval happens at \displaystyle x = \frac{\pi}{6} and \displaystyle x = \frac{5\pi}{6}.
The graph rises where f'(x) > 0, that is, where \displaystyle \sin x < \frac{1}{2}: for \displaystyle 0 \le x < \frac{\pi}{6} and for \displaystyle \frac{5\pi}{6} < x \le 2\pi. Between the two level points, \displaystyle \sin x > \frac{1}{2} and f falls. So the graph climbs to \displaystyle f\left(\frac{\pi}{6}\right) = \frac{\pi}{6} + \sqrt{3} \approx 2.256, drops to \displaystyle f\left(\frac{5\pi}{6}\right) = \frac{5\pi}{6} - \sqrt{3} \approx 0.886, then climbs for good. The 2\cos x term makes the line y = x wobble, and where the wobble falls faster than the line rises, the sum falls.
Day 1: Millaray’s calculator in degree mode
Millaray’s calculator is set to degrees, and she graphs S(\theta) = \sin(\theta^\circ), with \theta in degrees. Find S'(\theta) from the definition, and find S'(60).
SolutionAn angle of \theta degrees is \displaystyle u = \frac{\pi\theta}{180} radians, and a change of h degrees is a change of \displaystyle k = \frac{\pi h}{180} radians. The sine sum formula, regrouped as in the proof above, gives
The two limits need the input of sine and the denominator to be the same quantity, and here they are not: the top has k, the bottom h. Since \displaystyle h = \frac{180k}{\pi},
As h \to 0 with h \ne 0, also k \to 0 with k \ne 0, so these tend to \displaystyle \frac{\pi}{180} and 0. Therefore
At \theta = 60: \displaystyle S'(60) = \frac{\pi}{180} \cdot \frac{1}{2} = \frac{\pi}{360} \approx 0.00873 per degree. The check: per radian the rate is \displaystyle \cos\frac{\pi}{3} = \frac{1}{2}, and a radian is about 57.3 degrees, so per degree it is about \displaystyle \frac{0.5}{57.3} \approx 0.00873. In degrees the clean rule (\sin x)' = \cos x picks up the factor \displaystyle \frac{\pi}{180}; this is why calculus measures angles in radians.
Day 2: products and quotients
Differentiate (a) y = x^3 \sin x, (b) y = \dfrac{\sin x}{1 + \cos x}, (c) y = 4\cot x + x\csc x.
Solution(a) By the product rule, y' = 3x^2 \sin x + x^3 \cos x.
(b) The bottom is 0 where \cos x = -1, at x = \pi + 2k\pi for integers k; elsewhere the quotient rule gives
using \cos^2 x + \sin^2 x = 1 in the top and then cancelling one factor 1 + \cos x, which is not 0. The derivative is positive, so the function rises on each interval of its domain.
(c) Term by term, with the product rule on x\csc x: for x \ne k\pi,
Day 2: the tangent line to tangent
Find the tangent line to y = \tan x at \displaystyle x = \frac{\pi}{4}, and find the smallest slope of the graph.
SolutionAt \displaystyle x = \frac{\pi}{4}, y = 1 and the slope is \displaystyle \sec^2 \frac{\pi}{4} = \left(\sqrt{2}\right)^2 = 2. The line is
Since \displaystyle \sec^2 x = \frac{1}{\cos^2 x} and 0 < \cos^2 x \le 1 wherever tangent is defined, \sec^2 x \ge 1. The smallest slope is 1, reached where \cos^2 x = 1, at x = k\pi for integers k, such as the origin in Figure 2. Every branch of the graph crosses the axis at that slope and steepens toward its asymptotes.
Day 2: Rayen’s flywheel
Rayen’s flywheel turns at one radian per second, and a pin on it drives a slider back and forth along a straight track. The slider’s position, in centimeters from the middle of the track, is s(t) = 5\sin t + 12\cos t after t seconds. Find its velocity at t = 0, the first time it stops, and how far out it is then. Then find its speed as it passes the middle.
SolutionThe velocity is the derivative of position:
At t = 0 the slider is at s(0) = 12 and moving outward at v(0) = 5 centimeters per second.
It stops when v(t) = 0, that is, 5\cos t = 12\sin t, or \displaystyle \tan t = \frac{5}{12} (dividing by \cos t is safe, since \cos t = 0 would force \sin t = 0 too, which never happens). The first such time is \displaystyle t = \arctan\frac{5}{12} \approx 0.395 seconds. There \displaystyle \sin t = \frac{5}{13} and \displaystyle \cos t = \frac{12}{13}, from a right triangle with legs 5 and 12, so
The slider turns around 13 centimeters out.
For the speed at the middle, square and add position and velocity. The cross terms \pm 120\sin t\cos t cancel and \sin^2 t + \cos^2 t = 1 leaves
Where s = 0 the speed is |v| = 13 centimeters per second, its largest value, and where the speed is 0 the slider is 13 centimeters out. Motion like this, position a combination of \sin t and \cos t, is Simple harmonic motion.
Day 2: horizontal tangents of a growing wave
Find every x where y = e^x \cos x has a horizontal tangent.
SolutionThe product rule with \displaystyle \frac{d}{dx}\big[e^x\big] = e^x gives
Since e^x > 0, y' = 0 exactly when \cos x = \sin x. At such a point \cos x \ne 0 (otherwise \sin x would be 0 as well), so we may divide: \tan x = 1, and \displaystyle x = \frac{\pi}{4} + k\pi for every integer k. The tangent is horizontal at infinitely many points, one in every interval of length \pi, while the size of the waves grows with e^x.
Boundaries
- Radians only. The rules (\sin x)' = \cos x and (\cos x)' = -\sin x rest on \displaystyle \frac{\sin h}{h} \to 1, which holds only with h in radians. In degrees every derivative carries an extra factor \displaystyle \frac{\pi}{180}.
- Each rule holds only where its function is defined. Tangent and secant, and their derivatives, are undefined where \cos x = 0; cotangent and cosecant where \sin x = 0. At those points there is no derivative at all.
- The input must be x itself. These rules give the derivative of \sin x, not of \sin 3x or \sin x^2. The derivative of \sin 3x is not \cos 3x; it waits for the chain rule, unless it is worked from the definition as in Example 3.
Where this goes next
Differentiating twice brings \sin x back to -\sin x, and four times brings it back to itself; second and higher derivatives follow that cycle. With the chain rule, \sin 3x and \cos(x^2) become as easy as \sin x, and Simple harmonic motion at any frequency comes within reach. Every derivative here is also an antiderivative read backward, and the identities in Trigonometric identities often turn a derivative into a simpler form, as in Example 4(b).
Exercises
Day 1: sine and cosine
Find the derivative.
- f(x) = 7\sin x + 2\cos x
- y = x^4 - 6\cos x
- \displaystyle g(t) = \dfrac{\sin t}{3} + \sqrt{t}, for t > 0
- \displaystyle f(x) = 2\sin x + \sin\left(\frac{\pi}{4}\right)
Day 1: tangent lines and level points
- Find the tangent line to y = \sin x at \displaystyle x = \frac{\pi}{6}.
- Find the tangent line to y = 4\cos x at \displaystyle x = \frac{\pi}{3}.
- Find where \displaystyle f(x) = \sin x - \sqrt{3}\cos x has a horizontal tangent on 0 \le x \le 2\pi.
- On 0 \le x \le 2\pi, where is g(x) = x - 2\sin x falling?
- Antu’s calculator is in degree mode. Using the method of Example 3, find the derivative of C(\theta) = \cos(\theta^\circ) and its value at \theta = 90.
Day 2: the other four, with products and quotients
Find the derivative.
- y = 3\tan x - \sec x
- f(x) = x^2 \tan x
- g(x) = \dfrac{\sec x}{x}
- y = \csc x \cot x
- h(x) = \dfrac{1 + \sin x}{\cos x}; simplify as far as you can.
- y = e^x \tan x
- y = \sin x \cos x
Day 2: tangent lines and motion
- Find the tangent line to y = \sec x at \displaystyle x = \frac{\pi}{3}.
- Find the tangent line to y = x\cos x at x = \pi.
- Find the points on y = 2x - \tan x, for \displaystyle -\frac{\pi}{2} < x < \frac{\pi}{2}, where the tangent is horizontal.
- Antu’s flywheel drives a slider whose position is s(t) = 8\cos t - 6\sin t centimeters after t seconds. Find its position and velocity at \displaystyle t = \frac{\pi}{2}.
- For the slider in Exercise 20, find the first time after t = 0 that it stops, and its position then.
Reasoning
- Use the quotient rule to show that \dfrac{d}{dx}\big[\cot x\big] = -\csc^2 x wherever \sin x \ne 0.
- Use the reciprocal rule to show that \dfrac{d}{dx}\big[\csc x\big] = -\csc x \cot x wherever \sin x \ne 0.
- The derivative of \tan x is never negative, yet \displaystyle \frac{\pi}{4} < \frac{3\pi}{4} while \displaystyle \tan\frac{\pi}{4} > \tan\frac{3\pi}{4}. Explain why there is no contradiction.
- Find the tangent line to y = \sin x at the origin, and explain how its slope is the limit \displaystyle \frac{\sin h}{h} \to 1 in another form. What would the slope be if x were in degrees?
Answers
- f'(x) = 7\cos x - 2\sin x. Term by term.
- y' = 4x^3 + 6\sin x. The derivative of -6\cos x is -6(-\sin x).
- \displaystyle g'(t) = \dfrac{\cos t}{3} + \dfrac{1}{2\sqrt{t}}. Constant multiple \displaystyle \frac{1}{3}, and the power rule on t^{1/2}.
- f'(x) = 2\cos x. The number \displaystyle \sin\left(\frac{\pi}{4}\right) = \frac{\sqrt{2}}{2} is a constant, with derivative 0.
- \displaystyle y = \dfrac{1}{2} + \dfrac{\sqrt{3}}{2}\left(x - \dfrac{\pi}{6}\right). The point is \displaystyle \left(\frac{\pi}{6}, \frac{1}{2}\right) and the slope is \displaystyle \cos\frac{\pi}{6}.
- \displaystyle y = 2 - 2\sqrt{3}\left(x - \dfrac{\pi}{3}\right). The point is \displaystyle \left(\frac{\pi}{3}, 2\right) and the slope is \displaystyle -4\sin\frac{\pi}{3}.
- x = \dfrac{5\pi}{6} and x = \dfrac{11\pi}{6}. \displaystyle f'(x) = \cos x + \sqrt{3}\sin x = 0 gives \displaystyle \tan x = -\frac{1}{\sqrt{3}}; \cos x = 0 is not a solution, since then \displaystyle f'(x) = \pm\sqrt{3}.
- For 0 \le x < \dfrac{\pi}{3} and \dfrac{5\pi}{3} < x \le 2\pi. g'(x) = 1 - 2\cos x < 0 exactly when \displaystyle \cos x > \frac{1}{2}.
- C'(\theta) = -\dfrac{\pi}{180}\sin(\theta^\circ), and C'(90) = -\dfrac{\pi}{180} \approx -0.01745. As in Example 3, with the cosine sum formula the quotient is \displaystyle -\cos u \cdot \frac{1 - \cos k}{h} minus \displaystyle \sin u \cdot \frac{\sin k}{h}, and \displaystyle \frac{1}{h} = \frac{\pi}{180} \cdot \frac{1}{k}.
- y' = 3\sec^2 x - \sec x \tan x, for \displaystyle x \ne \frac{\pi}{2} + k\pi.
- f'(x) = 2x\tan x + x^2 \sec^2 x. Product rule.
- g'(x) = \dfrac{x\sec x\tan x - \sec x}{x^2}, for x \ne 0 and \cos x \ne 0. Quotient rule, top \sec x and bottom x.
- y' = -\csc x \cot^2 x - \csc^3 x. Product rule: (-\csc x\cot x)\cot x + \csc x(-\csc^2 x).
- h'(x) = \dfrac{1}{1 - \sin x}, for \cos x \ne 0. The quotient rule gives top \cos^2 x + \sin x + \sin^2 x = 1 + \sin x over \cos^2 x = 1 - \sin^2 x; cancel 1 + \sin x, which is not 0 where \cos x \ne 0.
- y' = e^x(\tan x + \sec^2 x). Product rule.
- y' = \cos^2 x - \sin^2 x. Product rule: \cos x \cdot \cos x + \sin x \cdot (-\sin x).
- \displaystyle y = 2 + 2\sqrt{3}\left(x - \dfrac{\pi}{3}\right). \displaystyle \sec\frac{\pi}{3} = 2 and \displaystyle \tan\frac{\pi}{3} = \sqrt{3}, so the slope is \displaystyle 2\sqrt{3}.
- y = -x. y' = \cos x - x\sin x is -1 at \pi, and the point is (\pi, -\pi).
- \left(\dfrac{\pi}{4}, \dfrac{\pi}{2} - 1\right) and \left(-\dfrac{\pi}{4}, 1 - \dfrac{\pi}{2}\right). 2 - \sec^2 x = 0 gives \displaystyle \cos^2 x = \frac{1}{2}, so \displaystyle x = \pm\frac{\pi}{4} on this interval.
- Position -6 centimeters, velocity -8 centimeters per second. v(t) = -8\sin t - 6\cos t; at \displaystyle \frac{\pi}{2}, s = -6 and v = -8.
- At \displaystyle t = \pi - \arctan\frac{3}{4} \approx 2.498 seconds, position -10 centimeters. v = 0 gives \displaystyle \tan t = -\frac{3}{4}, first in the second quadrant, where \displaystyle \sin t = \frac{3}{5} and \displaystyle \cos t = -\frac{4}{5}; \displaystyle s = -\frac{32}{5} - \frac{18}{5}.
- The derivative is -\csc^2 x. The quotient rule gives \dfrac{-\sin^2 x - \cos^2 x}{\sin^2 x}, which is -\dfrac{1}{\sin^2 x} by the Pythagorean identity.
- -\dfrac{\cos x}{\sin^2 x} = -\dfrac{1}{\sin x} \cdot \dfrac{\cos x}{\sin x} = -\csc x\cot x.
- The two inputs lie on different branches, with the asymptote \displaystyle x = \frac{\pi}{2} between them, where \tan x is undefined. A nonnegative derivative makes a function nondecreasing only on an interval where it is differentiable throughout; \tan x rises on each interval between asymptotes, but the domain is not one interval.
- y = x, since \sin 0 = 0 and the slope is \cos 0 = 1. By the definition, that slope is the limit of \displaystyle \frac{\sin(0 + h) - \sin 0}{h}, which is \displaystyle \frac{\sin h}{h}, and so it is 1. In degrees it would be \displaystyle \frac{\pi}{180}, by Example 3.