<s>[INST] What's wrong in my calculation of $\int_0^{3 \pi/4} \frac{\cos x}{1 + \cos x}dx$? What's wrong in my calculation of $$\int_0^{3 \pi/4} \dfrac{\cos x}{1 + \cos x} dx\,?$$
I have to find:
$$\displaystyle\int_0^{3 \pi/4} \dfrac{\cos x}{1 + \cos x} dx$$
and I can't seem to get the right answer. This is what I did:
I decided to use the Weierstrass substitution with:
$$t = \tan \dfrac{x}{2}$$
$$\cos x = \dfrac{1 - t^2}{1 +  t^2}$$
$$\sin x = \dfrac{2t}{1 + t^2}$$
$$dx = \dfrac{2}{1+ t^2}$$
I am pretty new to this type of substitution.
Anyway, the boundaries become:
$$t_1= \tan 0 = 0$$
$$t_2 = \tan \dfrac{3 \pi }{8}$$
We have
$$\displaystyle\int_0^{3 \pi/4} \dfrac{\cos x}{1 + \cos x} dx = $$
$$=\displaystyle\int_0^{\tan 3 \pi/8} \dfrac{\dfrac{1 - t^2}{1 + t^2}}{1 + \dfrac{1 - t^2}{1 + t^2}} \cdot \dfrac{2}{1 + t^2} $$
$$=\displaystyle\int_0^{\tan 3 \pi/8} \dfrac{1-t^2}{1+t^2} dt$$
$$=\displaystyle\int_0^{\tan 3 \pi/8} \dfrac{1}{1+t^2}dt - \displaystyle\int_0^{\tan 3 \pi/8} \dfrac{t^2}{1+t^2} dt $$
$$=\displaystyle\int_0^{\tan 3 \pi/8} \dfrac{1}{1+t^2} dt - \displaystyle\int_0^{\tan 3 \pi/8} \dfrac{t^2 + 1 - 1}{1+t^2} dt$$
$$= \displaystyle\int_0^{\tan 3 \pi/8} \dfrac{1}{1+t^2} dt - \displaystyle\int_0^{\tan 3 \pi/8} 1 dt + \displaystyle\int_0^{\tan 3 \pi/8} \dfrac{1}{1+t^2} dt $$
$$= 2 \bigg [\arctan(t) \bigg ]_0^{\tan 3\pi/8} - \bigg [ t \bigg ]_0^{\tan 3\pi/8}$$
$$= 2\arctan \bigg ( \tan \dfrac{3 \pi}{8} \bigg ) - \tan \dfrac{3\pi}{8}$$
$$= 2 \dfrac{3 \pi}{8} - \tan \dfrac{3 \pi}{8}$$
$$=\dfrac{3 \pi}{4} - \tan \dfrac{3 \pi}{8}$$
So that's the answer that I got. However, my textbook claims that the correct answer is in fact $\dfrac{\pi}{4} + \tan \dfrac{3 \pi}{8} - 2$. So, what did I do wrong?
 [/INST] Here is the step-by-step solution for the indefinite integral:


</s>