# Integral inequalities (6)

Problem. Let $f: [a,b] \longrightarrow \mathbb{R}$ be a continuously differentiable function and suppose that $\displaystyle \int_a^bf(x) \ dx=0.$ Show that

$\displaystyle \int_a^b(f(x))^2dx \le \frac{(b-a)^2}{2}\int_a^b(f'(x))^2 dx.$

Solution. Let

$\displaystyle g(x):=\int_a^x f(t) \ dt, \ \ \ x \in [a,b].$

Then $\displaystyle \int_a^b(f(x))^2dx=\int_a^bf(x)g'(x) \ dx$ and so integration by parts with $f(x)=u, \ \ g'(x) \ dx=dv$ together with the fact that $g(a)=g(b)=0,$ give

$\displaystyle \int_a^b(f(x))^2dx=-\int_a^bf'(x)g(x) \ dx.$

Thus, by Cauchy-Schwarz,

$\displaystyle \left(\int_a^b(f(x))^2dx\right)^2=\left(\int_a^bf'(x)g(x) \ dx\right)^2 \le \int_a^b(f'(x))^2dx \int_a^b(g(x))^2dx. \ \ \ \ \ \ \ \ \ \ (1)$

On the other hand, by Cauchy-Schwarz again,

$\displaystyle (g(x))^2=\left(\int_a^xf(t) \ dt\right)^2 \le \int_a^x(f(t))^2dt \int_a^xdt \le (x-a)\int_a^b(f(t))^2dt$

and hence

$\displaystyle \int_a^b(g(x))^2dx \le \int_a^b(x-a) \ dx \int_a^b(f(t))^2dt=\frac{(b-a)^2}{2}\int_a^b(f(t))^2dt. \ \ \ \ \ \ \ \ \ (2)$

The result now follows from $(1),(2). \ \Box$

Exercise 1. Explain why, in the solution of the above problem, the result follows from $(1),(2) ?$
Hint. If $\displaystyle \int_a^b(f(x))^2 dx=0,$ then $f(x)=0$ for all $x \in [a,b].$

Exercise 2. Let $f: [a,b] \longrightarrow \mathbb{R}$ be a continuously differentiable function and suppose that $\displaystyle f(a)f(b)=0.$ Show that

$\displaystyle \int_a^b(f(x))^2dx \le \frac{(b-a)^2}{2}\int_a^b(f'(x))^2 dx.$

Hint. If $f(a)=0,$ then

$\displaystyle (f(x))^2=\left(\int_a^xf'(t) \ dt\right)^2 \le \int_a^x(f'(t))^2dt \int_a^xdt.$

Exercise 3. This exercise generalizes the above problem. Let $f: [a,b] \longrightarrow \mathbb{R}$ be a continuously differentiable function. Show that

$\displaystyle \int_a^b(f(x))^2dx \le \frac{1}{b-a}\left(\int_a^bf(x) \ dx\right)^2+\frac{(b-a)^2}{2}\int_a^b(f'(x))^2 dx.$

Hint. Apply the result given in the problem to the function

$\displaystyle F(x):=f(x)-\frac{1}{b-a}\int_a^bf(x) \ dx.$

Exercise 4. Prove the inequality given in Exercise 3 for $f(x):=\tan^{-1}x, \ \ x \in [0,1],$ i.e. by evaluating each integral, show that

$\displaystyle \int_0^1(\tan^{-1}x)^2 dx \le \left(\int_0^1\tan^{-1}x \ dx\right)^2+\frac{1}{2}\int_0^1\frac{dx}{(x^2+1)^2}.$

# If lim (ra_{n+1}-a_n)=L, then lim a_n=L/(r-1)

Problem. Let $\{a_n\}$ be a sequence of real numbers and let $r$ be a real constant.
Show that if $|r| > 1$ and $\displaystyle \lim_{n\to\infty}(ra_{n+1}-a_n)=\ell,$ for some real number $\ell,$ then $\displaystyle \lim_{n\to\infty}a_n=\frac{\ell}{r-1}.$

Solution. Let

$\displaystyle b_n:=a_n-\frac{\ell}{r-1}.$

We are given that $\displaystyle \lim_{n\to\infty}(rb_{n+1}-b_n)=0$ and we want to show that $\displaystyle \lim_{n\to\infty}b_n=0.$ Using telescoping sum, we can write

$\displaystyle b_n=\sum_{k=1}^{n-1}\frac{1}{r^k}(rb_{n-k+1}-b_{n-k})+\frac{b_1}{r^{n-1}}. \ \ \ \ \ \ \ \ \ \ \ (1)$

Let $\epsilon > 0$ be given. Since $\displaystyle \lim_{n\to\infty}(rb_{n+1}-b_n)=0,$ there exist an integer $N > 0$ and $M \ge 0$ such that

\begin{aligned}|rb_{n+1}-b_n| < \epsilon, \ \ \ \ \forall n \ge N \ \ \ \ \ \ \ \ \ (2), \\ \\ |rb_{n+1}-b_n| \le M, \ \ \ \ \forall n \ \ \ \ \ \ \ \ \ \ (3).\end{aligned}

Since $|r| > 1,$ we can choose $N$ large enough to also have

$\displaystyle \frac{1}{|r|^N} < \epsilon. \ \ \ \ \ \ \ \ \ \ \ (4)$

Now, by $(1),$ for $n \ge 2N$ we have

\displaystyle \begin{aligned}|b_n|=\left|\sum_{k=1}^N \frac{1}{r^k}(rb_{n-k+1}-b_{n-k})+\sum_{k=N+1}^{n-1}\frac{1}{r^k}(rb_{n-k+1}-b_{n-k})+\frac{b_1}{r^{n-1}}\right| \\ \le \sum_{k=1}^N \frac{1}{|r|^k}|rb_{n-k+1}-b_{n-k}|+\sum_{k=N+1}^{n-1}\frac{1}{|r|^k}|rb_{n-k+1}-b_{n-k}|+\frac{|b_1|}{|r|^{n-1}} \\ < \epsilon \sum_{k=1}^N \frac{1}{|r|^k}+M\sum_{k=N+1}^{n-1}\frac{1}{|r|^k}+\frac{|b_1|}{|r|^{n-1}}, \ \ \ \ \ \ \ \ \ \ \text{by} \ (2), (3) \\ < \epsilon\sum_{k=1}^{\infty}\frac{1}{|r|^k}+M\sum_{k=N+1}^{\infty}\frac{1}{|r|^k}+\frac{|b_1|}{|r|^N} \\ =\frac{\epsilon}{|r|-1}+\frac{M}{|r|^N(|r|-1)}+\frac{|b_1|}{|r|^N} < \left(\frac{M+1}{|r|-1}+|b_1|\right)\epsilon, \ \ \ \ \ \ \ \text{by} \ (4),\end{aligned}

and so $\displaystyle \lim_{n\to\infty}b_n=0. \ \Box$

Exercise 1. The result given in the above problem is obviously true for $r=0.$ Show that the result is not necessarily true for $0 \ne |r| \le 1.$
Hint. For example, consider the sequence $\displaystyle a_n:=\frac{1}{r^n}.$

Exercise 2. Let’s take a closer look at the case $r=1$ in the above problem. Let $\displaystyle \lim_{n\to\infty}(a_{n+1}-a_n)=\ell$ for some real number $\ell.$ What are the possible values of $\displaystyle \lim_{n\to\infty}a_n ?$ Give an example for each possible value of $\displaystyle \lim_{n\to\infty}a_n.$
Hint. Consider two cases: $\ell=0$ and $\ell \ne 0.$ You might find Stolz–Cesàro helpful.

Exercise 3. Let $\{a_n\}$ be a sequence of real numbers and let $r$ be a real constant. If $\displaystyle \lim_{n\to\infty}(ra_{n+1}-a_n)=\pm \infty,$ then what can we say about $\displaystyle \lim_{n\to\infty}a_n ?$

# Jensen’s inequality (1)

I will discuss a more general case of Jensen’s inequality in the second part of this post but for now let’s see a special case of the inequality which also gives the main idea of the proof for the general case.

Problem. Let $\displaystyle f: [a,b] \longrightarrow (0,\infty)$ be a continuous function. Show that

$\displaystyle \ln\left(\frac{1}{b-a}\int_a^b f(x) \ dx \right) \ge \frac{1}{b-a}\int_a^b \ln(f(x)) \ dx$

with equality if and only if $f$ is constant.

Solution. If $f$ is constant, then it’s clear that

$\displaystyle \ln\left(\frac{1}{b-a}\int_a^b f(x) \ dx \right) = \frac{1}{b-a}\int_a^b \ln(f(x)) \ dx=\ln(f(x)).$

So suppose that $f$ is not constant. Let

$\displaystyle c:= \frac{1}{b-a}\int_a^b f(x) \ dx, \ \ \ h(x):=f(x)-c$

and see that

$\displaystyle \int_a^b h(x) \ dx = 0.$

Now, we have

\displaystyle \begin{aligned} \ln(f(x))= \ln(h(x)+c)=\ln c + \ln \left(\frac{1}{c}h(x)+1\right) \le \ln c + \frac{1}{c}h(x). \end{aligned} \ \ \ \ \ \ \ \ \ (*)

Since the only solution of $\ln(t+1)=t$ is $t=0,$ the inequality in $(*)$ becomes equality only for those $x$ for which $h(x)=0.$ Since $f$ is not a constant function, $h$ is not identically zero on $[a,b]$ and so the inequality in $(*)$ is not equality for all $x \in [a,b].$ Thus integrating $(*)$ gives

$\displaystyle \int_a^b \ln(f(x)) \ dx < (b-a)\ln c +\frac{1}{c}\int_a^b h(x) \ dx = (b-a)\ln c$

and the result follows. $\Box$

Example. Since $e^{-x^2}$ is decreasing for $x > 0,$ it is clear that $\displaystyle \int_0^t e^{-x^2}dx > te^{-t^2}$ for all $t > 0.$ Find the smallest real number $\alpha$ such that $\displaystyle \int_0^t e^{-x^2}dx > te^{-\alpha t^2}$ for all $t > 0.$

Solution. Applying Jensen’s inequality to $f(x):=e^{-x^2}$ on the interval $[0,t]$ we have

\displaystyle \begin{aligned} -\ln t+\ln\left(\int_0^te^{-x^2}dx\right)=\ln\left(\frac{1}{t}\int_0^te^{-x^2} dx\right) > \frac{1}{t}\int_0^t\ln(e^{-x^2}) \ dx = -\frac{t^2}{3}\end{aligned}

and thus

$\displaystyle \int_0^te^{-x^2}dx > te^{-t^2/3}. \ \ \ \ \ \ \ \ \ \ \ (\dagger)$

Now suppose that $\alpha$ satisfies the inequality $\displaystyle \int_0^t e^{-x^2}dx > te^{-\alpha t^2}$ for all $t > 0.$ Then, using the power series expansion of $e^{-x^2},$ we have

$\displaystyle t-\frac{t^3}{3}+\frac{t^5}{10}- \cdots > t\left(1-\alpha t^2+\frac{\alpha^2t^4}{2} - \cdots \right),$

which gives

$\displaystyle \frac{1}{3}-\frac{t^2}{10} + \cdots < \alpha - \frac{\alpha^2t^2}{2} + \cdots$

and so, letting $t \to 0^+,$ we get $\displaystyle \alpha \ge \frac{1}{3}.$ Hence, by $\displaystyle (\dagger), \ \alpha=\frac{1}{3}$ is the smallest real number for which the inequality $\displaystyle \int_0^t e^{-x^2}dx > te^{-\alpha t^2}$ holds for all $t > 0. \ \Box$

# Limit of a seemingly complicated sequence

Problem. Given real number $x > 0$ and positive integer $n,$ consider the sequence $\{f_j\}$ defined by

$\displaystyle f_0=x+\frac{\sqrt{x}}{n}, \ \ \ f_{j+1}=f_j + \frac{\sqrt{f_j}}{n}, \ \ \ \ j \ge 0.$

Show that $\displaystyle \lim_{n\to\infty}f_n=x+\sqrt{x}+\frac{1}{4}.$

Solution. Since

$\displaystyle f_{j+1}=\left(\sqrt{f_j}+\frac{1}{2n}\right)^2-\frac{1}{4n^2} < \left(\sqrt{f_j}+\frac{1}{2n}\right)^2,$

we have $\displaystyle \sqrt{f_{j+1}} - \sqrt{f_j} < \frac{1}{2n}$ and so

$\displaystyle \sqrt{f_n}-\sqrt{f_0}=\sum_{j=0}^{n-1}(\sqrt{f_{j+1}}-\sqrt{f_j}) < \frac{1}{2}.$

Thus

$\displaystyle \sqrt{f_n} < \sqrt{f_0}+\frac{1}{2}. \ \ \ \ \ \ \ \ (1)$

On the other hand, by the definition of $f_j,$

\displaystyle \begin{aligned} \sqrt{f_j}=\frac{-1+\sqrt{1+4n^2f_{j+1}}}{2n}=-\frac{1}{2n}+\sqrt{f_{j+1}}\sqrt{1+\frac{1}{4n^2f_{j+1}}} < -\frac{1}{2n}+\sqrt{f_{j+1}}\left(1+\frac{1}{4n^2f_{j+1}}\right) \\ =-\frac{1}{2n}+\sqrt{f_{j+1}}+\frac{1}{4n^2\sqrt{f_{j+1}}}< -\frac{1}{2n}+\sqrt{f_{j+1}}+\frac{1}{4n^2\sqrt{x}},\end{aligned} \ \ \ \ \ \ \ \ \ (2)

because it is clear from the definition of $f_j$ that $f_j > x$ for all $j.$
So, by $\displaystyle (2), \ \sqrt{f_{j+1}}-\sqrt{f_j} > \frac{1}{2n}-\frac{1}{4n^2\sqrt{x}}$ and hence

$\displaystyle \sqrt{f_n}-\sqrt{f_0}=\sum_{j=0}^{n-1}(\sqrt{f_{j+1}}-\sqrt{f_j}) > \frac{1}{2}-\frac{1}{4n\sqrt{x}},$

which gives

$\displaystyle \sqrt{f_n} > \sqrt{f_0}+\frac{1}{2}-\frac{1}{4n\sqrt{x}}. \ \ \ \ \ \ \ \ (3)$

It now follows from $(1), (3)$ and the squeeze theorem that

$\displaystyle \lim_{n\to\infty} \sqrt{f_n}=\lim_{n\to\infty} \sqrt{f_0}+\frac{1}{2}=\sqrt{x}+\frac{1}{2}$

and therefore $\displaystyle \lim_{n\to\infty} f_n=\left(\sqrt{x}+\frac{1}{2}\right)^2=x+\sqrt{x}+\frac{1}{4}. \ \Box$

# Integral of (sin^n(x)+cos^n(x))/(sin(x)+cos(x)+1)

Problem. Given integer $n \ge 1,$ show that

$\displaystyle \int_0^{\pi/2} \frac{\sin^nx+\cos^nx}{\sin x + \cos x + 1} \ dx=\begin{cases}\frac{1}{(n-1)a_{\frac{n-2}{2}}}- \sum_{k=1}^{n-1}\frac{(-1)^{k+1}}{n-k}+\ln 2 \ \ \ \ \ \ \ \text{if} \ n \ \text{is even} \\ \\ \frac{\pi}{2}a_{\frac{n-1}{2}}-\sum_{k=1}^{n-1}\frac{(-1)^{k+1}}{n-k}-\ln 2 \ \ \ \ \ \ \ \text{if} \ n \ \text{is odd}, \end{cases}$

where $\displaystyle a_m:=\frac{\binom{2m}{m}}{4^m}$ for integers $m \ge 0.$

Solution. Let

$\displaystyle I_n:=\int_0^{\pi/2} \frac{\sin^nx + \cos^n x}{\sin x + \cos x + 1} \ dx$

and see that

\displaystyle \begin{aligned}I_n=\int_0^{\pi/2}\frac{(\sin^nx + \cos^n x)(\sin x + \cos x - 1)}{2\sin x \cos x} \ dx=\int_0^{\pi/2}\sin^{n-1}x \ dx - \int_0^{\pi/2} \frac{\sin^{n-1}x - \sin^nx}{\cos x} \ dx.\end{aligned}

So if we let

$\displaystyle J_n:=\int_0^{\pi/2}\sin^{n-1}x \ dx, \ \ \ \ K_n:=\int_0^{\pi/2} \frac{\sin^{n-1}x - \sin^nx}{\cos x} \ dx,$

then

$\displaystyle I_n=J_n - K_n. \ \ \ \ \ \ \ (1)$

We showed here that $\displaystyle \int_0^{\pi/2} \sin^{2m}x \ dx = \frac{\pi}{2}a_m$ and $\displaystyle \int_0^{\pi/2} \sin^{2m+1}x \ dx=\frac{1}{(2m+1)a_m}.$ So

$\displaystyle J_n=\begin{cases} \frac{1}{(n-1)a_{\frac{n-2}{2}}} \ \ \ \ \ \ \text{if} \ n \ \text{is even} \\ \frac{\pi}{2}a_{\frac{n-1}{2}} \ \ \ \ \ \ \ \text{if} \ n \ \text{is odd}. \end{cases} \ \ \ \ \ \ \ (2)$

We also have

\displaystyle \begin{aligned}K_n=\int_0^{\pi/2} \frac{\sin^{n-1}x(1-\sin x)}{\cos x} \ dx=\int_0^{\pi/2} \frac{\sin^{n-1}x \cos x}{1+\sin x} \ dx = \int_0^1 \frac{y^{n-1}}{1+y} \ dy, \ \ \ \ \ y=\sin x, \\ =\int_0^1 \left(y^{n-2}-y^{n-3} + \cdots + (-1)^n + \frac{(-1)^{n+1}}{y+1}\right)dy \\ =\frac{1}{n-1}-\frac{1}{n-2}+\cdots + (-1)^n + (-1)^{n+1}\ln 2=\sum_{k=1}^{n-1}\frac{(-1)^{k+1}}{n-k}+(-1)^{n+1}\ln 2.\end{aligned} \ \ \ \ \ \ \ \ \ (3)

The result now follows from $(1), (2), (3). \ \Box$

Example. So

\displaystyle \begin{aligned}\int_0^{\pi/2} \frac{\sin^8x+\cos^8x}{\sin x + \cos x + 1} \ dx=\frac{1}{7a_3}-\sum_{k=1}^7\frac{(-1)^{k+1}}{8-k}+\ln 2=\ln 2 - \frac{127}{420}\end{aligned}

and

\displaystyle \begin{aligned}\int_0^{\pi/2} \frac{\sin^9x+\cos^9x}{\sin x + \cos x + 1} \ dx=\frac{\pi}{2}a_4 - \sum_{k=1}^8 \frac{(-1)^{k+1}}{9-k}-\ln 2=\frac{35 \pi}{256}+\frac{533}{840}-\ln 2.\end{aligned}

# Integral of ln(x)/((x-1)(x+a))

Problem. Given a real constant $a > 0,$ show that

i) $\displaystyle \int_0^1 \left(\frac{1}{x+a}+\frac{a}{1+ax}\right)\ln x \ dx = -\frac{\pi^2}{6}-\frac{1}{2}(\ln a)^2$

ii) $\displaystyle \int_0^{\infty}\frac{\ln x}{(x-1)(x+a)} \ dx=\frac{\pi^2+(\ln a)^2}{2(a+1)}.$

Solution. i) Let

