y"+2y'+2y = g(x), and g(x) = e^(-x).cos x
The auxiliary equation is,
m^2 + 2m + 2 = 0
(m+1)^2 + 1 = 0
m1 = 1 + i, m2 = 1 - i
complementary solution is y = e^(-x)(Acosx + Bsinx)
or y = A.e^(-x).cosx + B.e^(-x).sinx
i.e. y = A.y1 + B.y2
where, y1 = e^(-x).cosx, y2 = e^(-x).sinx
The solution by variation of parameters is,
Y = u1.y1 + u2.y2
where,
u1 = -int(y2 * g / W) dx
u2 = int(y1 * g / W) dx
and where W is Wronskian of y1 and y2 and W = W(y1, y2) = y1*y2' - y2*y1'
W = e^(-x).cosx(-e^(-x).sinx + e^(-x).cosx) - e^(-x).sinx.(-e^(-x).cosx - e^(-x).sinx)
W = e^(-2x).(-cosx.sinx + cos^2x) + e^(-2x).(cosx.sinx + sin^2x)
W = e^(-2x).(cos^2x + sin^2x)
W = e^(-2x)
Now,
u1 = -int(y2 * g / W) dx
u1 = -int(e^(-x).sinx * e^(-x).cos x) / e^(-2x) ) dx = -int(sinx.cosx) dx
u1 = (1/2)cos^2x + c1
u2 = int(y1 * g / W) dx
u2 = int(e^(-x).cosx * e^(-x).cosx / e^(-2x) ) dx = int(cos^2x) dx = (1/2)*int(1+cos2x) dx
u2 = (1/2)(x + sinx.cosx) + c2
Substituting for u1 and u2 to give the final solution,
Y = y1.u1 + y2.u2
Y = e^(-x).cosx((1/2)cos^2x + c1) + e^(-x).sinx((1/2)(x + sinx.cosx) + c2)
Y = e^(-x){(1/2)cos^3x + c1.cosx + (1/2).x.sinx + (1/2).sin^2x.cosx + c2.sinx}
Y = e^(-x){(1/2)cosx(cos^2x + sin^2x) + c1.cosx + (1/2)x.sinx + c2.sinx}
Y = e^(-x){cosx((1/2) + c1) + sinx((1/2)x + c2)}