# Compute $\int_0^{\pi/4}\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)} x\exp(\frac{x^2-1}{x^2+1}) dx$

Compute the following integral $$\int_0^{\Large\frac{\pi}{4}}\left[\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)}\right] x\, \exp\left[\frac{x^2-1}{x^2+1}\right]\, dx$$

I was given two integral questions by my teacher. I can answer this one although it took a lot of time to compute it. I want to share this problem to the other users here and I would love to see how Mathematics SE users compute this monster. Thank you.

Rewrite \begin{align} &\int\left[\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)}\right] x\ \exp\left[\frac{x^2-1}{x^2+1}\right]\ dx\\ &=-\int\left[\frac{(1-x^2)\ln\left(\dfrac{1-x^2}{1+x^2}\right)-(1+x^2)}{(1-x^2)(1+x^2)(1+x^2)}\right] x\ \exp\left[-\frac{1-x^2}{1+x^2}\right]\ dx\\ &=-\frac14\int\left[\frac{(1-x^2)\ln\left(\dfrac{1-x^2}{1+x^2}\right)-(1+x^2)}{(1-x^2)}\right] \frac{2x}{1+x^2}\, \exp\left[-\frac{1-x^2}{1+x^2}\right]\ \frac{2\ dx}{1+x^2}\\ &=-\frac14\int\left[\ln\left(\frac{1-x^2}{1+x^2}\right)-\frac{1+x^2}{1-x^2}\right] \frac{2x}{1+x^2}\, \exp\left[-\frac{1-x^2}{1+x^2}\right]\ \frac{2\ dx}{1+x^2}.\tag1 \end{align} Now, consider Weierstrass substitution: $$x=\tan\frac{t}{2}\;,\;\sin t=\frac{2x}{1+x^2}\;,\;\cos t=\frac{1-x^2}{1+x^2}\;,\;\text{ and }\;dt=\frac{2\ dx}{1+x^2}.$$ The integral in $$(1)$$ turns out to be $$-\frac14\int\left[\ln\left(\cos t\right)-\frac{1}{\cos t}\right] \sin t\, \exp\left[-\cos t\right]\ dt.\tag2$$ Let $$y=\cos t\;\Rightarrow\;dy=-\sin t\ dt$$, then $$(2)$$ becomes $$\frac14\int\left[\ln y-\frac{1}{y}\right] e^{-y}\ dy=\frac14\left[\int e^{-y}\ln y\ dy-\int\frac{e^{-y}}{y}\ dy\right].\tag3$$ The second integral in the RHS $$(3)$$ can be evaluated by using IBP. Taking $$u=e^{-y}\;\Rightarrow\;du=-e^{-y}\ dy$$ and $$dv=\dfrac1y\ dy\;\Rightarrow\;v=\ln y$$, then $$\int\frac{e^{-y}}{y}\ dy=e^{-y}\ln y+\int e^{-y}\ln y\ dy.\tag4$$ Substituting $$(4)$$ to $$(3)$$, we obtain $$\frac14\left[\int e^{-y}\ln y\ dy-e^{-y}\ln y-\int e^{-y}\ln y\ dy\right]=-\frac14e^{-y}\ln y+C.$$ Thus \begin{align} &\int\left[\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)}\right] x\ \exp\left[\frac{x^2-1}{x^2+1}\right]\ dx\\ &=\color{blue}{-\frac14\exp\left[-\frac{1-x^2}{1+x^2}\right]\ln \left|\frac{1-x^2}{1+x^2}\right|+C} \end{align} and \begin{align} &\int_0^{\Large\frac\pi4}\left[\frac{(1-x^2)\ln(1+x^2)+(1+x^2)-(1-x^2)\ln(1-x^2)}{(1-x^4)(1+x^2)}\right] x\ \exp\left[\frac{x^2-1}{x^2+1}\right]\ dx\\ &=\color{blue}{-\frac14\exp\left[\frac{\pi^2-16}{\pi^2+16}\right]\ln \left|\frac{16-\pi^2}{16+\pi^2}\right|}. \end{align}

• I choose your answer since it's very detail and it's also nice-formatted. Thanks! (>‿◠)✌ – Anastasiya-Romanova 秀 Jun 1 '14 at 14:13
• For prettiness factor why not write $\exp\left[\frac{\pi^2-16}{\pi^2+16}\right]$? – Ali Caglayan Dec 17 '14 at 14:52

From the numerator, collect the logarithmic terms first.

$$\displaystyle \int_0^{\pi/4} x\frac{(1+x^2)+(x^2-1)\ln\left(\frac{1-x^2}{1+x^2}\right)}{(1-x^4)(1+x^2)}\exp\left(\frac{x^2-1}{x^2+1}\right)\,dx$$

Rewrite $(1-x^4)=(1-x^2)(1+x^2)$ and divide the numerator by $(1+x^2)$.