$\displaystyle f(a):=\int_0^1 \left(\frac{1}{x+a}+\frac{a}{1+ax}\right)\ln x \ dx$

and write

$\displaystyle f(a)=\int_0^1 \frac{\ln x}{x+a} \ dx + \int_0^1 \frac{a \ln x}{1+ax} \ dx.$

Now in the first integral on the right-hand side of the above , change $x$ to $ax$ and in the second integral, change $ax$ to $x$ to get

$\displaystyle f(a)=-(\ln a)^2+\int_0^{1/a} \frac{\ln x}{x+1} \ dx + \int_0^a \frac{\ln x}{x+1} \ dx.$

Thus differentiating with respect to $a$ gives $\displaystyle f'(a)=-\frac{\ln a}{a}$ and hence integrating gives

$\displaystyle f(a)=-\frac{1}{2}(\ln a)^2 + C, \ \ \ \ \ \ \ \ \ \ \ (*)$

for some constant $C.$ But since, by the definition of $f,$

$\displaystyle f(1)=2\int_0^1 \frac{\ln x}{x+1} \ dx = -\frac{\pi^2}{6},$

we have, by $\displaystyle (*), \ C=f(1)=-\frac{\pi^2}{6}$ and hence $\displaystyle f(a)=-\frac{\pi^2}{6}-\frac{1}{2}(\ln a)^2.$

