# An interesting trigonometric integral

Yesterday I took part in an entry competition to one of the MSc programs in my university, and during one of the mathematical tests, I had to solve some integral and differential equations.

One of those integrals had the following trigonometric form: $$I(0,\pi)= \int\limits_0^\pi\left[\cos^2(\cos(x))+\sin^2(\sin(x))\right]dx$$ Unfortunately, I didn’t manage to solve it analytically during the test, but later, as I came home, I tried to evaluate it numerically using Mathematica. As it turned out, the answer seems to be $$I(0,\pi)=\pi$$.

Still, I do not understand what transformations or substitutions I had to perform so that to solve this problem analytically during the exam. This is exactly the reason, I am posting my question here, as I haven’t found this kind of problem even posted or solved anywhere yet, and so I am kindly asking for any help to attempt this integral analytically.

• Do you mean $\left[\cos(\cos(x))\right]^2+\left[\sin(\sin(x))\right]^2$ or $\cos\left[(\cos(x))^2\right]+\sin\left[(\sin(x))^2\right]$ ? If it is the first one, then I guess the answer is quite obviously $\pi$... Jun 20, 2023 at 10:20
• Both Cases are not Obvious to me , @TheSilverDoe , It might be Obvious when the Outer $\sin$ & $\cos$ have Same argument which is not true here.
– Prem
Jun 20, 2023 at 10:32
• @Prem Oops, indeed, nothing obvious here. But my first question still stands... Jun 20, 2023 at 10:34
• @o.spectrum FYI, an Approach0 search found multiple AoPS threads for your integral, but only with an upper bound of $\frac{\pi}{2}$, e.g., Sine of sine and cosine of cosine, Fun integral, Integral, ... Jun 20, 2023 at 11:20
• Mathematica seems to be unable to solve the general integral, if there is no known closed formula, the proof probably had to rely on the particular choice of the interval $[0,\pi]$ which guides exploration to "what tricks can I use that involve $\pi$ $\cos$ and $\sin$ to integrate this". A youtube video I saw mentioned that these kinds of integrals with definite bounds often have a solution using the "king's property" (math.stackexchange.com/q/3856735/1049002) and so seeing that "it looks too complicated" and the definite bounds, my mind went to "looks like a king's property" Jun 21, 2023 at 20:03

\begin{align*} I&= \int_0^\pi \cos^2\cos x+\sin^2\sin x \, dx\\ &= 2\int_0^{\pi/2} \cos^2\cos x+\sin^2\sin x \, dx\\ &= 2\int_0^{\pi/2} \cos^2\sin x+\sin^2\cos x \, dx \quad(x\mapsto\pi/2-x)\\ \end{align*} Hence $$2I=2\int_0^{ \pi/2 } 2\, dx\Rightarrow I=\pi$$ from summing the last two lines.

• Could you please motivate why it is obvious that $\int_0^{\pi}=2\int_0^{\frac{\pi}{2}}$
– Zima
Jun 20, 2023 at 10:55
• Because the integrand is invariant under $x\mapsto \pi-x$, i.e. symmetric about $x=\pi/2$. Jun 20, 2023 at 10:59
• @Goonfiend oh, what an answer! Thank you so much. Now I feel awkward for not noticing that we can transform the arguments so that for them to match what further allows for the Pythagorean identity to be applied. At least now I finally see it, maybe the cause was that I was short on time during the exam. Anyways, thank you for this beautiful answer once again! Jun 20, 2023 at 12:44
• @tomsmeding then you have different bounds on each piece, $[0,\pi]$ and $[-\pi/2,\pi/2]$, how will you combine again without using symmetry ? Jun 21, 2023 at 21:17

A slightly different approach :

\begin{align*} I&= \int_0^\pi \cos^2\cos x+\sin^2\sin x \, dx\\ & = \int_0^\pi \dfrac{1+\cos(2\cos(x))}{2} + \dfrac{1-\cos(2\sin(x))}{2} dx \\ & = \pi + \dfrac{1}{2} \left( \int_0^\pi \cos(2 \cos(x)) dx - \int_0^\pi \cos(2 \sin(x)) dx\right) \\ \end{align*}

