Because of the x out front of the cos you have to choose something along the lines of:
In order to take care of the derivatives where you will have mixed x's on the sines and cosines.
I didn't try to solve it, but I believe this is correct. Give it a shot .
Hope it helps!