# Trouble with a nonhomogeneous differential equation $y''-3y'=1+x$

I'm trying to find a general solution to: $$\frac{d^2y}{dx^2} - 3\frac{dy}{dx} = 1+x$$

Firstly I've found the complementary function, by solving the homogeneous version of the D.E above, and I've got that it's: $$y(x) = A + Be^{3x}$$

Now for the particular solution, I've tried $y=Px+Q \implies y'=P$ and $y''=0$, so subbing back into the D.E, I get: $$-3P = 1 + x \\ P = -\frac{1}{3}-\frac{x}{3}$$ So $$y=(-\frac{1}{3}-\frac{x}{3})x = -\frac{x}{3}-\frac{x^2}{3}$$

Therefore my general solution is $$y(x) = A + Be^{3x} -\frac{x}{3}-\frac{x^2}{3}$$

But this is not right, I'm not sure where I've gone wrong.

• If you look for a particular solution $y(x)=Px+Q$, your $P$ cannot depend on $x$... Try rather $y(x)=ax^2+bx$ for the particular solution. – Did May 3 '14 at 11:01
• @Did Is this because there is a constant in the complementary function and on the RHS of the non-homogeneous differential equation? – Michael May 3 '14 at 11:02
• @Michael Yes. Suppose you just had the inhomogeneous equation $y''-3y'=1$. If you try to find a constant solution $y_p=c$ to the inhomogeneous equation, you get $c''-3c'=1$ which reduces to $0=1$. – David H May 3 '14 at 11:08
• @DavidH Alright thanks, it makes more sense now :) – Michael May 3 '14 at 11:10
• It helps to split the equation into two parts and find the $Y_p$ for each one... $y''-3y'=1$ and $y''-3y=x$ – usukidoll May 3 '14 at 11:21

Since $0$ is a root for the characteristic equation then the particular solution take the form $$ax^2+bx^2+c$$ so substitute this polynomial in the differential equation and find the coefficients $a,b$ and $c$.
If we have an ODE $$ay''+by'+cy=P(x)e^{\alpha x}$$ then to find a particular solution there are three cases:
• If $\alpha$ isn't a root to the characteristic equation so a particular solution to the ODE take the form $$Q(x)e^{\alpha x}$$ where $Q$ is a polynomial with $\deg Q=\deg P$.
• If $\alpha$ is a simple root to the characteristic equation so a particular solution to the ODE take the form $$Q(x)e^{\alpha x}$$ where $Q$ is a polynomial with $\deg Q=\deg P+1$.
• If $\alpha$ is a root to the characteristic equation with multiplicity $2$ so a particular solution to the ODE take the form $$Q(x)e^{\alpha x}$$ where $Q$ is a polynomial with $\deg Q=\deg P+2$.