$$\int \frac{(1+\cos x +\sin x)-2(-\sin x+\cos x)+1}{1+\cos x+\sin x}$$
I was solving it following way.
$$\int \frac{(1+\cos x +\sin x)-2(-\sin x+\cos x)}{1+\cos x+\sin x}\mathrm dx+\int \frac{1}{1+\cos x+\sin x}$$ $$\int\frac{t-2 \mathrm dt}{t}+$$
I am not doing anything here with $\int \frac{1}{1+\cos x+\sin x}$. Cause, I got correct answer for that. But, I didn't correct answer for left ones. And, here I took $$1+\cos x+\sin x=t$$ $$(-\sin x+\cos x)\mathrm dx=dt$$
While integrating it I saw something weird $\mathrm dt$ is multiplicative with $2$ not with $t$ or, whole equation. Although, I was trying to integrate.
$$\int \frac{t}{t}\mathrm dt-\int \frac{2}{t}\mathrm dt=t-2\ln|t|$$
But, answer on my book was
$$x-2\ln|1+\cos x+\sin x|$$
They got $x$. But, I got $t$ where $t=1+\cos x+\sin x$
Did I do wrong? Or, my book is wrong?
$$\int\frac{(1+\cos x+\sin x)-2(-\sin x+\cos x)+1}{1+\cos x+\sin x}\,\mathrm dx\\ =\left(\int\frac{1+\cos x+\sin x}{1+\cos x+\sin x}\,\mathrm dx\right)-2\left(\int\frac{-\sin x+\cos x}{1+\cos x+\sin x}\,\mathrm dx\right)+\left(\int\frac{1}{1+\cos x+\sin x}\,\mathrm dx\right)$$
When you sub $t:=1+\cos x+\sin x$, you have $\mathrm dt=(-\sin x+\cos x)\,\mathrm dx\ne\mathrm dx$, so the first integral summand is not $\displaystyle\int\frac tt\,\mathrm dt$
Rather, it is just $\require{cancel}\displaystyle\int\frac{\cancel{(1+\cos x+\sin x)}}{\cancel{(1+\cos x+\sin x)}}\,\mathrm dx=\int\mathrm dx$