# Faster way to compute the integral

Here it is:

$$\int_o^\pi x\cos^4x\,dx$$ I used integration by parts but I would be grateful if someone told me an alternate method to compute the integral faster.

-

The well known formula $$\int_0^\pi xf(\sin x )dx=\frac \pi2\int_0^\pi f(\sin x )dx$$ yields $$I=\int_{o}^{\pi} x\cos^4x=\frac \pi2\int_0^\pi \cos^4xdx=\pi\int_0^{\pi/2} \cos^4xdx$$ then let $x=\pi/2-y$ and have that $$I=\pi\int_0^{\pi/2} \cos^4xdx=\pi\int_0^{\pi/2} \sin^4xdx$$ $$2I=\pi\int_0^{\pi/2} (\sin^4x+\cos^4x)dx=\frac \pi4\int_0^{\pi/2} (\cos(4 x)+3) dx= \frac{3 \pi^2}{8}$$ $$I= \frac{3 \pi^2}{16}.$$

Chris

-
Your "well known formula" is cute! Here is a proof: Consider the function $$g(x):=\bigl(x-{\pi\over2}\bigr) f(\sin x)\ .$$ Then $g(\pi -x)=-g(x)$ and therefore $\int_0^\pi g(x)\ dx=0$ or $$\int_0^\pi x f(\sin x)\ dx={\pi\over2}\int_0^\pi f(\sin x)\ dx\ .$$ – Christian Blatter Oct 25 '12 at 16:49
This is a delightful method. – user43081 Oct 25 '12 at 17:32
@ChristianBlatter: a nice interesting proof (+1) – OFFSHARING Oct 25 '12 at 18:33

Let $I=\int_0^\pi x\cos^4x\,dx$

Using $\int_a^b f(x)\,dx=\int_{a}^{b}f(a+b-x)\,dx$ (Proof),

$I=\int_0^\pi (\pi-x)\cos^4(\pi-x)\,dx$ as $\cos(\pi-x)=-\cos x$

$I=\pi\int_0^\pi \cos^4x\,dx -I$

$2I=\pi\int_0^\pi \cos^4x\,dx$

Now, if $f(x)=\cos^4x,f(-x)=\{\cos(-x)\}^4=\cos^4x=f(x)$ i.e., is an even function, so, $\int_0^\pi \cos^4x\,dx =2\int_0^{\frac\pi 2}\cos^4x\,dx$

Now, we can use reduction formula to find $\int_0^{\frac\pi 2}\cos^4x\,dx=\frac {4-1} 4 \frac {4-3} {4-2}\frac \pi 2$

-
If you use $\cos x=(e^{ix}+e^{-ix})/2$ and $\int_0^{\pi}e^{i2kx}dx=0$ (for $k\neq0$ integer) you get $\int_0^{\pi}\cos^{2n}x dx=\pi\binom{2n}{n}/2^n$. – user8268 Oct 25 '12 at 13:13
This seems to be the fastest, of course, yet it relies on complex functions which the OP is, perhaps, not acquainted. – DonAntonio Oct 25 '12 at 13:28

One has $$\cos^4 x={1\over16}(e^{ix}+e^{-ix})={1\over8}\bigl(3+4\cos(2x)+\cos(4x)\bigr)$$ and therefore \eqalign{J&:=\int_0^\pi x\cos^4 x\ dx \cr &={1\over8}\Bigl(x(3x+2\sin(2x)+{1\over4}\sin(4x)\Bigr)\biggr|_0^\pi -{1\over8}\int_0^\pi \bigl(3x+2\sin(2x)+{1\over4}\sin(4x)\bigr)\ dx\ .\cr} Inspecting the right hand side we see that all that remains is $$J={1\over8}\cdot 3\pi^2-{1\over8}\int_0^\pi 3x\ dx= {3\pi^2\over16}\ .$$

-

I'm not sure if this is "faster" than what you did but it's a different way to integrate $\,\cos^4x\,$. First,

$$\cos^4x=\cos^2x(1-\sin^2x)=\cos^2x-\cos^2x\sin^2x$$

$$\int\cos^2x\,dx=\frac{x+\cos x\sin x}{2}\,.\,.\,.\,.\,(\text{Hint: use, for example, }\,\,\cos 2x=2\cos^2x-1):$$

$$\int\cos^2x\sin^2x\,dx=-\frac{\cos^3x\sin x}{3}+\frac{1}{3}\int\cos^4x\,dx\,.$$

Thus, putting $\,K:=\int \cos^4x\,dx$ , we get:

$$K=\frac{1}{2}(x+\cos x\sin x)+\frac{1}{3}(\cos^3x\sin x)-\frac{1}{3}K\Longrightarrow$$

$$K=\left.\frac{3}{8}\left(x+\cos x\sin x\right)+\frac{1}{4}\left(\cos^3x\sin x\right)\right|_0^\pi=\frac{3\pi}{8}$$

and since $\,\displaystyle{I=\frac{\pi}{2}K}\,$ , by lab's answer, we're done.

-