But notice that \begin{align*} \int_0^\pi \cos(2 \cos(x)) dx & = \int_0^{\pi/2} \cos(2 \cos(x)) dx + \int_{\pi/2}^\pi \cos(2 \cos(x)) dx \\ & = \int_{\pi/2}^{\pi} \cos(2 \sin(u)) du + \int_0^{\pi/2} \cos(2 \sin(t)) dt \\ & \quad \quad \quad \quad \quad \quad \quad (\text{substituting } u=x + \dfrac{\pi}{2} \text{ and } t=x- \dfrac{\pi}{2})\\ & = \int_0^{\pi} \cos(2 \sin(x)) dx \end{align*}

and you are done.

• Oh, wow, that’s quite an interesting approach as well! Thank you so much for sharing it :) Jun 20, 2023 at 13:07

Let's take a completely different approach. Set

$$f(x)=\cos^2\cos x+\sin^2\sin x-1.$$

We will show that $$f$$ integrates to $$0$$ over $$[0,\pi]$$. Observe that

\begin{align*} f\left(x+\frac{\pi}{2}\right) &=\cos^2\cos\left(x+\frac{\pi}{2}\right)+\sin^2\sin\left(x+\frac{\pi}{2}\right)-1\\ &=\cos^2\sin x+\sin^2\cos x-1\\ &=\left(1-\sin^2\sin x\right)+\left(1-\cos^2\cos x\right)-1 \\ &=1-\cos^2\cos x-\sin^2\sin x\\ &=-f(x). \end{align*}

Indeed this property alone is enough to show the result, as then

\begin{align*} \int_0^\pi f(x)~\mathrm{d}x &=\int_0^\frac{\pi}{2} f(x)~\mathrm{d}x+\int_\frac{\pi}{2}^\pi f(x)~\mathrm{d}x \\ &=\int_0^\frac{\pi}{2} f(x)~\mathrm{d}x+\int_0^\frac{\pi}{2} f\left(x+\frac{\pi}{2}\right)~\mathrm{d}x \\ &=\int_0^\frac{\pi}{2}(f(x)-f(x))~\mathrm{d}x \\ &=0. \end{align*}

The result in the question now follows by observing that

$$\int_0^\pi\bigl(\cos^2\cos x+\sin^2\sin x\bigr)~\mathrm{d}x=\underbrace{\int_0^\pi f(x)~\mathrm{d}x}_{=0}+\underbrace{\int_0^\pi\mathrm{d}x}_{=\pi}=\pi.$$

• I like this approach. +1. Very satisfying to get the integral to 0 Jun 22, 2023 at 6:21

Under $$\cos x\to x$$, one has \begin{align*} I&= \int_0^\pi (\cos^2\cos x+\sin^2\sin x) \, dx\\ & = \int_{-1}^1 \dfrac{\cos^2x+\sin^2(\sqrt{1-x^2})}{\sqrt{1-x^2}} dx \\ & = 2\int_{0}^1 \dfrac{\cos^2x+\sin^2(\sqrt{1-x^2})}{\sqrt{1-x^2}} dx. \end{align*} Noting that, under $$\sqrt{1-x^2}\to x$$, one has $$\int_{0}^1 \dfrac{\sin^2(\sqrt{1-x^2})}{\sqrt{1-x^2}} dx=\int_{0}^1 \dfrac{\sin^2x}{\sqrt{1-x^2}} dx$$ and hence $$I=2\int_{0}^1 \dfrac{\cos^2x+\sin^2x}{\sqrt{1-x^2}} dx=2\int_{0}^1 \dfrac{1}{\sqrt{1-x^2}} dx=\pi.$$

