Evaluate trig function integral I was struggling to evaluate this integral:
$$\int x\sin^2(4x)\;dx$$
Every time I try again I end up with a different answer, my most recent answer I came up with is 
$$-\frac1{12} x\cos^3(4x) + \frac1{16}\sin^4(4x) + C$$
but I was wrong again.
I don't have a reference for what the answer actually is because we have to do the work online and we don't know the correct answer until we submit the correct one. I was just seeing if anyone could point me the right direction. 
Thank you!
-Frank
 A: Using $\cos 2A = 1 - 2\sin^2 A$ we get
$$\int x\sin^2 4x\,\mathbb d x = \int \tfrac12 x(1-\cos 8x)\, \mathbb d x$$
And
$$\int x\cos 8x \, \mathbb d x = \tfrac18x\sin 8x - \tfrac18 \int \sin 8x \, \mathbb d x$$
So $$\int x\sin^2 4x\,\mathbb d x = - \tfrac1{16}x\sin 8x +\int \tfrac12 x  + \tfrac1{16} \int \sin 8x \, \mathbb d x$$
A: Consider the integral
\begin{align}
I = \int x \, \sin^{2}(4x) \, dx.
\end{align}
Using $2 \sin^{2}(x) = 1 - \cos(2x)$ then 
\begin{align}
2 I &= \int x (1 - \cos(8x)) \, dx \\
&= \frac{x^{2}}{2} - \int x \, \cos(8x) \, dx.
\end{align}
Using integration by parts yields
\begin{align}
\int x \cos(8x) \, dx &= \frac{x \sin(8x)}{8} - \int \sin(8x) \, dx \\
&= \frac{x \sin(8x)}{8} + \frac{\cos(8x)}{64}
\end{align}
for which
\begin{align}
I = \frac{x^{2}}{4} - \frac{x \sin(8x)}{16} -\frac{ \cos(8x)}{128}. 
\end{align}
Thus
\begin{align}
\int x \, \sin^{2}(4x) \, dx = \frac{x^{2}}{4} - \frac{x \sin(8x)}{16} - \frac{\cos(8x)}{128}.
\end{align}
A: Here's one way to go about it: consider that $1-2\sin^2x=\cos 2x\implies \sin^2x=\frac12(1-\cos2x)\implies \sin^24x=\frac12(1-\cos8x)$. Now perform an integration by parts, using
$u=x,dv=\sin^24x=\frac12(1-\cos8x)\:dx$
$du=dx,v=\frac12(x-\frac18\sin8x)$
then,
$$\int x\sin^2(4x)\;dx=\int u\:dv=uv-\int v\:du=\frac12x^2-\frac1{16}x\sin8x-\frac12\int\left(x-\frac18\sin8x\right)dx=\frac12x^2-\frac1{16}x\sin8x-\frac12\left(\frac12x^2+\frac1{64}\cos8x\right)+C$$
$$=\frac14x^2-\frac1{16}x\sin8x-\frac1{128}\cos8x+C$$
However, this is only one possible form of the answer, as there are lots more you can get by using trig identities. It also makes it difficult to check your work, as the derivative will often be in a different form than the original integral. It's usually easier to check your steps for trigonometric integrals than to check by differentiating, so make sure all your steps were valid.
