y= 2 (sin(x))^2 -2sin(x)-1
dy/dx= 2*2 (sin(x))^1 cos(x) -2cos(x)
dy/dx= 2 * 2sin(x)cos(x) -2cos(x) = 2sin(2x) -2cos(x) //by double angle formula
d^2y/ dx^2 = 4cos(2x) +2sin(x)
The text probably did not simplify the 4sin(x)cos(x) , they probably did a product rule on it. Their answer probably looks different but it is still equivalent.