Evaluate $\int \cos 2\theta \ln\left(\frac{\cos \theta+\sin\theta}{\cos\theta-\sin\theta}\right)d\theta$ $$\int \cos 2\theta \ln\left(\dfrac{\cos \theta+\sin\theta}{\cos\theta-\sin\theta}\right)d\theta$$
My attempt is as follows:-
$$\ln\left(\dfrac{\cos \theta+\sin\theta}{\cos\theta-\sin\theta}\right)=t\tag{1}$$
$$\dfrac{\cos\theta-\sin\theta}{\cos\theta+\sin\theta}\cdot\dfrac{\left(\cos\theta-\sin\theta\right)^2-(-\sin\theta-\cos\theta)(\cos\theta+\sin\theta)}{(\cos\theta-\sin\theta)^2}=\dfrac{dt}{d\theta}$$
$$\dfrac{2}{\cos2\theta}=\dfrac{dt}{d\theta}$$
Let's calculate $\cos2\theta$ from equation $1$
$$\dfrac{\cos \theta+\sin\theta}{\cos\theta-\sin\theta}=e^t$$
$$\dfrac{1+\tan\theta}{1-\tan\theta}=e^t$$
Applying componendo and dividendo
$$\dfrac{2}{2\tan\theta}=\dfrac{e^t+1}{e^t-1}$$
$$\dfrac{e^t-1}{e^t+1}=\tan\theta$$
$$\cos2\theta=\dfrac{1-\tan^2\theta}{1+\tan^2\theta}$$
$$\cos2\theta=\dfrac{(e^t+1)^2-(e^t-1)^2}{(e^t+1)^2+(e^t-1)^2}$$
$$\cos2\theta=\dfrac{4e^t}{2(e^{2t}+1)}$$
$$\cos2\theta=\dfrac{2e^t}{e^{2t}+1}\tag{2}$$
So integral will be 
$$\dfrac{1}{2}\cdot\int \left(\dfrac{2e^t}{e^{2t}+1}\right)^2dt$$
$$\dfrac{1}{2}\cdot\int \dfrac{4e^{2t}}{(1+e^{2t})^2}$$
$$e^{2t}+1=y$$
$$2e^{2t}=\dfrac{dy}{dt}$$
$$2e^{2t}dt=dy
$$\int \dfrac{dy}{y^2}$$
$$-\dfrac{1}{y}+C$$
$$-\dfrac{1}{1+e^{2t}}+C$$
$$-\dfrac{1}{1+e^{\ln\left(\dfrac{\cos\theta+\sin\theta}{\cos\theta-\sin\theta}\right)^2}}+C$$
$$-\dfrac{1}{1+\dfrac{1+\sin2\theta}{1-\sin2\theta}}+C$$
$$-\dfrac{1-\sin2\theta}{2}+C$$
$$\dfrac{\sin2\theta}{2}+C'$$
And this should be actually wrong because if we differentiate the result, it will give $\cos2\theta$, but integrand is $\cos 2\theta \ln\left(\dfrac{\cos \theta+\sin\theta}{\cos\theta-\sin\theta}\right)$
What am I missing here, checked multiple times, but not able to get the mistake. Any directions?
 A: You've done nearly all your computations correctly, save for one critical error:  after your substitution $$e^t = \frac{\cos \theta + \sin \theta}{\cos \theta - \sin \theta},$$ with $$dt = 2 \sec 2\theta \, d\theta,$$ and $$\cos 2\theta = \frac{2}{e^t + e^{-t}},$$ your integrand should be $$\int \color{red}{\cos 2\theta} \color{blue}{\log \frac{\cos \theta + \sin \theta}{\cos \theta - \sin \theta}} \, \color{purple}{d\theta} = \frac{1}{2} \int \color{red}{\frac{2}{e^t + e^{-t}}} \cdot \color{blue}{t} \cdot \color{purple}{\frac{2}{e^t + e^{-t}} \, d t} = \frac{1}{2} \int \left(\frac{2}{e^t + e^{-t}}\right)^2 t \, dt.$$  You are missing that extra factor $t$.
