# Problem with solution for non homogeneous differential equation

I am trying to solve this non-homogeneous equation, but my answer is a bit off for some reason:

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

I had $$y_c=c_1e^{2x}+c_2e^{-2x}$$ Then for $y_p$, I used $y_p=Ax^2+Bx+C+De^{2x}$, so: $$y'_{p}-4y_p=2A+4De^{2x}-4(Ax^2+Bx+C+De^{2x})$$ $$=-4Ax^2-Bx-4C+2A$$ Therefore,

$$-4Ax^2-Bx-4C+2A=x^2+3e^{2x}$$

After I solve for the coefficients, I get $$y_p=-\frac{1}{4}x^2-\frac{3}{4}e^{2x}-\frac{1}{8}$$

But the actual solution is $$y_p=-\frac{1}{4}x^2+\frac{3}{4}\color{red}{x}e^{2x}-\frac{1}{8}$$

I don't see what I'm doing wrong...

Any help is appreciated

• you need $Axe^{2x}$ in the form for $y_P$ because the differential is being forced by a homogenous solution. – abel Mar 24 '15 at 0:23
• @abel So I would need $y_p=Ax^2+Bx+C+Dxe^{2x}+Ee^{2x}$ ? – Alti Mar 24 '15 at 0:25
• not the $E$, just an $x$ multiplied to the $D$, since $e^{2x}$ is part of the homogeneous solution – Brent Mar 24 '15 at 0:26
• you don't need $e^2x$ because it is a solution of the homogenous equation. – abel Mar 24 '15 at 0:26

The problem is that your $De^{2x}$ term is being cancelled out because it is a solution to $y_c = 0$. It is part of your homogeneous solution.

Resolve this by instead using the term $Dxe^{2x}$.(Though any term of the form $p(x)e^{2x}$ for some polynomial $p$ of degree $n \ge 1$ would work as well.)

$\color{blue}{\text{edit}}:$ Now I'm not sure that the above parenthetical remark is correct. Can anyone confirm?

Responding to the question below:

If you see that a summand is included in the complementary solution then you know that the problem is incoming. $De^{2x}$ can be written in the form $c_1e^{2x} + c_2e^{-2x}$. When the $e^{2x}$ disappeared from your fourth equation, that's a reason to become suspicious!

Note that in general multiplying it by $x$ might not be enough to exclude it from a $y_c$; you might need a polynomial of higher degree, such as $x^2$.

• Thanks! Is there a way I can check this before I attempt to solve the entire solution? – Alti Mar 24 '15 at 0:35
• @Alti See my edited answer. – GFauxPas Mar 24 '15 at 0:41
• try finding the differential equation satisfied by the new variable $v$ defined by $ve^{2x} = y.$ you ill clearly what kind $p$ will be needed. – abel Mar 24 '15 at 0:59
• See my answer here: math.stackexchange.com/a/1203257/115115, I believe wikipedia and some textbooks have more extensive descriptions. – LutzL Mar 24 '15 at 5:47