ii) Write

$\displaystyle \int_0^{\infty}\frac{\ln x}{(x-1)(x+a)} \ dx=\int_0^1 \frac{\ln x}{(x-1)(x+a)} \ dx+\int_1^{\infty}\frac{\ln x}{(x-1)(x+a)} \ dx$

and so after changing $x$ to $\displaystyle \frac{1}{x}$ in the second integral on the right-hand side of the above, we get

\displaystyle \begin{aligned}\int_0^{\infty}\frac{\ln x}{(x-1)(x+a)} \ dx= \int_0^1 \frac{\ln x}{(x-1)(x+a)} \ dx+\int_0^1 \frac{\ln x}{(x-1)(1+ax)} \ dx \\ =\frac{2}{a+1}\int_0^1 \frac{\ln x}{x-1} \ dx- \frac{1}{a+1}\int_0^1\left(\frac{1}{x+a}+\frac{a}{1+ax}\right) \ln x \ dx \\ =\frac{\pi^2}{3(a+1)}-\frac{1}{a+1}\int_0^1\left(\frac{1}{x+a}+\frac{a}{1+ax}\right) \ln x \ dx=\frac{\pi^2+(\ln a)^2}{2(a+1)},\end{aligned}

by i). $\Box$

Exercise 1. In the solution of the above problem, we used the identities

