I understand the mechanics of using $u$-substitution to solve

$$\int\tan(x)\,dx = -\ln(\cos(x))$$

The textbook/online $u$-sub solution examples smack of "because that's what makes it work." What I'm looking for is an explanation of why it works. What are the properties of these trig and log functions that enable them to be related via integrals and derivatives?

  • 4
    $\begingroup$ You forgot the absolute value $-\ln( |\cos(x) | )$. $\endgroup$ Jun 10, 2021 at 14:23
  • 4
    $\begingroup$ Integrating any function with simple poles will usually end up with $\ln$ showing up. $\endgroup$ Jun 10, 2021 at 22:35

3 Answers 3


I think the best way to see it is to go backwards from $-\ln(\cos(x))$ using the chain rule. We have that $$\frac{d}{dx}\bigl(-\ln(\cos(x))\bigr) = -\frac{d}{dx}\ln(\cos(x)) = -\frac{\frac{d}{dx}\cos(x)}{\cos(x)} = -\frac{-\sin(x)}{\cos(x)}= \tan(x).$$ That then means that $$\int\tan(x)\,dx = -\ln(\cos(x)).$$

There's nothing really special about trig functions going on here as much as we have an integral of the form $$\int\frac{-f'(x)}{f(x)}\,dx.$$

  • 1
    $\begingroup$ Yes this is just the opposite of u-sub. Still interested in finding if there is a deeper relationship between the trig and log functions, beyond the textbook explanations. $\endgroup$ Jun 10, 2021 at 15:10
  • 4
    $\begingroup$ I'm not really sure what you're looking for then in terms of a "deeper relationship." Can you give an example of something you consider "deep"? $\endgroup$
    – DMcMor
    Jun 10, 2021 at 15:31
  • $\begingroup$ @charlieK3 Well, there's Euler's formula, but I'm not sure if that really plays any role here. As mentioned, the -ln( f(x) ) will show up for any integral fitting that last equation. $\endgroup$
    – R.M.
    Jun 11, 2021 at 0:28

Notice that in general: $$\int\frac{f'(x)}{f(x)}dx\stackrel{u=f(x)}{=}\int\frac{u'}{u}\frac{du}{u'}=\int\frac{du}{u}=\ln|u|+C=\ln|f(x)|+C$$

In your case: $$\int\tan(x)dx=\int\frac{\sin(x)}{\cos(x)}dx=\int\frac{[-\cos(x)]'}{\cos(x)}dx=-\ln|\cos(x)|+C$$ try making the substitution $u=\cos x$ and see what you get

In terms of a deeper meaning, you could use the exponential definition of $\sin$ and $\cos$ to get: $$\tan(x)=\frac{e^{ix}-e^{-ix}}{e^{ix}+e^{-ix}}$$ and notice that: $$\frac{d}{dx}\left[e^{ix}+e^{-ix}\right]=i\left(e^{ix}-e^{-ix}\right)$$


$\ln x$ is a function such that the slope at each $x > 0$ is $1/x$. That is, $\frac{d}{dx} \ln x = 1/x$.

By the Chain Rule, $\frac{d}{dx} \ln (f(x)) = \frac{f'(x)}{f(x)}$.

In your case, put $f(x) = \cos x$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .