Differentiating tan x and the Reciprocal Ratios

The quotient rule turns sin over cos into sec².

tan x is a quotient

tan x = (sin x)/(cos x), defined wherever cos x ≠ 0, which is every x except π/2 + nπ for whole numbers n. Both parts have known derivatives, so the quotient rule applies, with x in radians throughout.

The numerator is u = sin x, so u' = cos x. The denominator is v = cos x, so v' = −sin x.

The quotient rule on sin x over cos x

The quotient rule gives (u'v − uv')/v² = (cos x · cos x − sin x · (−sin x))/cos²x.

The second term is sin x times −sin x, subtracted, so the two minus signs make a plus: the numerator is cos²x + sin²x.

The numerator is 1

By Pythagoras, cos²x + sin²x = 1 for every x. So the derivative of tan x is 1/(cos²x), and 1/(cos x) is sec x, so this is sec²x.

Since cos²x is at most 1, sec²x is at least 1. So tan x rises on every branch of its graph, with gradient never less than 1, and exactly 1 where cos²x = 1, at x = nπ.

Check at three points. At x = 0, sec²0 = 1. At x = π/4, cos²x = 1/2, so sec²x = 2; the chord from π/4 to π/4 + 0.001 has gradient 2.0020. At x = 1, sec²1 = 3.4255, and a chord with a step of 0.000001 gives 3.4255.

xy

The gold curve y = tan x, for x from −1.5 to 1.5 radians. The dashed line is its tangent at the origin, with gradient sec²0 = 1. The gold line is its tangent at (π/4, 1), with gradient sec²(π/4) = 2.

sec x

sec x = 1/(cos x) = (cos x)⁻¹, defined where cos x ≠ 0. The chain rule applies, with inner function cos x and outer function u⁻¹. The outer derivative is −u⁻², and the inner derivative is −sin x.

So the derivative is −(cos x)⁻² × (−sin x) = (sin x)/(cos²x). Split it as (1/(cos x)) × ((sin x)/(cos x)), and that is sec x tan x.

Check at x = π/3, where sec x = 2 and tan x = √3: the derivative is 2√3 = 3.4641, and a chord with a step of 0.000001 gives 3.4641. At x = 0.5 the derivative is 0.6225, and the chord gives 0.6225.

cosec x and cot x

cosec x = 1/(sin x) = (sin x)⁻¹, defined where sin x ≠ 0. The same chain-rule move gives −(sin x)⁻² × cos x = −(cos x)/(sin²x), which splits as −cosec x cot x. At x = π/6, cosec x = 2 and cot x = √3, so the derivative is −2√3 = −3.4641. At x = 1 it is −0.7631. Chords give the same two values.

cot x = (cos x)/(sin x), so the quotient rule applies, with u' = −sin x and v' = cos x. The numerator is −sin x · sin x − cos x · cos x = −(sin²x + cos²x) = −1, so the derivative is −1/(sin²x) = −cosec²x. At x = π/4 that is −2, and at x = 1 it is −1.4123. Chords give the same two values.

cot x is also 1/(tan x). The chain rule on (tan x)⁻¹ gives −sec²x/tan²x, and since sec²x/tan²x = (1/cos²x) × (cos²x/sin²x) = 1/sin²x, that is −cosec²x again.

The four results together

tan x differentiates to sec²x, and sec x to sec x tan x. The co-functions follow the same pattern with cot and cosec in place of tan and sec, and a minus sign: cot x differentiates to −cosec²x, and cosec x to −cosec x cot x.

The minus signs match the graphs. On 0 < x < π/2, cot x and cosec x are both falling, while tan x and sec x are both rising.

A coefficient on the angle

The chain rule brings out the inner derivative, as before. For y = tan 3x, the inner function is 3x and the outer function is tan, so dy/dx = 3 sec²3x, which is 3 at x = 0. For y = sec 2x, dy/dx = 2 sec 2x tan 2x, which is 1.6578 at x = 0.3.

The usual mistakes

Giving sec x tan x as the derivative of tan x. That is the derivative of sec x; tan x gives sec²x.