$\displaystyle \int_0^1 \frac{\ln x}{x-1} \ dx = \frac{\pi^2}{6}, \ \ \ \ \int_0^1 \frac{\ln x}{x+1} \ dx =-\frac{\pi^2}{12}$

without proving them. Prove them!
Hint. Make the substitution $\ln x = -t$ and then see Problem 2 in this post!

Exercise 2. In the solution of the first part of the above problem, I claimed, without proof, that $\displaystyle f'(a)=-\frac{\ln a}{a}.$ Prove the claim!

Exercise 3. Using convergence tests, show that $\displaystyle \int_0^{\infty}\frac{\ln x}{(x-1)(x+a)} \ dx$ is convergent for all real constants $a > 0.$

# Bounds for the integral of (sin(x))^(sin(x)) on the interval [0,pi/2]

Problem. Show that

$\displaystyle 1.26 < \int_0^{\pi/2}(\sin x)^{\sin x} dx < 1.31.$

Solution. Since $(\sin x)^{\sin x}=e^{\sin x \ln(\sin x)}$ and

$\displaystyle 1+t \le e^t \le 1+t+\frac{t^2}{2},$

for all $t \le 0,$ by Taylor’s theorem, we have

$\displaystyle 1+\sin x \ln(\sin x) \le (\sin x)^{\sin x} \le 1+ \sin x \ln(\sin x) +\frac{1}{2}(\sin x \ln(\sin x))^2, \ \ \ \ \ \ \ \ \ \ (1)$

for all $x \in (0,\pi/2].$ Now let

\displaystyle \begin{aligned} I:=\int_0^{\pi/2}(\sin x)^{\sin x} \ dx, \ \ J:=\int_0^{\pi/2}\sin x \ln(\sin x) \ dx, \ \ \ K:=\int_0^{\pi/2}(\sin x \ln(\sin x))^2 dx.\end{aligned}

So by $(1),$

