A.E. is
m2 + 1 = 0
m = ± i
C.F. = C1cos x + C2sin x
Note that both cos x and sin x are common in the C.F. and the R.H.*. of the given equation. Now P.I. corresponding to 4x cos x is of the form
y1 = x {(a + bx) cos x + (c + dx) sin x}
and P.I. corresponding to 2 sin x is
y2 = x {e cos x + f sin x}
Hence, we take P.I. in the form
yp = y1 + y2 = (ax + xe + bx2) cos x + (cx + fx + dx2) sin x
= {(a + e) x + bx2} cos x + {(c + f)x + dx2} sin x
P.I. must be of the form a + e = c1, b = c2 c + f = c3, d = c4
yp = (c1x + c2x2) cos x + (c3x + c4x2) sin x ...(1)
Differentiating, we get
y′p = (c1x + c2x2) (– sinx) + cosx (c1 + 2xc2) + (c3x + c4x2) cos x + sin x (c3 + 2xc4)
y"p = (c1 x + c2 x2)(– cos x) + (– sin x) (c1 + 2xc2) + cos x (2c2) + (c1 + 2xc2) (– sin x) + (c3x + c4x2) (– sin x) + (cos x) (c3 + 2xc4) + sin x (2c4) + (c3 + 2xc4) cos x
y"p = [(– 2c1 + 2c4 ) + (– 4c2 – c3)x – c4 x2] sin x + [(2c2 + 2c3) + (4c4 – c1)x – c2x2] cos x
Substituting these values in the given equation and simplifying, we get
{(2c2 + 2c3) + 4c4x}cos x + {(– 2c1 + 2c4) – 4c2x} sin x
= 4x cos x – 2 sin x
Comparing the coefficients, we obtain,
2c2 + 2c3 = 0, 4c4 = 4, 2c1 + 2c4 = – 2, 4c2 = 0
Solving we get c2 = 0, c4 = 1 and hence c3 = 0, c1 = 2
From Eqn. (1), the required P.I. is
yp = (2x + 0) cos x + (0x + x2) sin x = 2x cos x + x2 sin x
= 2x cosx + x2sin x
∴ The general solution is
y = C.F. + P.I.
= C1cos x + C2sin x + 2xcos x + x2sin x.