Differentiating sin x / cos x term by term, to get (cos x)/(−sin x). The quotient rule is needed, and it gives sec²x.

Dropping the minus from cot or cosec. Both functions fall on 0 < x < π/2, so both derivatives are negative there.

Adding a minus to sec x. The −1 from the power and the minus in −sin x multiply to +1, so sec x differentiates to plus sec x tan x.

A lighthouse beam

In the application below, a lit spot is 300 tan θ meters along a wall. Its derivative, 300 sec²θ, is in meters per radian, and the chain rule turns it into meters per second.

Worked example: A Lighthouse Beam Sweeping Along a Sea Wall: the Speed of the Lit Spot Far from the Perpendicular

Question A lighthouse stands 300 m from a long straight sea wall, and its lamp turns at a steady 0.2 radians per second. The beam lights a point on the wall y meters from the foot of the perpendicular from the lighthouse, where y = 300tanθ and θ is the angle between the beam and that perpendicular. (a) Find dydθ when θ = π4. (b) How fast is the lit spot moving along the wall at that moment?

  1. 1.Let θ be the angle between the beam and the perpendicular to the wall. The lit spot is y = 300tanθ meters from the foot of that perpendicular.

    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallpi/4y = 300 tan θ
    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallpi/4y = 300 tan θ
    The lit spot is y = 300tanθ meters from the foot of the perpendicular, where θ is the beam's angle.
  2. 2.Differentiate: ddθ(tanθ) = sec2θ, so dydθ = 300sec2θ meters per radian.

    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallpi/4d(tan θ)/dθ = 1/(cos θ × cos θ)dy/dθ = 300/(cos θ × cos θ)
    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallpi/4d(tan θ)/dθ = 1/(cos θ × cos θ)dy/dθ = 300/(cos θ × cos θ)
    The derivative of tanθ is sec2θ, so dydθ = 300sec2θ.
  3. 3.(a) At θ = π4, cosπ4 = 1√2, so sec2π4 = 2 and dydθ = 300 × 2 = 600 meters per radian.

    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallrun 0.2rise 120pi/4θ = pi/4: cos θ × cos θ = 0.5dy/dθ = 300/0.5 = 600 m per radian
    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallrun 0.2rise 120pi/4θ = pi/4: cos θ × cos θ = 0.5dy/dθ = 300/0.5 = 600 m per radian
    (a) At θ = π4, sec2θ = 2, so dydθ = 600 meters per radian: a rise of 120 m for 0.2 of a radian.
  4. 4.Let x be the number of seconds. The lamp turns at dθdx = 0.2 radians per second, and the chain rule gives dydx = dydθ × dθdx.

    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallpi/4dθ/dx = 0.2 radians per seconddy/dx = dy/dθ × dθ/dx
    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallpi/4dθ/dx = 0.2 radians per seconddy/dx = dy/dθ × dθ/dx
    The lamp turns at dθdx = 0.2 radians per second, and the chain rule multiplies the two rates.
  5. 5.(b) dydx = 600 × 0.2 = 120 meters per second. Check: a hundredth of a radian past π4 the spot has moved about 6 m, and the lamp takes 0.05 seconds to turn that far.

    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallpi/4dy/dx = 600 × 0.2 = 120 m per second6 m in 0.05 of a second
    300 mythe lampθ030060090000.40.81.2angle in radiansmeters along the wallpi/4dy/dx = 600 × 0.2 = 120 m per second6 m in 0.05 of a second
    (b) dydx = 600 × 0.2 = 120 meters per second.

Answer: (a) 600 meters per radian; (b) the lit spot is moving at 120 meters per second

Common mistakes

  • Differentiating tanθ as sinθcosθ term by term, giving cosθ−sinθ. The quotient rule gives cos2θ + sin2θcos2θ = sec2θ instead.
  • Reading the 0.2 as a speed in meters per second. It is the turning rate of the lamp, in radians per second, and it becomes a speed along the wall only after it is multiplied by dydθ.

More rules of differentiation problems, worked step by step →

Practice Differentiating tan x and the Reciprocal Ratios in the app