$$\displaystyle \int_0^{\pi/4} \frac{x}{(1-x^2)(1+x^2)}\left(1+\frac{x^2-1}{x^2+1}\ln\left(\frac{1-x^2}{1+x^2}\right)\right)\exp\left(\frac{x^2-1}{x^2+1}\right)\,dx$$

Use the substitution $\displaystyle \frac{x^2-1}{x^2+1}=t \Rightarrow \frac{4x}{(1+x^2)^2}\,dx=dt$ to get:

$$\displaystyle \frac{1}{4}\int_{a}^{-1}\frac{e^t}{t}\left(1+t\ln(-t)\right)\,dt= \frac{1}{4}\int_{a}^{-1}e^t\left(\frac{1}{t}+\ln(-t)\right)\,dt$$

where $\displaystyle a=\frac{\pi^2/16-1}{\pi^2/16+1}$

Since $\displaystyle \int e^x(f'(x)+f(x))\,dx=e^xf(x)+C$, the above definite integral is:

$$\displaystyle \frac{1}{4}\left(e^t \ln(-t) \right|_{a}^{-1}=-\frac{1}{4}e^a\ln(-a) \approx \boxed{0.284007}$$

• That was fast... – IAmNoOne May 31 '14 at 10:33
• The FLASH!! LOL – Anastasiya-Romanova 秀 May 31 '14 at 10:34
• @Nameless: Yeah, the reason being that V-Moy recently posted this problem on a problem solving website and I posted the very same solution there so all I had to was just copy-paste. ;) – Pranav Arora May 31 '14 at 10:34
• @Nameless Please don't be so surprise. I've posted this question on Brilliant and Pranav has already answer it there $\ddot\smile$ – Anastasiya-Romanova 秀 May 31 '14 at 10:35
• @Nameless Here is the link to the problem. – Anastasiya-Romanova 秀 May 31 '14 at 10:36

The Monster integral asked by Anastasiya Ramanova two years ago is of the form $$\color{blue}{ \begin{equation*} \int_{0}^{\frac{\pi }{4}}\left[ \frac{(1-x^{2})\ln (1+x^{2})+(1+x^{2})-(1-x^{2})\ln (1-x^{2})}{(1-x^{4})(1+x^{2})}\right] xe^{\left( \frac{x^{2}-1}{x^{2}+1}\right) }dx=\int_{0}^{\frac{\pi }{4} }h(x)e^{g(x)}dx. \end{equation*} }$$ There are already two answers each one uses a substitution. I would like to share mine since it is systematic and do not use any substitution.

The presence of the exponential function in the integrand function recalls the well-known formula $$\color{red}{ \begin{equation*} \int \left( f^{\prime }(x)+g^{\prime }(x)f(x)\right) e^{g(x)}dx=f(x)e^{g(x)}+C \end{equation*} }$$ with $\color{blue}{g(x)=\frac{x^{2}-1}{x^{2}+1}.}$

Its proof maybe found at

Proof for formula $\int e^{g(x)}[f'(x) + g'(x)f(x)] dx = f(x) e^{g(x)}+C$

So we are done if we find a function $\color{blue}{f(x)}$ such that

$$\color{blue}{ \begin{equation*} h(x)=f^{\prime }(x)+g^{\prime }(x)f(x). \end{equation*}}$$

In what follows, I will show step by step that $\color{blue}{f(x)=\frac{1}{4}\ln \left( \frac{1+x^{2}}{1-x^{2}}\right), }$ and therefore

$$\color{blue}{ \begin{equation*} \int\left[ \frac{(1-x^{2})\ln (1+x^{2})+(1+x^{2})-(1-x^{2})\ln (1-x^{2})}{(1-x^{4})(1+x^{2})}\right] xe^{\left( \frac{x^{2}-1}{x^{2}+1}\right) }dx=\frac{1}{4}\ln \left( \frac{ 1+x^{2}}{1-x^{2}}\right) e^{\left( \frac{x^{2}-1}{x^{2}+1}\right) }+C. \end{equation*} }$$ $\color{red}{\bf Problem:}$ We want to write $$\color{blue}{ \begin{equation*} \left[ \frac{(1-x^{2})\ln (1+x^{2})+(1+x^{2})-(1-x^{2})\ln (1-x^{2})}{ (1-x^{4})(1+x^{2})}\right] x \end{equation*}}$$ as $$\color{blue}{ \begin{equation*} f^{\prime }(x)+g^{\prime }(x)f(x) \end{equation*}}$$ where $$\color{blue}{ \begin{equation*} g(x)=\left( \frac{x^{2}-1}{x^{2}+1}\right) ,\ \ \ \ \ \ \ g^{\prime }(x)= \frac{4x}{(1+x^{2})^{2}} \end{equation*}}$$ and $\color{blue}{f(x)}$ is to be determined.

The unique thing which is given by the statement is $\color{blue}{g(x)=\left( \frac{x^{2}-1}{ x^{2}+1}\right) .}$ So, the first thing we start with is to look for $\color{red}{g^{\prime }(x)}$ inside what would be $\color{blue}{f^{\prime }(x)+\color{red}{g^{\prime }(x)}f(x),}$ that is, inside $$\color{blue}{ \begin{equation*} \left[ \frac{(1-x^{2})\ln (1+x^{2})+(1+x^{2})-(1-x^{2})\ln (1-x^{2})}{ (1-x^{4})(1+x^{2})}\right] x. \end{equation*} }$$ Let us break down this expression into three fractions as follows $$\color{blue}{ \begin{equation*} \left[ \frac{(1-x^{2})\ln (1+x^{2})}{(1-x^{4})(1+x^{2})}+\frac{(1+x^{2})}{ (1-x^{4})(1+x^{2})}-\frac{(1-x^{2})\ln (1-x^{2})}{(1-x^{4})(1+x^{2})}\right]x. \end{equation*} }$$ Next cancelling $$\color{blue}{ \begin{equation*} \left[ \frac{\ln (1+x^{2})}{(1+x^{2})(1+x^{2})}+\frac{1}{(1-x^{4})}-\frac{ \ln (1-x^{2})}{(1+x^{2})(1+x^{2})}\right] x. \end{equation*} }$$ The first and third fractions have the same denominator and moreover it is that of $\color{blue}{ g^{\prime }(x),}$ so we bring them together! $$\color{blue}{ \begin{equation*} \left[ \frac{1}{(1-x^{4})}+\frac{\ln (1+x^{2})-\ln (1-x^{2})}{ (1+x^{2})(1+x^{2})}\right] x. \end{equation*} }$$ Since $\color{blue}{\ln (1+x^{2})-\ln (1-x^{2})=\ln \left( \frac{1+x^{2}}{1-x^{2}}\right) ,}$ we can make $\color{blue}{g^{\prime }(x)=\color{red}{\frac{4x}{(1+x^{2})^{2}}}}$ to appear as follows $$\color{blue}{ \begin{equation*} \left[ \frac{x}{(1-x^{4})}+\color{red}{\frac{4x}{(1+x^{2})^{2}}}\frac{1}{4}\ln \left( \frac{1+x^{2}}{1-x^{2}}\right) \right] . \end{equation*} }$$ So, define $$\color{blue}{ \begin{equation*} f(x)=\frac{1}{4}\ln \left( \frac{1+x^{2}}{1-x^{2}}\right) \end{equation*} }$$

and compute $\color{blue}{f^{\prime }(x)}$ to find that $$\color{blue}{ \begin{equation*} f^{\prime }(x)=\frac{x}{1-x^{4}}. \end{equation*}}$$

It follows that the monster integral is nothing but $$\color{blue}{ \begin{equation*} \int_{0}^{\frac{\pi }{4}}\left[ f^{\prime }(x)+g^{\prime }(x)f(x)\right] e^{g(x)}dx=\left. f(x)e^{g(x)}\right] _{0}^{\frac{\pi }{4}}=f(\frac{\pi }{4} )e^{g(\frac{\pi }{4})}-f(0)e^{g(0)}. \end{equation*} }$$

