Solving linear inhomogeneous differential equation

ordinary differential equations

I wanted to solve $$y''-2y'-3y=4e^{-x}+1$$
for which I got the homogeneous solution $$y_h=C_1e^{-x}+C_2e^{3x}, \quad C_1,C_2 \in \mathbb R.$$

Then by plugging particular solution of the form
$$y_p=Ae^{-x}+Bx^2+Cx+D$$
and it's derivatives into my differential equation I get
$$Ae^{-x}+2B+2Ae^{-x}-4Bx-2C-3Ae^{-x}-3Bx^2-3Cx-3D=4e^{-x}+1$$ which reduces to
$$-3Bx^2-x(4B+3C)+2B-2C-3D=4e^{-x}+1$$
which could never hold true since the $A$ terms vanished. What did I do wrong?

Best Answer

Hint: Compute the complementary solution by the ansatz $$y=e^{\lambda x}$$ The solution is given by $$y=C_1e^{-x}+C_2e^{3x}$$. For the particular solution make the ansatz $$y_P=a_1+a_2xe^{-x}$$ A possible solution is given by $$y_p=-e^{-x}x-\frac{1}{3}$$

Related Question