<s>[INST] 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?
 [/INST] 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}$$
</s>