$\displaystyle \frac{\pi}{2}+J \le I \le \frac{\pi}{2} + J+\frac{1}{2}K. \ \ \ \ \ \ \ \ \ (2)$

So we need to find $J$ and $K.$ Let’s find $J$ first.

We (carefully) use integration by parts with $\sin x \ dx = dv$ and $\ln(\sin x) = u.$ Then $v=1-\cos x$ and $\displaystyle du=\frac{\cos x}{\sin x} \ dx$ and thus

\displaystyle \begin{aligned}J=-\int_0^{\pi/2}\frac{\cos x(1-\cos x)}{\sin x} \ dx=-\int_0^{\pi/2}\frac{\cos x \sin x}{1+\cos x} \ dx=-\int_0^1\frac{x}{1+x} \ dx=\ln 2 -1.\end{aligned} \ \ \ \ \ \ (3)

So, by $(2),$

$\displaystyle I \ge \frac{\pi}{2}+J=\frac{\pi}{2}+\ln 2 - 1 \approx 1.2639 > 1.26.$

Now we find $K.$ Using integration by parts with $\sin^2x \ dx = dv, \ (\ln(\sin x))^2 = u,$ we have $\displaystyle v=\frac{1}{2}(x-\sin x \cos x)$ and $du=2\cot x \ln(\sin x) \ dx$ and hence

\displaystyle \begin{aligned}K=\int_0^{\pi/2}(-x+\sin x \cos x) \cot x \ln(\sin x) \ dx.\end{aligned}

So if we put

$\displaystyle K_1:=\int_0^{\pi/2}\cos^2x \ln(\sin x) \ dx, \ \ \ \ K_2:= \int_0^{\pi/2} x \cot x \ln(\sin x) \ dx,$

then

$K=K_1-K_2. \ \ \ \ \ \ \ \ \ \ (4)$

To find $K_1,$ we use integration by parts again with $\cos^2x \ dx = dv, \ u=\ln(\sin x)$ to get

$\displaystyle K_1=-\frac{1}{2}\int_0^{\pi/2}(x \cot x + \cos^2 x) \ dx=-\frac{\pi}{8}-\frac{1}{2}\int_0^{\pi/2}x \cot x \ dx.$

Again, integration by parts with $\cot x \ dx = dv, \ x=u$ together with the fact that $\displaystyle \int_0^{\pi/2}\ln(\sin x) \ dx = -\frac{\pi}{2}\ln 2$ (see this post!) give $\displaystyle \int_0^{\pi/2}x \cot x \ dx = \frac{\pi}{2}\ln 2$ and so

$\displaystyle K_1=-\frac{\pi}{8}-\frac{\pi}{4}\ln 2. \ \ \ \ \ \ \ \ \ \ (5)$

And finally, to evaluate $K_2,$ we use integration by parts again, this time with $\cot x \ln(\sin x) \ dx = dv$ and $x =u$ to get

$\displaystyle K_2=-\frac{1}{2}\int_0^{\pi/2}(\ln(\sin x))^2 \ dx = -\frac{\pi^3}{48}-\frac{\pi}{4}(\ln 2)^2. \ \ \ \ \ \ \ \ \ \ (6)$

For two proofs of the identity $\displaystyle \int_0^{\pi/2}(\ln(\sin x))^2 \ dx = \frac{\pi^3}{24}+\frac{\pi}{2}(\ln 2)^2,$ see this post!

So by $(4),(5)$ and $(6),$

$\displaystyle K=K_1-K_2=-\frac{\pi}{8}-\frac{\pi}{4}\ln 2+\frac{\pi^3}{48}+\frac{\pi}{4}(\ln 2)^2 \ \ \ \ \ \ \ \ \ (7)$

and thus, by $(2), (3), (7)$

\displaystyle \begin{aligned} I \le \frac{\pi}{2} + J+\frac{1}{2}K=\frac{7\pi}{16}-1+\ln 2 -\frac{\pi}{8}\ln 2+\frac{\pi}{8}(\ln 2)^2+\frac{\pi^3}{96} \approx 1.307 < 1.31. \ \Box\end{aligned}

Remark. According to Wolfram, $\displaystyle \int_0^{\pi/2}(\sin x)^{\sin x} dx \approx 1.302944.$

Exercise 1. Try to fully understand the integration by parts we used in the solution of the above problem to evaluate $J.$

Exercise 2. Show that $\displaystyle 2.52 < \int_0^{\pi}(\sin x)^{\sin x} dx < 2.62.$

# The alternating series \sum (-1)^n*ln(n)/n and the integral of ln(x)/(1+e^x)

Problem. Let $\gamma$ be the Euler’s constant. Show that

i) $\displaystyle 0 < n\left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right) < 1$ for all integers $n \ge 1$

ii) $\displaystyle \sum_{n=1}^{\infty} (-1)^n \ \frac{\ln n}{n}=\gamma \ln 2 - \frac{1}{2}(\ln 2)^2$

iii) $\displaystyle \int_0^{\infty} \frac{\ln x}{1+e^x} \ dx = -\frac{1}{2}(\ln 2)^2.$

Solution. i) Consider the sequences $\displaystyle a_n:=\sum_{k=1}^n \frac{1}{n+k}$ and $\displaystyle b_n:=a_n+\frac{1}{n}.$ Then

$\displaystyle a_{n+1}-a_n=\frac{1}{2n+1}+\frac{1}{2n+2}-\frac{1}{n+1}=\frac{1}{(2n+1)(2n+2)} > 0$

and

$\displaystyle b_{n+1}-b_n=\frac{1}{2n+1}+\frac{1}{2n+2}-\frac{1}{n}=-\frac{3n+2}{n(2n+1)(2n+2)} < 0.$

So $\{a_n\}$ is increasing, $\{b_n\}$ is decreasing and

$\displaystyle \lim_{n\to\infty}a_n=\lim_{n\to\infty}b_n=\lim_{n\to\infty}\frac{1}{n}\sum_{k=1}^n \frac{1}{1+\frac{k}{n}}=\int_0^1 \frac{dx}{1+x}=\ln 2.$