Since $$\color{blue}{ \begin{equation*} f\left( \frac{\pi }{4}\right) =\frac{1}{4}\ln \left( \frac{1+\left( \frac{ \pi }{4}\right) ^{2}}{1-\left( \frac{\pi }{4}\right) ^{2}}\right) =\frac{1}{4 }\ln \left( \frac{16+\pi ^{2}}{16-\pi ^{2}}\right) ,\ \ \ \ \ \ \ \color{black}{\text{and}}\ \ \ \ \ \ \ \ \ \ f(0)=\frac{1}{4}\ln \left( \frac{1+0^{2}}{1-0^{2}}\right) =0 \end{equation*} }$$

$$\color{blue}{ \begin{equation*} g\left( \frac{\pi }{4}\right) =\left( \frac{\left( \frac{\pi }{4}\right) ^{2}-1}{\left( \frac{\pi }{4}\right) ^{2}+1}\right) =\frac{\pi ^{2}-16}{\pi ^{2}+16},\ \ \ \ \color{black}{\text{and}}\ \ \ \ \ \ \ \ \ \ \ \ g(0)=-1, \end{equation*} }$$ then $$\color{blue}{ \begin{equation*} \int_{0}^{\frac{\pi }{4}}\left[ \frac{(1-x^{2})\ln (1+x^{2})+(1+x^{2})-(1-x^{2})\ln (1-x^{2})}{(1-x^{4})(1+x^{2})}\right] xe^{\left( \frac{x^{2}-1}{x^{2}+1}\right) }dx = \frac{1}{4}\ln \left( \frac{16+\pi ^{2}}{16-\pi ^{2}}\right) e^{\left( \frac{\pi ^{2}-16}{\pi ^{2}+16} \right) }.\ \ \ \color{red} \blacksquare \end{equation*}}$$

• Nitpick: there's no point in blue font if everything is in blue font. Just makes it harder on my eyes personally. – Simply Beautiful Art Oct 11 '18 at 13:49