Rewrite the given equation as (D2 + 1)y = tanx
Here A.E D2 + 1 = 0 or D = ±i
Thus yC.F.(x) = c1y1 + c2y2 = c1cosx + c2 sinx
Assume yP.I.(x) = u1(x) y1 + u2(x) y2 = u1cosx + u2 sinx
By method of variation of parameter, we have
On integration,
u1(x) = ∫-sin xtanxdx = -∫sin xsinx/cos2 x - 1/cos x dx
= ∫(cos x - sec x)dx = sinx - log(sec x + tan x)
and u1(x) = ∫cos xtan xdx = ∫sin xdx = -cos x
Whence yP.I. (x) = cosx[sinx - log(sec x + tan x)] + sin x(-cos x)
= -cosx log(sec x + tan x)
And therefore the complete solution becomes,
y = (c1cosx + c2sinx) - (cosx) log(sec x + tan x)