# Method of undetermined coefficients exponential and x

Having an issue solving an inhomogeneous equation with the method of undetermined coefficients. The question is:

$y''+4y'+4y=x+e^{-2x}$

I've tried working it out but end up getting:

$4Ce^{-2x}x^2-8Ce^{-2x}x+2Ce^{-2x}+4A+8Cxe^{-2x}-8e^{-2x}Cx^2+4Ax+4B+4Cx^2e^{-2x}$

When I use $Y_p (x)=Ax+B+Cx^2e^{-2x}$

I'm unsure what to do next any assistance would be great!

• Substitute $y_p$ in given DE. – Nitin Uniyal Apr 26 '17 at 11:51

The ansatz for $y_p(x)$ you provided is a good one. What you have to do is substitute the particular solution into your ODE: $$y_p(x)=Ax+B+Cx^2 e^{-2x}$$ $$\frac{d y_p(x)}{dx}=A+2Cxe^{-2x}-2Cx^2 e^{-2x}$$ $$\frac{d^2 y_p(x)}{dx^2}=2Ce^{-2x}-8Cxe^{-2x}+4Cx^2 e^{-2x}$$ Hence, we obtain: $$\small 2Ce^{-2x}-8Cxe^{-2x}+4Cx^2 e^{-2x}+4(A+2Cxe^{-2x}-2Cx^2 e^{-2x})+4(Ax+B+Cx^2 e^{-2x})=x+e^{-2x}$$ The $xe^{-2x}$ and $x^2e^{-2x}$ terms cancel. After simplification: $$\color{blue}{(4A+4B)}+\color{red}{2Ce^{-2x}}+\color{green}{4Ax}=\color{red}{e^{-2x}}+\color{green}{x}$$ Now that we grouped the terms together, it just remains to equate their coefficients and solve the system: $$\begin{cases} 4A+4B=0 \\ 2C=1 \\ 4A=1 \end{cases}$$ Can you continue?