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)\mathop{}\!\mathrm{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{\mathop{}\!\mathrm{d}t}{\mathop{}\!\mathrm{d}\theta}$$

$$\dfrac{2}{\cos2\theta}=\dfrac{\mathop{}\!\mathrm{d}t}{\mathop{}\!\mathrm{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$$

\begin{align} \cos2\theta & = \dfrac{1-\tan^2\theta}{1+\tan^2\theta}\\ & = \dfrac{(e^t+1)^2-(e^t-1)^2}{(e^t+1)^2+(e^t-1)^2}\\ & = \dfrac{4e^t}{2(e^{2t}+1)}\\ & = \dfrac{2e^t}{e^{2t}+1}\tag{2}\\ \end{align}

So integral will be

$$\dfrac{1}{2}\cdot\int \left(\dfrac{2e^t}{e^{2t}+1}\right)^2\mathop{}\!\mathrm{d}t$$ $$=\int \dfrac{2e^{2t}}{(1+e^{2t})^2}\mathop{}\!\mathrm{d}t$$

Let $$1+e^{2t}=y$$ we have $$2e^{2t}=\dfrac{\mathop{}\!\mathrm{d}y}{\mathop{}\!\mathrm{d}t}$$ $$2e^{2t}\mathop{}\!\mathrm{d}t=\mathop{}\!\mathrm{d}y$$

\begin{align} \int \dfrac{\mathop{}\!\mathrm{d}y}{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'\\ \end{align}

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?

• The integral after eq(2) (and subsequent ones) is missing a factor of $t$. Commented Dec 28, 2019 at 1:27

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$$.

• thanks, #blindness :( Commented Dec 27, 2019 at 23:37
• let me correct. Commented Dec 27, 2019 at 23:57

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$$

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}$$

• Where did $\cos(2\theta)$ disappear after the substitution? Commented Dec 28, 2019 at 0:06
• Yes, that was a mistake, the solution using that substitution is more complicated but it can still be done, I edited my original answer to show the main steps. Commented Dec 28, 2019 at 0:42
• math.stackexchange.com/questions/175143/… Commented Dec 28, 2019 at 4:06

Recognize $$\tan(\theta+\frac\pi4)=\frac{\cos \theta+\sin\theta}{\cos \theta-\sin\theta}$$ and then integrate by parts

\begin{align} &\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 \end{align}

$$\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}$$

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.$$

I don't know how to use mathjax. Please try to understand. (mathjax added, Is this what you want?)

$$\frac{\cos x + \sin x}{\cos x- \sin x} = \sec 2x+ \tan 2x$$ (Rationalise the denominator by $$\cos x+ \sin x$$ and solve to get the equation)

And then apply integration by parts by taking $$u = \ln( \sec 2 x+ \tan 2x)$$ and $$v = \cos 2x$$.

$$\tan (x+\pi/4) = \sec 2x + \tan 2x$$

After simplifying and using some formulas I got
$$\frac{1}{2}\left(\sin 2x \ln(\tan (x+\pi/4)) + \ln (\cos 2x)\right)$$

Hope this helps