Here is a method using Bessel functions. This is most likely not viable in a competition, but if you know the expansions and realize the simplifications due to the $$\sin(2\pi k)$$ factor, it may work. \begin{align*} I(0,\pi)&=\int_0^\pi\cos^2(\cos x)+\sin^2(\sin x)\ dx \\ &=\int_0^\pi\cos^2(\cos x)\ dx+\int_0^\pi\sin^2(\sin x)\ dx \\ &=\int_0^\pi\frac{1+\cos(2\cos x)}{2}\ dx+\int_0^\pi\frac{1-\cos(2\sin x)}{2}\ dx\\ &=\pi+\frac{1}{2}\underbrace{\int_0^\pi\cos(2\cos x)\ dx}_{I_1}-\frac{1}{2}\underbrace{\int_0^\pi\cos(2\sin x)\ dx}_{I_2} \end{align*} Using two Jacobi-Anger expansions, $$\cos(2\cos x)=J_0(2)+2\sum_{k=1}^\infty(-1)^kJ_{2k}(2)\cos(2kx),\quad x\in\mathbb{C} \\ \cos(2\sin x)=J_0(2)+2\sum_{k=1}^\infty J_{2k}(2)\cos(2kx),\quad x\in\mathbb{C}$$ we have for $$I_1$$, \begin{align*}I_1&=\int_0^\pi J_0(2)+2\sum_{k=1}^\infty(-1)^kJ_{2k}(2)\cos(2kx)\ dx \\&=\pi J_0(2)+2\sum_{k=1}^\infty(-1)^kJ_{2k}(2)\int_0^\pi\cos(2kx)\ dx\\ &=\pi J_0(2)+2\sum_{k=1}^\infty\frac{(-1)^kJ_{2k}(2)\sin(2\pi k)}{k} \\&=\pi J_0(2) \end{align*} and for $$I_2$$, \begin{align*} I_2&=\int_0^\pi J_0(2)+2\sum_{k=1}^\infty J_{2k}(2)\cos(2kx)\ dx \\ &=\pi J_0(2)+2\sum_{k=1}^\infty J_{2k}(2)\int_0^\pi\cos(2kx)\ dx \\ &=\pi J_0(2)+2\sum_{k=1}^\infty\frac{J_{2k}(2)\sin(2\pi k)}{k} \\ &=\pi J_0(2) \end{align*} thus the integral is, $$I(0,\pi)=\pi+\frac{\pi }{2}J_0(2)-\frac{\pi}{2}J_0(2)=\pi.$$

Another solution, this time utilizing the Maclaurin expansion of $$\cos(x)$$. As we end up finding closed forms in terms of the Bessel function anyways, I will merge answers.

Working similarly as above, \begin{align*} I(0,\pi)&=\pi+\frac{1}{2}\underbrace{\int_0^\pi\cos(2\cos x)\ dx}_{I_1}-\frac{1}{2}\underbrace{\int_0^\pi\cos(2\sin x)\ dx}_{I_2} \end{align*} expanding the cosine by its Maclaurin series, $$I_1=\int_0^\pi\sum_{k=0}^\infty\frac{(-1)^k2^{2k}}{(2k)!}\cos^{2k}(x)\ dx=\sum_{k=0}^\infty\frac{(-1)^k2^{2k}}{(2k)!}\int_0^\pi\cos^{2k}(x)\ dx=\pi\sum_{k=0}^\infty\frac{(-1)^k}{(k!)^2}=\pi J_0(2)$$ $$I_2=\int_0^\pi\sum_{k=0}^\infty\frac{(-1)^k2^{2k}}{(2k)!}\sin^{2k}(x)\ dx=\sum_{k=0}^\infty\frac{(-1)^k2^{2k}}{(2k)!}\int_0^\pi\sin^{2k}(x)\ dx=\pi\sum_{k=0}^\infty\frac{(-1)^k}{(k!)^2}=\pi J_0(2)$$ here I used the Wallis integrals, $$\int_0^\pi\cos^{2k}(x)\ dx=\int_0^\pi\sin^{2k}(x)\ dx=\frac{\pi}{2^{2k}}\binom{2k}{k},\quad k\in\mathbb{Z_0}$$ and the series expansion for the Bessel function of first kind, $$J_0(z)=\sum_{k=0}^\infty\frac{(-1)^k}{(k!)^2}\left(\frac{z}{2}\right)^{2k},\quad z\in\mathbb{C}$$ hence by similar arguments, $$I(0,\pi)=\pi.$$