Recall that
cos(x + y) = cos(x) cos(y) - sin(x) sin(y)
cos(x - y) = cos(x) cos(y) + sin(x) sin(y)
If you subtract the first equation from the second one, you end up with
cos(x - y) - cos(x + y) = 2 sin(x) sin(y)
so that
sin(3x) sin(x) = 1/2 (cos(3x - x) - cos(3x + x)) = 1/2 (cos(2x) - cos(4x))
Then in the integral,