Thus $a_n < \ln 2 < b_n$ for all $n \ge 1$ and the result follows.

ii) We first need to show that the series converges. That is easy to see; differentiating shows that the function $\displaystyle y=\frac{\ln x}{x}$ is decreasing for $x \ge e$ and clearly $\displaystyle \lim_{x\to\infty}y=0,$ So the series converges by the alternating test.
Now let

$\displaystyle S:=\sum_{n=1}^{\infty} (-1)^n \ \frac{\ln n}{n}, \ \ \ S_n= \sum_{k=1}^n (-1)^k \ \frac{\ln k}{k}.$

Since $S$ converges, we have

$\displaystyle S=\lim_{n\to\infty} S_{2n}. \ \ \ \ \ \ \ \ \ \ (1)$

We also have

\displaystyle \begin{aligned} S_{2n}=\sum_{k=1}^{2n}(-1)^k \ \frac{\ln k}{k}=2\sum_{k=1}^n \frac{\ln(2k)}{2k}-\sum_{k=1}^{2n}\frac{\ln k}{k}=\sum_{k=1}^n \frac{\ln 2 + \ln k}{k}-\sum_{k=1}^{2n}\frac{\ln k}{k} \\ =\ln 2 \sum_{k=1}^n \frac{1}{k}-\sum_{k=n+1}^{2n}\frac{\ln k}{k}=\ln 2 \sum_{k=1}^n \frac{1}{k}-\sum_{k=1}^n \frac{\ln(n+k)}{n+k} \\ =\ln 2 \left(\sum_{k=1}^n \ \frac{1}{k} -\ln n\right)+ \ln n \ln 2 - \sum_{k=1}^n \frac{\ln n + \ln(1+\frac{k}{n})}{n+k} \\ = \ln 2 \left(\sum_{k=1}^n\frac{1}{k} -\ln n\right)+\ln n \left(\ln 2 - \sum_{k=1}^n \ \frac{1}{n+k}\right)-\frac{1}{n}\sum_{k=1}^n \frac{\ln(1+\frac{k}{n})}{1+\frac{k}{n}}\end{aligned}

and thus, by $(1),$

\displaystyle \begin{aligned} S=\ln 2 \lim_{n\to\infty}\left(\sum_{k=1}^n\frac{1}{k} -\ln n\right) + \lim_{n\to\infty}\ln n \left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right)-\lim_{n\to\infty} \frac{1}{n}\sum_{k=1}^n \frac{\ln(1+\frac{k}{n})}{1+\frac{k}{n}} \\ =\gamma \ln 2 + \lim_{n\to\infty}\ln n \left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right) - \int_0^1 \frac{\ln(1+x)}{1+x} \ dx \\ = \gamma \ln 2 + \lim_{n\to\infty}\ln n \left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right)-\frac{1}{2}(\ln 2)^2. \ \ \ \ \ \ \ (2) \end{aligned}

Finally, by the first part of the problem,

$\displaystyle 0 < \ln n \left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right) < \frac{\ln n}{n}$

and hence, by the squeeze theorem, $\displaystyle \lim_{n\to\infty}\ln n \left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right)=0.$ Therefore $\displaystyle S=\gamma \ln 2 - \frac{1}{2}(\ln 2)^2,$ by $(2).$

iii) We have

\displaystyle \begin{aligned} \int_0^{\infty} \frac{\ln x}{1+e^x} \ dx = \int_0^{\infty} \frac{e^{-x}\ln x}{1+e^{-x}} \ dx=\int_0^{\infty}e^{-x}\ln x \sum_{n=0}^{\infty}(-1)^ne^{-nx} \ dx \\ =\sum_{n=0}^{\infty}(-1)^n \int_0^{\infty}e^{-(n+1)x}\ln x \ dx=\sum_{n=0}^{\infty} \frac{(-1)^n}{n+1}\int_0^{\infty}e^{-x}\ln \left(\frac{x}{n+1}\right)dx \\ =\sum_{n=1}^{\infty}\frac{(-1)^n}{n+1}\left(\int_0^{\infty}e^{-x}\ln x \ dx - \ln(n+1) \int_0^{\infty}e^{-x} dx\right) \\ =\sum_{n=0}^{\infty}\frac{(-1)^n}{n+1}(-\gamma - \ln(n+1))=-\gamma \sum_{n=0}^{\infty}\frac{(-1)^n}{n+1}+\sum_{n=0}^{\infty}(-1)^{n+1} \ \frac{\ln(n+1)}{n+1} \\ =-\gamma \ln 2 +\sum_{n=1}^{\infty}(-1)^n \ \frac{\ln n}{n}=-\frac{1}{2}(\ln 2)^2, \ \ \ \ \text{by ii)}. \ \Box \end{aligned}

Remark. At the end of the solution of the second part of the above problem, we used the first part of the problem to prove that $\displaystyle \lim_{n\to\infty}\ln n \left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right)=0.$ That can also be done using the result we proved in this post. Here’s how. Let $\displaystyle f(x):=\frac{1}{1+x}$ and see that

$\displaystyle \ln n \left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right)=\frac{\ln n}{n} \ n\left(\int_0^1 f(x) \ dx - \frac{1}{n}\sum_{k=1}^n f\left(\frac{k}{n}\right) \right)$

and so

\displaystyle \begin{aligned} \lim_{n\to\infty} \ln n \left(\ln 2 - \sum_{k=1}^n \frac{1}{n+k}\right)=\lim_{n\to\infty} \frac{\ln n}{n} \cdot \frac{f(0)-f(1)}{2}=\lim_{n\to\infty} \frac{\ln n}{n} \cdot \frac{1}{4}=0.\end{aligned}

# Using IVT and MVT (4)

Problem. Let $\displaystyle f:[a,b] \longrightarrow \mathbb{R}$ be a continuous function which is differentiable on $(a,b).$ Suppose also that $f(a)=a, \ f(b)=b.$ Show that for any positive real numbers $r_1, \cdots , r_n,$ there exist distinct elements $x_1, \cdots , x_n \in (a,b)$ such that

