# How to do integration of $∫\tan (x) dx$

Can someone please explain these steps to me?

\begin{align*} \int \tan (x) dx&= \int \frac{\sin(x)}{\cos(x)} dx\\[3pt] &= - \int \frac d{dx} \ln(\cos(x)) dx\\[3pt] &= - \ln(\cos(x)) + C \end{align*}

I obviously understand step one to step two, but no further.

I'm thinking (perhaps incorrectly) that $\frac d{dx} \ln(\cos(x))$ gives the $\frac 1{\cos(x)}$ but I don't see where the $\sin(x)$ went.

• Hint: Remember that from the Chain Rule it follows $$\frac{d}{dx}\ln(u)=\frac{1}{u}\dfrac{du}{dx}$$ – Ángel Mario Gallegos Apr 4 '17 at 5:45

consider $\int\frac{\sin x }{\cos x}dx$. Let $u=\cos x$ then $\frac{du}{dx}=-\sin x\implies du=-\sin x \: dx$. Substitute this in the original inegral. You get $-\int\frac{du}{u}=-\ln| u| +c=-\ln |\cos x|+c$

• (Should have absolute value) – user223391 Apr 4 '17 at 6:12
• done.. overlooked that. thanks – Hirak Apr 4 '17 at 6:13

Given $\displaystyle\int \dfrac{f'(x)}{f(x)}\,\mathrm dx$ we can make the substitution $u=f(x)$, giving $\mathrm du =f'(x)\,\mathrm dx$ and so $$\int \frac{f'(x)}{f(x)}\,\mathrm dx = \int \frac1u \,\mathrm du = \ln|u| + c = \ln |f(x)| + c$$

In your case, $f(x)=\cos x$, but you should always look out for this form.

In general, for any function of sines and cosines, $u=\sin x$ and $u=\cos x$ are worth investigating as substitutions.

Simply -

1.) $\int \frac {f'(x)}{f(x)} dx = \ln |f(x)| + c$

Other one is not used. But you should need to know.

2.) $\int f(x) \cdot f'(x) dx = \dfrac{[f(x)]^{n+1}}{n+1} + c$

So from,

$\int \frac{\sin(x)}{\cos(x)} dx= - \int \frac{-\sin(x)}{\cos(x)} dx=- \ln|\cos x| + c$

$$\frac{d}{dx}(- \ln \cos x ) = - \frac{d\ln\cos x}{dx} = - \frac{d\ln\cos x}{d\cos x} \frac{d\cos x}{dx} = -\frac{1}{\cos x}(-\sin x) = \tan x$$