Feynman's Trick (6): Two Exercises from a Textbook

Our textbook on Mathematical Analysis contains two rather interesting definite integrals which, as it turns out, can be tackled using Feynman's trick.

$$\begin{aligned}\int_0^1 \frac{\ln(1+x)}{1+x^2}dx \\ \int_0^{\pi} \frac{x \sin x}{1+\cos^2 x}dx\end{aligned}$$

No.1more

Let's start with the first one. Actually the approach here is fairly obvious: once we differentiate the logarithmic function, it turns into a rational-function form, and there's a standard way of dealing with integrals of that type. So we have:

$$\begin{aligned}F(a)=\int_0^1 \frac{\ln(1+ax)}{1+x^2}dx \\ F'(a)=\int_0^1 \frac{x}{(1+ax)(1+x^2)}dx=\int_0^1 \frac{1}{1+a^2}(\frac{-a}{1+ax}+\frac{x+a}{1+x^2})dx \\ =-\frac{\ln(1+a)}{1+a^2}+\frac{\ln 2}{2}(\frac{1}{1+a^2})+\frac{\pi}{4} \frac{a}{1+a^2}\end{aligned}$$

Next we integrate with respect to a, and it's easy to see that $F(0)=0$, so

$$F(a)=\int_0^a -\frac{\ln(1+t)}{1+t^2}dt + \frac{\ln 2}{2} arctan(a)+\frac{\pi}{8}\ln(1+a)$$

Hence

$$\begin{aligned}F(1)=\int_0^1 -\frac{\ln(1+t)}{1+t^2}dt + \frac{\pi}{4}\ln 2 \\ =-F(1)+ \frac{\pi}{4}\ln 2\end{aligned}$$

So $F(1)=\frac{\pi}{8}\ln 2$.

No.2

For the second integral, the author (who happens to be our analysis teacher) gave a clever solution that makes heavy use of the symmetry of trigonometric functions — well worth studying and imitating. The original proof will be given at the end. Let's first explore how to solve it with Feynman's trick.

We have:

$$\int_0^{\pi} \frac{x \sin x}{1+\cos^2 x}dx=-\int_0^{\pi} \frac{x}{1+\cos^2 x}d(\cos x)$$

If only the lone term x could, after differentiation, also become a function of $\cos x$, this would reduce to an ordinary polynomial integral. That's easy enough — let $x=\arccos(a \cos x)$, i.e.,

$$F(a)=-\int_0^{\pi} \frac{\arccos(a \cos x)}{1+\cos^2 x}d(\cos x)$$

Wait, that's not right. x ranges over $[0,\pi]$, but the range of $[-\frac{\pi}{2},\frac{\pi}{2}]$ is not the same, so clearly these don't match up. We need to make a small correction:

$$F(a)=-\int_0^{\frac{\pi}{2}} \frac{\arccos(a \cos x)}{1+\cos^2 x}d(\cos x)-\int_{\frac{\pi}{2}}^{\pi} \frac{\arccos(a \cos x)+\frac{\pi}{2}}{1+\cos^2 x}d(\cos x)$$

That is,

$$F(a)=-\int_0^{\pi} \frac{\arccos(a \cos x)}{1+\cos^2 x}d(\cos x)- \frac{\pi}{2}\int_{\frac{\pi}{2}}^{\pi}\frac{1}{1+\cos^2 x}d(\cos x)$$

The second term on the right-hand side is easy to integrate, giving $-\frac{\pi^2}{4}$. The key part is the integral on the left-hand side:

$$f(a)=-\int_0^{\pi} \frac{\arccos(a \cos x)}{1+\cos^2 x}d(\cos x)$$

Differentiating gives

$$\begin{aligned}f'(a)=-\int_0^{\pi} \frac{\cos x}{\sqrt{1-a^2 \cos^2 x}(1+\cos^2 x)}d(\cos x) \\ =-\frac{1}{2} \int_0^{\pi} \frac{1}{\sqrt{1-a^2 \cos^2 x}(1+\cos^2 x)}d(\cos^2 x)\end{aligned}$$

Let $t=\cos^2 x$, and this becomes:

$$f'(a)=-\frac{1}{2}\int_1^1 \frac{1}{\sqrt{1-a^2 t}(1+t)}dt$$

Since the upper and lower limits of integration are equal, the value of the integral is clearly 0!! So $f(a)$ is a constant independent of a, and using

$$f(o)=-\frac{\pi}{2}\int_0^{\pi} \frac{1}{1+\cos^2 x}d(\cos x)=\frac{\pi^2}{2}$$

we obtain $f(a)=\frac{\pi^2}{2}$.

Therefore $F(1)=F(a)=f(a)-\frac{\pi^2}{4}=\frac{\pi^2}{4}$.

Neat, isn't it? This is exactly where symmetry comes into play — and Feynman's trick can still claim its share of the credit!

Appendix: the textbook's solution

$$I=\int_0^{\pi} \frac{x \sin x}{1+\cos^2 x}dx$$

Let $x=\pi-t$, then

$$\begin{aligned}I=\int_{\pi}^0 \frac{(\pi-t) \sin (\pi-t) }{1+\cos^2 (\pi-t)}d(\pi-t) \\ =\int_0^{\pi} \frac{\pi \sin t }{1+\cos^2 t}dt-\int_0^{\pi} \frac{t \sin t }{1+\cos^2 t}dt \\ =\frac{\pi^2}{2}-I\end{aligned}$$

So $I=\frac{\pi^2}{4}$.

English translation of a post from 科学空间 | Scientific Spaces by 苏剑林. Original: https://kexue.fm/archives/1944
Translated automatically with claude-sonnet-5; all equations are reproduced verbatim from the source. Copyright remains with the original author.