# Evaluate $\int_0^{\pi/2} \ln \left(a^2\cos^2\theta +b^2\sin^2\theta\right) \,d\theta$ where $a,b$ are finite natural numbers

Evaluate $$\int_0^{\pi/2} \ln \left(a^2\cos^2\theta +b^2\sin^2\theta\right) \,d\theta$$ where $a,b$ are finite natural numbers

I have spent about a day thinking over this problem. I tried integration by parts, differentiating under integral sign (Feynman's trick, with respect to $a, b$), using some trigonometric and logarithmic properties like changing $\cos^2\theta$ to $\cos2\theta$ and hereafter some logarithmic properties, etc., but failed miserably.

Also tried to use the property that $$\int_a^b f(x)\,dx=\int_a^b f(a+b-x)\,dx$$ in-between, but still to no avail. I also tried to find similar questions on MSE but did not get a related one.

Edit

My try (Feynman's trick) :

Let $$I(a)=\int_0^{\pi/2} \ln \left(a^2\cos^2\theta +b^2\sin^2\theta\right) d\theta$$

Hence $$I'(a) =\frac 1a \int_0^{\pi/2} \frac {2a^2\cos^2\theta d\theta}{a^2\cos^2\theta +b^2\sin^2\theta}$$ $$=\frac 1a\left[ \frac {\pi}{2}+\int_0^{\pi/2} \frac {a^2\cos^2\theta -b^2\sin^2\theta}{a^2\cos^2\theta +b^2\sin^2\theta}\right]$$

Wherein between I broke $2a^2\cos^2\theta=a^2\cos^2\theta +b^2\sin^2\theta+a^2\cos^2\theta -b^2\sin^2\theta$

But now how do I continue further

• Feynman's trick works like a charm here, can you show your attempt in full detail? Jun 12 '18 at 17:06
• I agree with Jack. Feynman's trick works here. Jun 12 '18 at 17:06
• "finite natural numbers" ? You can omit the "finite". Jun 12 '18 at 17:08
• @Jack D'Aurizio I have edited my try accordingly. Can you please provide some hints further or any different parameter of differentiation in the same method Jun 12 '18 at 17:15
• The integral $$\int_{0}^{\pi/2}\frac{a^2\cos^2\theta-b^2\sin^2\theta}{a^2\cos^2\theta+b^2\sin^2\theta}\,d\theta$$ can be simply computed through the substitution $\theta=\arctan u$ and partial fraction decomposition. It equals $\frac{\pi}{2}\cdot\frac{a-b}{a+b}$, assuming that $a$ and $b$ have the same sign. Jun 12 '18 at 17:15

Let $I(a,b)=\int_0^{\pi/2} \log(a^2\cos^2(\theta)+b^2\sin^2(\theta))\,d\theta$. Differentiating under the integral with respect to $a^2$ reveals

\begin{align} \frac{\partial I(a,b)}{\partial (a^2)}&=\int_0^{\pi/2}\frac{1}{a^2+b^2\tan^2(\theta)}\,d\theta\\\\ &=\frac{\pi/2}{a(a+b)}\tag1 \end{align}

Integrating $(1)$ with respect to $a^2$, we obtain

$$I(a,b)=\pi \log(a+b)+C$$

For $a=b$, $I(a,a)=\pi \log(a)$ from which we find that $C=-\pi\log(2)$.

Putting it all together yields

$$I(a,b)=\pi \log\left(\frac{a+b}2\right)$$

NOTE:

We see from symmetry that $I(a,b)=\pi \log\left(\frac{|a|+|b|}2\right)$ $\forall (a,b)\in \mathbb{R}^2\setminus (0,0)$.

• Now both of you( Mark and Jack) have put in trouble. Both of your answers are marvelous in its own way. So which one to accept. Jun 12 '18 at 17:28
• Nope. Correction here. It is also applicable for $ab=0$ except for the case $a=b=0$ Jun 12 '18 at 17:37
• @Manthanein Good catch. I'll edit. Jun 12 '18 at 17:41
• Try $b=0$ and $a$ be some finite number. Now the integrals changes to $$\int_0^{\pi/2} \ln(a^2\cos^2\theta )d\theta=2\int_0^{\pi/2} \ln(a\cos\theta )d\theta=2\left[\frac {\pi}{2}\ln a-\frac {\pi}{2}\ln 2\right]=\pi\ln (a/2)$$ which matches with the general form you derived Jun 12 '18 at 17:44
• @Manthanein It should match, should it not? Jun 12 '18 at 17:45

If we assume $a,b>0$ and set $$I(a,b)=\int_{0}^{\pi/2}\log(a^2\cos^2\theta+b^2\sin^2\theta)\,d\theta$$ we have $I(a,b)=I(b,a)$ from the substitution $\theta\mapsto\frac{\pi}{2}-\theta$. On the other hand $I(a,a)=\pi\log(a)$ is trivial, so $I(a,b)=\pi\log\left(\frac{a+b}{2}\right)$ is a very reasonable conjecture. Indeed, it can be proved by computing $$\frac{\partial I}{\partial a} = \int_{0}^{\pi/2}\frac{2a\cos^2\theta}{a^2\cos^2\theta+b^2\sin^2\theta}\,d\theta$$ as suggested in the comments, i.e. via $\theta\mapsto\arctan u$ and partial fraction decomposition.

An alternative approach is to notice that $$\begin{eqnarray*} I(a,b) &=& 2\,\text{Re}\int_{0}^{\pi/2}\log\left(a\cos\theta+ib\sin\theta\right)\\&=&\pi\log\left(\frac{a+b}{2}\right)+\text{Re}\int_{0}^{\pi}\log\left(e^{i\theta}+\frac{a-b}{a+b}\right)\,d\theta\end{eqnarray*}$$ where the last integral is a purely imaginary number by the residue theorem.

• Now both of you( Mark and Jack) have put in trouble. Both of your answers are marvelous in its own way. So which one to accept. Jun 12 '18 at 17:28
• And by the way no need to assume $a, b\gt 0$, it's already provided in in question that they are natural numbers Jun 12 '18 at 17:30
• @Manthanein We need not assume that $a$ and $b$ are positive. Note that since the integral depends on $a^2$ and $b^2$, then the answer depends on $|a|$ and $|b|$ only. Jun 12 '18 at 17:32
• @Mark Viola That is what I said. Morever the modulus will be removed since they are natural and always positive Jun 12 '18 at 17:34