Derivative of ln(cos x): Formula, Steps and Examples
The derivative of ln(cos x) is −tan x. See the chain rule steps, why it explains the integral of tan x, a graph, and ln(sin x) and ln(sec x).
Exponential and log derivatives Updated 2 min read
At a glance
- Derivative
- -\tan x where \cos x > 0
- Second derivative
- -\sec^2 x
- With absolute value
- \dfrac{d}{dx}\ln\lvert\cos x\rvert = -\tan x where \cos x \ne 0
- Related integral
- \int\tan x\,dx = -\ln\lvert\cos x\rvert + C
- Companion
- \dfrac{d}{dx}\ln(\sin x) = \cot x
On this page
The derivative of \ln(\cos x) is -\tan x. It is a short chain rule calculation, and it is the reason the integral of \tan x involves a log.
Step by step with the chain rule
For a log of a function, the derivative of ln x together with the chain rule gives \frac{d}{dx}\ln u = \frac{u'}{u}. Here u = \cos x:
- The inside is u = \cos x.
- Its derivative is u' = -\sin x (see the derivative of cos x).
- Divide: \frac{u'}{u} = \frac{-\sin x}{\cos x} = -\tan x.
Where ln(cos x) is defined
A log only accepts positive inputs, so \ln(\cos x) exists only where \cos x > 0. That is the interval \left(-\frac{\pi}{2}, \frac{\pi}{2}\right) and its copies shifted by 2\pi. Where \cos x < 0, use \ln\lvert\cos x\rvert instead. It has the same derivative, -\tan x, wherever \cos x \ne 0.
Graph of ln(cos x) and its derivative
Since \cos x \le 1, \ln(\cos x) \le 0, with the maximum value 0 at x = 0. The second derivative is -\sec^2 x, which is always negative, so the graph is concave down everywhere it exists.
Why this gives the integral of tan x
Flip the result around. Since \frac{d}{dx}\ln\lvert\cos x\rvert = -\tan x,
The two forms are equal because -\ln\lvert\cos x\rvert = \ln\frac{1}{\lvert\cos x\rvert}. The full method, with u-substitution, is on the integral of tan x page.
Logs of other trig functions
| Function | Derivative |
|---|---|
| \ln(\cos x) | -\tan x |
| \ln(\sin x) | \cot x |
| \ln(\sec x) | \tan x |
| \ln(\tan x) | \frac{\sec^2 x}{\tan x} = \frac{1}{\sin x\cos x} |
| \ln(\sec x + \tan x) | \sec x |
The last row is the famous one behind \int\sec x\,dx = \ln\lvert\sec x + \tan x\rvert + C. Check it: the derivative of the inside is \sec x\tan x + \sec^2 x = \sec x(\tan x + \sec x), and dividing by \sec x + \tan x leaves \sec x.
Worked examples
Example 1. \frac{d}{dx}\ln(\cos 2x) = \frac{-2\sin 2x}{\cos 2x} = -2\tan 2x.
Example 2. \frac{d}{dx}\ln(\cos^2 x) = \frac{d}{dx}2\ln(\cos x) = -2\tan x.
Example 3: tangent line. At x = \frac{\pi}{4}, \ln\left(\cos\frac{\pi}{4}\right) = \ln\frac{\sqrt{2}}{2} = -\frac{\ln 2}{2} \approx -0.347, and the slope is -\tan\frac{\pi}{4} = -1. The tangent line is y = -\frac{\ln 2}{2} - \left(x - \frac{\pi}{4}\right).
Common mistakes
- Writing \frac{1}{\cos x}. That is \sec x, and it forgets the inside derivative -\sin x.
- Losing the minus sign. The derivative of \cos x is -\sin x, so the answer is -\tan x, not \tan x.
- Writing -\frac{1}{\sin x}. You inverted the inside derivative instead of dividing by the inside.
Practise more trig chain rule problems with derivatives of trig functions.
Practice it now
Chain rule: trig
Solve real problems on this topic with instant feedback, hints and a step-by-step walkthrough for every answer. Free, no sign-up needed to start.
Practice this lesson