A: With integration by parts you get
$$
\begin{align}
&\int \cos 2\theta \ln\left(\frac{\cos\theta+\sin\theta}{\cos\theta-\sin\theta}\right)\mathrm{d}\theta\\
&=\frac 12\sin2\theta\ln\left(\frac{\cos\theta+\sin\theta}{\cos\theta-\sin\theta}\right)-\frac 12\int \sin2\theta\left(\frac{\cos\theta-\sin\theta}{\cos\theta+\sin\theta}\right)\left(\frac{\cos\theta+\sin\theta}{\cos\theta-\sin\theta}\right)^{'}\mathrm{d}\theta \\
&=\frac 12\sin2\theta\ln\left(\frac{\cos\theta+\sin\theta}{\cos\theta-\sin\theta}\right)-\int\tan2\theta\,\mathrm{d}\theta
\end{align}$$
so you just need to use
$$\int \tan x\,\mathrm{d}x=-\ln|\cos x|+C $$
A: Use the short-hand $\tan(\theta+\frac\pi4)=\frac{\cos \theta+\sin\theta}{\cos \theta-\sin\theta}$ and then integrate by parts
$$I=\int \cos 2\theta \ln\tan(\theta+\frac\pi4)d\theta$$
$$=\frac12 \sin2\theta\ln\tan(\theta+\frac\pi4)
- \int \frac{\sin2\theta}{\cos2\theta}d\theta$$
$$=\frac12 \sin2\theta\ln\tan(\theta+\frac\pi4)
+\frac12\ln|\cos2\theta|+C$$
A: If you multiply the fraction inside ln top and bottom by $\cos(2\theta)+\sin(2\theta)$ and use the trig identities 
$\cos^2(t)-\sin^2(t)=\cos(2t)$, $\sin(2t)=2\sin(t) \cos(t)$, the integral becomes
$$\int\cos(2\theta) \ln(\sec(2\theta)+\tan(2\theta))d\theta$$
 Now use the substitution $u=\sec(2\theta)+\tan(2\theta)$ that gives you $du=2u \sec(2\theta)d\theta$ and express $\cos(2\theta)$ as a function of $u$:
$$\cos(2\theta)=\frac{2u}{u^2+1}$$
When you substitute this into the integral, you can integrate by parts using the fact that $$\frac{d}{du}\left(\frac{2}{u^2+1}\right)=-\frac{4u}{(u^2+1)^2}
$$
A: Simplify the argument of the logarithm thus:
$$\frac{\cos\theta+\sin\theta}{\cos\theta-\sin\theta}=\frac{(\cos\theta+\sin\theta)(\cos\theta-\sin\theta)}{(\cos\theta-\sin\theta)^2}=\frac{\cos^2\theta-\sin^2\theta}{1-2\sin\theta\cos\theta}=\frac{\cos2\theta}{1-\sin2\theta}.$$
Then it follows that $$\log\left(\frac{\cos\theta+\sin\theta}{\cos\theta-\sin\theta}\right)=\log\left(\frac{\cos2\theta}{1-\sin2\theta}\right)=\log\cos2\theta-\log(1-\sin2\theta)=\log\sqrt{1-\sin^22\theta}-\log(1-\sin2\theta)=\frac12\log[(1-\sin2\theta)(1+\sin2\theta)]-\log(1-\sin2\theta)=\frac12\log(1-\sin2\theta)+\frac12\log(1+\sin2\theta)-\log(1-\sin2\theta)=\frac12\log(1+\sin2\theta)-\frac12\log(1-\sin2\theta).$$
Thus, we may write the differential as $$\frac14\log(1+\sin2\theta)\,\mathrm d(1+\sin2\theta)+\frac14\log(1-\sin2\theta)\,\mathrm d(1-\sin2\theta),$$ which is easily done if we recall the result that the $\int\log y\,\mathrm dy=y\log y-y+C.$
A: $$
\displaystyle \begin{array}{rl} 
& \displaystyle \int\cos 2 \theta\ln\left(\frac{\cos \theta+\sin \theta}{\cos \theta-\sin \theta}\right) d \theta \\
=  & \displaystyle  \frac{1}{2} \int \cos 2 \theta \ln \left(\frac{1+\sin 2 \theta}{1-\sin 2 \theta}\right) d \theta \\
= & \displaystyle \frac{1}{4} \int \ln \left(\frac{1+x}{1-x}\right) d x \\
= & \displaystyle \frac{1}{4}\left[\ln (1+x) d x-\int \ln (1-x) d x\right] \text { where } x=\sin 2 \theta\\
= & \displaystyle \frac{1}{4}[(1+x) \ln (1+x)-(1-x) \ln (1-x)]+C \\
= & \displaystyle \frac{1}{4}[(1+\sin 2 \theta) \ln (1+\sin 2 \theta)-(1-\sin 2 \theta) \ln (1-\sin 2\theta)+C
\end{array}
$$
