# Evaluating $\int_{0}^{\frac{\pi}{2}} (\sin (x) +\cos (x))^4 - (\sin(x) - \cos (x))^4 dx$

I would like to evaluate $$\int_{0}^{\frac{\pi}{2}} (\sin (x) +\cos (x))^4 - (\sin(x) - \cos (x))^4 dx.$$ One approach I used was to split the integral into two pieces and evaluating each piece directly with the anti derivatives $$\frac {1}{4} (\sin(x) - \cos (x))^4$$ and $$\frac {1}{4} (-\sin(x) - \cos (x))^4,$$ respectively. This gives me 0. However, one can use trig identities and manipulate the integrand so that the final integral is $$4\int_{0}^{ \frac{\pi}{2} }2\sin (x) \cos (x) dx.$$ This gives me 4. How is that I'm getting two answers?

• no for the first integral you get also $4$ as the result – Dr. Sonnhard Graubner Sep 4 '15 at 22:05
• @Nitin I believe the anti derivatives are correct. The second one needs a minus sign, but I was taking that into account when taking the difference. – Kevin Sheng Sep 4 '15 at 22:07
• @KevinSheng I deleted my first comment because I thought I was wrong, but no, the anti derivatives are incorrect. Just use the chain rule to check. – user217285 Sep 4 '15 at 22:14
• Nope, you are correct. I was making a careless error. – Kevin Sheng Sep 4 '15 at 22:17

You didn't compute antiderivatives correctly. To check your work, simply differentiate your result: $$\frac{\mathrm d}{\mathrm dx}\left[\frac {1}{4} (\sin(x) - \cos (x))^4 + C\right] = (\sin x + \cos x)(\sin x - \cos x)^3 \neq (\sin x + \cos x)^4$$

Please, observe that we used the chain rule to derive our result. The same argument can be used to show that the second antiderivative is wrong.

To evaluate the integral it's much easier to use the fact that $$A^2 - B^2 = (A + B)(A - B),$$ which, in combination with the identity $\sin^2 x + \cos^2 x = 1$, yields \begin{align} I &= \int_0^{\pi/2}\left((\sin x + \cos x)^2 + (\sin x - \cos x)^2\right)\left((\sin x + \cos x)^2 - (\sin x - \cos x)^2\right)\mathrm dx\\ &= \int_0^{\pi/2}8\sin x \cos x\,\mathrm dx\\ &= 4\int_0^{\pi/2}\sin 2x\,\mathrm dx\\ &= 4\text{.} \end{align}

As @rubik's answer explains, your antiderivatives are incorrect, and that is where the confusion comes from.

If I were doing this, I'd just imagine expanding both 4th powers, see that there would be a lot of cancellation alternating with doubling up, and leave you with \begin{align} &\phantom{{}={}}\int_0^{\pi/2}\left(8\sin^3(x)\cos(x)+8\sin(x)\cos^3(x)\right)\,dx\\ &=\int_0^{1}8u^3\,du+\int_1^{0}-8v^3\,dv\\ &=16\int_0^{1}u^3\,du\\ &=16\cdot\frac{1}{4} \end{align}

I we recall that: $$\cos^4\theta-\sin^4\theta = (\sin^2\theta+\cos^2\theta)(\cos^2\theta-\sin^2\theta) = \cos(2\theta)$$ it follows, with trivial manipulations:

$$\begin{eqnarray*} &&\int_{0}^{\pi/2}\left[\left(\sin x+\cos x\right)^4-\left(\sin x-\cos x\right)^4\right]\,dx\\&=&4\int_{0}^{\pi/2}\left[\cos(x-\pi/4)^4-\sin(x-\pi/4)^4\right]\,dx\\&=&4\int_{-\pi/4}^{\pi/4}\left[\cos^4\theta-\sin^4\theta\right]\,d\theta\\&=&4\int_{-\pi/4}^{-\pi/4}\cos(2\theta)\,d\theta\\&=&2\int_{-\pi/2}^{\pi/2}\cos\theta\,d\theta=\color{red}{4}.\end{eqnarray*}$$