# $\int\tan x\ dx$ by integration by parts [duplicate]

Can anyone help me figure out what is wrong in the following step:

\begin{align}\int \tan x\ dx &= \int (\sec x \sin x)\ dx\\ &= -\sec x \cos x + \int \sec x\tan x\cos x\ dx\\ &= -1 + \int \tan x dx\end{align}

So I got $\displaystyle\int \tan x\ dx = -1 + \int \tan x\ dx$ that is $0 = -1$ ?

Any help will be really appreciated!

Now I understand. So an indefinite integral can be defined only upto a constant. Thanks a lot!

## marked as duplicate by Git Gud, 5xum, Norbert, Davide Giraudo, egregMay 23 '14 at 10:09

• You forgot the constant of integration. – Tunococ May 23 '14 at 8:29

What you've lost is constant of integration of $\sin x$. If instead of $-\cos x$ you take $C-\cos x$, then you'll have:

$$\int \tan x\;dx=\int(\sec x\sin x)\;dx=\\ =-\sec x\cos x+C\sec x+\int(\cos x-C)\tan x\sec x\;dx=\\ =-1+C\sec x+\int \tan x\;dx-C\int \tan x\sec x\;dx.$$

Then instead of $-1=0$ you'll have

$$C\left(\sec x-\int \tan x\sec x\;dx\right)=1,$$

which does make sense.

• It's very clear now...thank you! – Jenny May 23 '14 at 8:59
• If this solves your question, you can accept the answer (pressing the tickmark to the left of it). – Ruslan May 23 '14 at 8:59

Think it in this way, say you're evaluating the definite integral $$\int_{a}^b \tan x dx$$ Then according to your steps you'll get $$\int_{a}^b\tan x \ dx=[-1]_a^b+\int_{a}^b \tan x\ dx=\int_{a}^b\tan x \ dx$$So nothing gets changed.

• I think it would be more instructive to show how exactly losing constant of integration in indefinite integral leads to the nonsensical result in OP. Your answer just hides the problem instead of making it understandable. – Ruslan May 23 '14 at 8:42