$\displaystyle \sum_{i=1}^n \frac{r_i}{f'(x_i)}=\sum_{i=1}^n r_i.$

Solution. By the intermediate value theorem, for each $1 \le i \le n-1,$ there exists $c_i \in (a,b)$ such that

$\displaystyle f(c_i)=a+\frac{r_1+ \cdots r_i}{r_1+\cdots + r_n}(b-a), \ \ \ \ \ \ \ \ \ (1)$

because $f(a)=a, \ f(b)=b,$ and $\displaystyle a+\frac{r_1+ \cdots r_i}{r_1+\cdots + r_n}(b-a) \in (a,b),$ for all $1 \le i \le n-1.$
Let’s define $c_0:=a, \ c_n:=b.$ Notice that now $(1)$ holds for $0 \le i \le n.$ Also notice that, by relabeling $c_i$ if necessary, we may assume that $c_1 < c_2 < \cdots < c_{n-1}.$
Now, by the mean value theorem, for each $1 \le i \le n,$ there exists $x_i \in (c_{i-1},c_i)$ such that

$f(c_i)-f(c_{i-1})=(c_i-c_{i-1})f'(x_i). \ \ \ \ \ \ \ \ \ \ (2)$

We also have from $(1)$ that

$\displaystyle f(c_i)-f(c_{i-1})=\frac{r_i(b-a)}{r_1+ \cdots + r_n} \ \ \ \ \ \ \ \ \ \ (3)$

for all $1 \le i \le n.$ So, by $(2), (3),$

\displaystyle \begin{aligned}\sum_{i=1}^n \frac{r_i}{f'(x_i)}=\sum_{i=1}^n \frac{r_i(c_i-c_{i-1})}{f(c_i)-f(c_{i-1})}=\frac{r_1+ \cdots + r_n}{b-a}\sum_{i=1}^n(c_i-c_{i-1}) =\frac{r_1+ \cdots + r_n}{b-a}(c_n-c_0) \\ =\frac{r_1+ \cdots + r_n}{b-a}(b-a)=r_1+\cdots + r_n. \ \Box\end{aligned}

Remark. The result given in the above problem does not necessarily hold if $r_i$ are not all positive. For example, consider the function $f(x)=x^2, \ x \in [0,1],$ with $n=2$ and $r_1=1, \ r_2=-1.$ There are no $x_1 \neq x_2$ such that $\displaystyle \frac{1}{2x_1}-\frac{1}{2x_2}=0.$

Example. Let $f: [a,b] \longrightarrow \mathbb{R}$ be a continuous function such that $\displaystyle \int_a^b f(x) \ dx \ne 0.$ Show that for any positive real numbers $r_1, \cdots , r_n,$ there exist distinct elements $x_1, \cdots , x_n \in (a,b)$ such that

$\displaystyle \sum_{i=1}^n \frac{r_i}{f(x_i)}=\frac{b-a}{\int_a^bf(x) \ dx}\sum_{i=1}^nr_i.$

Solution. Let

$\displaystyle g(x):=a+\frac{b-a}{\int_a^bf(x) \ dx}\int_a^x f(t) \ dt, \ \ \ \ x \in [a,b].$

Then $g(a)=a, \ g(b)=b$ and $\displaystyle g'(x)=\frac{b-a}{\int_a^bf(x) \ dx}f(x).$ Now apply the result given in the above problem to $g. \ \Box$

# Limit of integrals (18)

The following problem looks weird at first but it’s really not. The problem basically comes from my (successful) attempt to prove the following nice-looking limit in multi-variable calculus

$\displaystyle \lim_{n\to\infty} \int_{0}^{1} \cdots \int_{0}^{1} \frac{x_1 + \cdots + x_n}{x_1^2 + \cdots + x_n^2} \ dx_1 \ \cdots \ dx_n=\frac{3}{2}.$

I have explained that in the remark below the problem.

Problem. Show that $\displaystyle \lim_{n\to\infty} n\int_0^{\infty}\frac{1-e^{-x^2}}{x^{n+1}}\left(\int_0^xe^{-t^2} dt \right)^n dx=\frac{3}{2}.$

Solution. First notice that, since $\displaystyle \int_0^{\infty}e^{-t^2}dt=\frac{\sqrt{\pi}}{2}$ (see this post!), we have

\displaystyle \begin{aligned} 0 < n\int_1^{\infty}\frac{1-e^{-x^2}}{x^{n+1}}\left(\int_0^x e^{-t^2} dt \right)^n dx < n \int_1^{\infty} \frac{1}{x^{n+1}}\left(\int_0^{\infty}e^{-t^2} dt \right)^n dt=\left(\frac{\sqrt{\pi}}{2}\right)^n.\end{aligned}

Hence, since $\displaystyle \frac{\sqrt{\pi}}{2} < 1,$ we get

$\displaystyle \lim_{n\to\infty} n\int_1^{\infty}\frac{1-e^{-x^2}}{x^{n+1}}\left(\int_0^x e^{-t^2} dt \right)^n dx=0,$

by the squeeze theorem, and thus

$\displaystyle \lim_{n\to\infty}n\int_0^{\infty}\frac{1-e^{-x^2}}{x^{n+1}}\left(\int_0^xe^{-t^2} dt\right)^n dx = \lim_{n\to\infty}n \int_0^1 \frac{1-e^{-x^2}}{x^{n+1}}\left(\int_0^x e^{-t^2} dt \right)^n dx. \ \ \ \ \ \ \ \ \ \ \ (1)$

Let

$\displaystyle I_n:=\int_0^1 \frac{1-e^{-x^2}}{x^{n+1}}\left(\int_0^xe^{-t^2} dt\right)^n dx.$

Using the Maclaurin series of $e^{-x^2},$ it’s clear that

$\displaystyle x-\frac{x^3}{3} \le \int_0^x e^{-t^2} \ dt \le x-\frac{x^3}{3}+\frac{x^5}{10}$

and so

$\displaystyle n \int_0^1 \frac{1-e^{-x^2}}{x}\left(1-\frac{x^2}{3}\right)^n dx \le nI_n \le n\int_0^1 \frac{1-e^{-x^2}}{x}\left(1-\frac{x^2}{3}+\frac{x^4}{10}\right)^n dx. \ \ \ \ \ \ \ \ (2)$

We now find the limits of the sequences on the LHS and the RHS of $(2).$ First, the LHS one. The substitution $\displaystyle 1-\frac{x^2}{3}=s$ gives

$\displaystyle n \int_0^1 \frac{1-e^{-x^2}}{x}\left(1-\frac{x^2}{3}\right)^n dx=\frac{n}{2}\int_{2/3}^1 \frac{1-e^{-3(1-s)}}{1-s}s^n ds$

and hence

$\displaystyle \lim_{n\to\infty}n \int_0^1 \frac{1-e^{-x^2}}{x}\left(1-\frac{x^2}{3}\right)^n dx=\frac{1}{2}\lim_{s\to1}\frac{1-e^{-3(1-s)}}{1-s}=\frac{3}{2} \ \ \ \ \ \ \ \ \ \ \ (3)$

because, as we showed here, $\displaystyle \lim_{n\to\infty} n\int_c^1 f(x) \ x^n dx =f(1)$ for any $c \in [0,1)$ and any continuous function $f: [0,1] \to \mathbb{R}.$

Now we find the limit of the sequence on the RHS of $(2).$ The idea is the same. We first make the substitution $x^2=s$ to get

$\displaystyle n\int_0^1 \frac{1-e^{-x^2}}{x}\left(1-\frac{x^2}{3}+\frac{x^4}{10}\right)^n dx=\frac{n}{2}\int_0^1 \frac{1-e^{-s}}{s}\left(1-\frac{s}{3}+\frac{s^2}{10}\right)^nds. \ \ \ \ \ \ \ \ \ (4)$

The function $\displaystyle y=1-\frac{s}{3}+\frac{s^2}{10}, \ \ s \in [0,1],$ is decreasing and so it has an inverse, i.e. we can find $s$ in terms of $y$ but to avoid the unnecessary mess, let’s just write $s=g(y).$ Then the substitution $\displaystyle y=1-\frac{s}{3}+\frac{s^2}{10}$ and $(4)$ give

\displaystyle \begin{aligned} n\int_0^1 \frac{1-e^{-x^2}}{x}\left(1-\frac{x^2}{3}+\frac{x^4}{10}\right)^n dx=-\frac{n}{2}\int_{23/30}^1 \frac{1-e^{-g(y)}}{g(y)}g'(y)y^n dy \\ =-\frac{n}{2}\int_{23/30}^1 \frac{1-e^{-g(y)}}{g(y)}\left(\frac{g(y)}{5}-\frac{1}{3}\right)^{-1}y^ndy\end{aligned}

and so, again using the fact that $\displaystyle \lim_{n\to\infty} n\int_c^1 f(x) \ x^n dx =f(1)$ for any $c \in [0,1)$ and any continuous function $f: [0,1] \to \mathbb{R},$ we have

\displaystyle \begin{aligned} \lim_{n\to\infty} n\int_0^1 \frac{1-e^{-x^2}}{x}\left(1-\frac{x^2}{3}+\frac{x^4}{10}\right)^n dx=-\frac{1}{2}\lim_{y\to1}\frac{1-e^{-g(y)}}{g(y)}\left(\frac{g(y)}{5}-\frac{1}{3}\right)^{-1} \\ =-\frac{1}{2}\lim_{z\to0} \frac{1-e^{-z}}{z}\left(\frac{z}{5}-\frac{1}{3}\right)^{-1}=\frac{3}{2}. \end{aligned} \ \ \ \ \ \ \ \ \ (5)

So $(2), (3), (5)$ and the squeeze theorem together give $\displaystyle \lim_{n\to\infty} nI_n=\frac{3}{2}$ and the result follows from $(1). \ \Box$

Remark (for those readers who are familiar with multi-variable calculus). It follows from the above problem that

$\displaystyle \lim_{n\to\infty} \int_{0}^{1} \cdots \int_{0}^{1} \frac{x_1 + \cdots + x_n}{x_1^2 + \cdots + x_n^2} \ dx_1 \ \cdots \ dx_n=\frac{3}{2}.$

That’s because we can write $\displaystyle \frac{1}{x_1^2 + \cdots + x_n^2}=\int_0^{\infty} e^{-(x_1^2+ \cdots + x_n^2)x} dx$ and thus

\displaystyle \begin{aligned} \int_{0}^{1} \cdots \int_{0}^{1} \frac{x_1 + \cdots + x_n}{x_1^2 + \cdots + x_n^2} \ dx_1 \ \cdots \ dx_n= n\int_{0}^{1} \cdots \int_{0}^{1} \frac{x_1}{x_1^2 + \cdots + x_n^2} \ dx_1 \cdots \ dx_n \\ =n\int_{0}^{\infty} \int_0^1 \cdots \int_{0}^{1} x_1e^{-(x_1^2+ \cdots + x_n^2)x} dx_1 \cdots \ dx_n \ dx=n \int_0^{\infty}\left(\int_0^1x_1e^{-x_1^2x}dx_1\right)\left(\int_0^1e^{-t^2x}dt\right)^{n-1}dx \\ =n\int_0^{\infty}\frac{1-e^{-x}}{2x}\left(\int_0^1e^{-t^2x}dt\right)^{n-1}dx=n\int_0^{\infty}\frac{1-e^{-x}}{2x}\left(\int_0^{\sqrt{x}} \frac{e^{-t^2}}{\sqrt{x}} \ dx\right)^{n-1}dx \\ =n\int_0^{\infty}\frac{1-e^{-x^2}}{x^n}\left(\int_0^x e^{-t^2} dt \right)^{n-1} dx \end{aligned}

and the result follows because

\displaystyle \begin{aligned} \lim_{n\to\infty} n\int_0^{\infty}\frac{1-e^{-x^2}}{x^n}\left(\int_0^x e^{-t^2} dt \right)^{n-1} dx=\lim_{n\to\infty} n\int_0^{\infty}\frac{1-e^{-x^2}}{x^{n+1}}\left(\int_0^xe^{-t^2} dt \right)^n dx=\frac{3}{2},\end{aligned}

by the above problem.