Integral $\int_0^{\pi/4}\frac{x^2\tan x}{\cos^2 x}dx=\frac{\log 2}{2}-\frac{\pi}{4}+\frac{\pi^2}{16}$

Hi I am trying to evaluate the definite integral which has a closed form given by: $$\mathcal{I}=\int_0^{\pi/4}\frac{x^2\tan x}{\cos^2 x}dx=\frac{\log 2}{2}-\frac{\pi}{4}+\frac{\pi^2}{16}.$$ We can possibly write $y=\cos x$ $$\mathcal{I}=\int_0^{\pi/4}\frac{x^2\sin x}{\cos^3x}dx=\int_{\frac{1}{\sqrt 2}}^1\frac{(\cos^{-1}y)^2}{y^3}dy$$ however I am now sure how that will help us.
We can also try $u=\tan x, du=\frac{dx}{\cos^2x}$ to obtain $$\mathcal{I}=\int_0^1 (\tan^{-1}u)^2 u\, du$$ however I am unsure where to go from here. How can we solve $\mathcal{I}$? Thank you

• $\tan'x=\dfrac1{\cos^2x}$ – Lucian Jun 2 '14 at 15:46
• @Integrals: Seriously, this was again an easy one. :P – Pranav Arora Jun 2 '14 at 15:49
• @PranavArora Do you want me to post harder ones? I still have unsolved integrals on math stack, so I am not sure of the level of difficult to post. – Jeff Faraci Jun 2 '14 at 15:52
• I can help with slightly harder ones, the really hard ones are unapproachable (for me at least). :P The integrals posted by you which are unsolved are impossible for me, too much for a high school student.:3 Maybe the master solvers on this website can comment on what type of integrals you should post. :) – Pranav Arora Jun 2 '14 at 15:57

$$I=\int_0^{\pi/4} \frac{x^2\tan x}{\cos^2 x}\,dx=\int_0^{\pi/4} x^2\tan x\sec^2 x\,dx$$ Now use integration by parts: $$I=\left(x^2 \frac{\tan^2x}{2}\right|_0^{\pi/4}-\int_0^{\pi/4} x\tan^2 x\,dx=\frac{\pi^2}{32}-\int_0^{\pi/4} x\tan^2 x\,dx$$ Use integration by parts again to evaluate the last integral: $$I=\frac{\pi^2}{32}-\left(x(\tan x-x)\right|_0^{\pi/4}+\int_0^{\pi/4}(\tan x-x)\,dx$$ $$\Rightarrow I=\frac{\pi^2}{32}-\frac{\pi}{4}+\frac{\pi^2}{16}+\frac{\ln 2}{2}-\frac{\pi^2}{32}=\boxed{\dfrac{\ln 2}{2}-\dfrac{\pi}{4}+\dfrac{\pi^2}{16}}$$ $\blacksquare$
$$J=\int x^2\frac{\tan x}{\cos^2x}dx=\int (x^2)\frac{\sin x}{\cos^3x}dx$$
$$J=x^2\int\frac{\sin x}{\cos^3x}dx-\int\left(\frac{d(x^2)}{dx}\frac{\sin x}{\cos^3x}dx\right)dx$$
Now $\displaystyle\frac{\sin x}{\cos^3x}dx=-\int\frac{d(\cos x)}{\cos^3x}=-\sec^2x+K$
Again, $$\int x\sec^2x\ dx=x\int\sec^2x\ dx-\int\left(\frac{dx}{dx}\int\sec^2x\ dx\right)dx$$