# Integral with sin and cos

What kind of substitution would help me solve this integral: $$\int_0^{\pi/4} \frac{x\sin x}{\cos^3x}\,dx$$ I wanted to substitute with $t=x-\pi$ but doesn't help. Also I wrote it as $\frac{\sin x}{\cos^2x\cdot \cos x}=\tan x\cdot (\tan x)'\cdot x$ anbd continued from there but got $\frac{\pi^2}{8}$ which is wrong.Is this the right way or is there an easier way to solving this type of integrals?

• mathworld.wolfram.com/IntegrationbyParts.html – lab bhattacharjee Jul 4 '17 at 12:57
• If you perform the change of variable $y=\tan x$, you get $\displaystyle I=\int_0^1 y\arctan y dy$ – FDP Jul 4 '17 at 13:33
• thats what I got and then tried IBP but gave me the wrong answer – Lola Jul 4 '17 at 13:36

By integration by parts $$I\stackrel{\text{IBP}}{=}\left[\frac{x}{2\cos^2 x}\right]_{0}^{\pi/4}-\frac{1}{2}\int_{0}^{\pi/4}\frac{dx}{\cos^2 x}=\color{red}{\frac{\pi}{4}-\frac{1}{2}}.$$

• (+1) my answer is the same but I added some more detail. I considered not posting because it adds nothing essential, but it may be useful to the OP. If you think it is too close to your answer, I will delete it. – robjohn Jul 4 '17 at 13:50
• I wouldn't ever say something like that to you, @robjohn! – Jack D'Aurizio Jul 4 '17 at 13:53

On the path of Lola,

$\displaystyle I=\int_0^{\frac{\pi}{4}}\frac{x\sin x}{\cos^3 x}dx$

Perform the change of variable $y=\tan x$,

$I=\displaystyle \int_0^1 y\arctan y dy$

Pertform integration by parts,

\begin{align}I=\bigg[\frac{y^2}{2}\arctan y\bigg]_0^1-\frac{1}{2}\int_0^1 \frac{y^2}{1+y^2}dy \end{align}

Moreover,

For $y\in \mathbb{R}$,

$\displaystyle \frac{y^2}{1+y^2}=1-\frac{1}{1+y^2}$

Therefore,

$I=\frac{\pi}{8}-\frac{1}{2}+\frac{\pi}{8}=\boxed{\frac{\pi}{4}-\frac{1}{2}}$

Using integration by parts, we can write:

$$\mathscr{I}\left(\text{n}\right):=\int_0^\text{n}\frac{x\sin\left(x\right)}{\cos^3\left(x\right)}\space\text{d}x=\left[\frac{x}{2\cos^2\left(x\right)}\right]_0^\text{n}-\frac{1}{2}\int_0^\text{n}\frac{1}{\cos^2\left(x\right)}\space\text{d}x\tag1$$

Now, we can use:

• $$\left[\frac{x}{2\cos^2\left(x\right)}\right]_0^\text{n}=\frac{\text{n}}{2\cos^2\left(\text{n}\right)}-\frac{0}{2\cos^2\left(0\right)}=\frac{\text{n}\sec^2\left(\text{n}\right)}{2}\tag2$$
• $$\int_0^\text{n}\frac{1}{\cos^2\left(x\right)}\space\text{d}x=\int_0^\text{n}\sec^2\left(x\right)\space\text{d}x=\left[\tan\left(x\right)\right]_0^\text{n}=\tan\left(\text{n}\right)-\tan\left(0\right)=\tan\left(\text{n}\right)\tag3$$

So, we get:

$$\mathscr{I}\left(\text{n}\right)=\frac{\text{n}\sec^2\left(\text{n}\right)}{2}-\frac{\tan\left(\text{n}\right)}{2}\tag4$$

When $0<\text{n}<\frac{\pi}{2}$ for the first interval.

Another way: differentiation under the integral sign. Calculate $$I(a)=\frac12\int_0^{\pi/4}\frac{1}{\cos^2(ax)}\,dx=\frac{1}{2a}\tan\left(\frac{\pi a}4\right).$$ Your integral is $I'(1)$.

This answer adds nothing that the other answers don't have, except perhaps more detail: \begin{align} \int_0^{\pi/4}\frac{x\sin(x)}{\cos^3(x)}\,\mathrm{d}x &=-\int_0^{\pi/4}\frac{x}{\cos^3(x)}\,\mathrm{d}\cos(x)\\ &=\int_0^{\pi/4}\frac x2\,\mathrm{d}\frac1{\cos^2(x)}\\ &=\frac\pi4-\frac12\int_0^{\pi/4}\sec^2(x)\,\mathrm{d}x\\ &=\frac\pi4-\left.\frac12\tan(x)\right]_0^{\pi/4}\\[3pt] &=\frac\pi4-\frac12 \end{align}

$$\int \frac{\sin x}{\cos^3 x}dx=\int \tan x \sec^2 x\space dx=\int z\space dz=\frac{z^2}{2}+c,\space \text{taking \tan x=z}.$$

Now $$\int x\frac{\sin x}{\cos^3 x}dx=x\int \frac{\sin x}{\cos^3 x}dx-\int (\int \frac{\sin x}{\cos^3 x}dx)dx$$

Step 1) Rewrite the integrand as $x\tan(x)sec^2(x)$.

Step 2) Use integration by parts: $\int u dv = uv -\int vdu$, where $u = x$ and $dv = \sec^2(x) \tan(x) dx$