# Second-order inhomogeneous differential equation $y''\:-\:4y'\:+\:2y\:=\:2x^2$

I'm trying to solving a 2nd-order inhomogeneous differential equation, but I'm not sure with my answer since I'm only learned it by myself & it has nothing to do with school or homework, so I have no one to ask or correct my answer. Please if you want to help me, i would be really happy & appreciate your help & advice.

So here's my problem

$y''\:-\:4y'\:+\:2y\:=\:2x^2$

and here's my step to answer

I know that to solve this 2nd-order inhomogeneous differential equation the general solution is

$y\:=\:y_c\:+\:y_p$

where $y_c$ is the general solution of the homogeneous equation. And $y_p$ is a particular solution

First, I find for $y_c$ through

$y''\:-\:4y'\:+\:2y\:=\:0$

since it's in the form of different roots of the auxiliary equation, i found that $m_1\:=\:2+\sqrt{2}$ and $m_2\:=\:2-\sqrt{2}$ , so the general solution of the homogeneous equation is

$y_c=c_1e^{\left(2+\sqrt{2}\right)x}+c_2e^{\left(2-\sqrt{2}\right)x}$

Second, since it's a polynomial problem so i find for $y_p$ through

$y_p=Ax^2+Bx+C$

first and second derivative of $y_p$ are

$y'_p=2Ax\:+\:B\:\:\:\:\:\:\:and\:\:\:\:\:\:\:\:y"_p=2A$

so now i have to find the undetermined coefficients $A$, $B$, and $C$. I find these coefficients through substitute $y_p$ into $y$, $y'_p$ into $y'$, and $y''_p$ into $y"$, thus

$y''\:-\:4y'\:+\:2y\:=\:\left(2A\right)x^2+\left(2B-8A\right)x\:+\:\left(2A-4B+2C\right)=2x^2$

So, $A\:=\:\frac{1}{2}\:,\:B\:=\:0,\:C\:=\:\frac{1}{2}$ and then substitute this into $y_p$, I find the particular solution which is

$y_p=\frac{1}{2}\left(x^2+1\right)$

and finally I find the general solution in the form of

$y\:=\:c_1e^{\left(2+\sqrt{2}\right)x}+c_2e^{\left(2-\sqrt{2}\right)x}+\frac{1}{2}\left(x^2+1\right)$

This is my answer, am I correct or not? Thank you for your time!

• No, can't be good as the only $x^2$ term in the LHS is $x^2$, while it is $2x^2$ in the RHS. Easier to start with $y=x^2+Ax+B$.
– user65203
Sep 17, 2014 at 13:33
• The second derivative should be typed as y'', not as y". (Compare the outputs: $y''$ and $y"$.) I also suggest cutting down the spending on emoticons; the freed up funds can be used to buy some uppercase letters.
– user147263
Sep 20, 2014 at 6:23

The equation is $$(D^{2}-4D+2)y=2x^{2}$$ Apply the annihilator $D^{3}$ of $x^{2}$ to obtain $$D^{3}(D^{2}-4D+2)y=0.$$ The general solution of this equation is $$f=e^{2x}(Ae^{\sqrt{2}x}+Be^{-\sqrt{2}x})+F+Gx+Hx^{2}.$$ Plugging back into the original equation eliminates the exponential terms and gives \begin{align} (D^{2}-4D+2)f & =(D^{2}-4D+2)(F+Gx+Hx^{2}) \\ & =(2H)-4(G+2Hx)+2(F+Gx+Hx^{2}) \\ & =(2H-4G+2F)+(-8H+2G)x+2Hx^{2}= x^{2}. \end{align} Therefore $$\begin{array}{l} H=1/2\\ -8H+2G=0 \implies G=4H=2 \\ 2H-4G+2F=0 \implies F=2G-H=4-1/2=7/2. \end{array}$$ The final solution is $$f = e^{2x}(Ae^{\sqrt{2}x}+Be^{-\sqrt{2}x})+\frac{7}{2}+2x+\frac{1}{2}x^{2}.$$ $A$ and $B$ are arbitrary constants.

Your steps look good. If you want to check the solution, plug the solution and its derivatives back into the original equation to see if it works.

Your $y_c$ part is fine but there is an error in $y_p$ part. Coefficients should be $A=1$, $B=4$ and $C=7$.

I would use various differential eq calculator to help, e.g,

The results show that the answer should be: yp = x^2+4x+7 enter image description here