y'' - 2y' + y = 0

gives y = Ae^(-x) + Bxe^(-x)

Let y = 5e^(2x)

y' = 10e^(2x)

y'' = 20e^(2x)

So y'' - 2y' + y = 20e^(2x) - 20e^(2x) + 5e^(2x) = 5e^(2x)

Let y = cos 3x

y' = -3 sin 3x

y'' = -9 cos 3x

y'' - 2y' + y = -9 cos 3x + 6 sin 3x + cos 3x = 6 sin 3x - 8 cos 3x

So have y'' - 2y' + y = 6 sin 3x - 8 cos 3x + 5e^(2x)

Need boundary condition for the A and B above as need A = 2, B =-3

y = 5e^(2x) + Ae^(-x) + Bxe^(-x) + cos 3x

x = 0, y = 6 + A

Want A = 2 so y = 8

y' = 10e^(2x) - 2e^(-x) + Be^(-x) - Bxe^(-x) - 3 sin 3x

x = 0, y' = 8 + B

Want B = -3 so y' = -11

So differential equation y'' - 2y' + y = 6 sin 3x - 8 cos 3x + 5e^(2x) subject to boundary conditions y' = -11 and y = 8 when x = 0

EDIT: I forget what homogeneous means so if this isn't homogeneous you will need to adapt this method to make one that is