Integral of $\frac{1}{\cos x +1}$ by integation by parts

I know you can integrate this function by multiplying by the conjugate but I was experimenting a bit and tried to integrate it by parts, It doesnt work but I dont know why.

Here's my procces:

$\int{\frac{1}{\cos x +1}dx}=^*\frac{x}{\cos x +1}+\int{\frac{-\sin x}{(\cos x +1)^2}dx}=^{**}\frac{x}{\cos x +1} +\int{\frac{du}{u^2}}=\frac{x}{\cos x +1}-\frac{1}{u}+C$

$=\frac{x}{\cos x +1}-\frac{1}{\cos x +1}$

*: Integration by parts $f'=1;g=\frac{1}{\cos x +1}$

**: u-Substitution $u=\cos x +1;du=-\sin x dx$

That function do not differentiate to $\frac{1}{\cos x+1}$ so is not an antiderivative. Probably I did something illegal in my procces that's why i'm asking here.

Thanks in advance

EDIT: I see the mistake now I forgot the x term, how silly of me. Well, thanks for everyone who pointed it out to me :D!


Solution 1:

Theres a mistake. $$ \begin{aligned} \int \frac{1}{\cos x +1} \, dx &= \frac{x}{\cos x +1}-\int \frac{x\sin x}{(\cos x+1)^2}\, dx \\ &= \frac{x}{\cos x +1}+\int \frac{\cos^{-1}{(u-1)}}{u^2} \, du \end{aligned}$$

It is easy to see that this approach leads nowhere.