The forcing function is cos(x), so your particular solution would ordinarily be y = A sin(x) + B cos(x). However, since cos(x) is already a part of the homogeneous solution, you add x's to the particular solution like: y = A x sin(x) + B x cos(x). See if that works.