# Modification of the particular solution of a nonhomogenous 2nd order ODE

Studying engineering mathematics, I came up with this question.

$$y''(x) \ - \ y'(x) \ = \ \frac{1}{2}e^x$$

From the LHS the characteristic equation gives

$$\lambda = 0, 1$$

and thus the general solution to the homogenous equation is

$$y_h(x)=Ae^{0x}+Be^x = A+Be^x$$

where A and B are constants.

However after that I want to find the particular solution and I wondered:

Is it ok to use $$y_p(x)=e^x$$? or do I have to use $$y_p(x)=xe^x$$?

I extended this idea. For the ODE $$y''+py'+qy=r(x)$$ where p and q are constants and r(x) is trigonometric, exponential or polynomial function, let's assume that the homogenous solution can be expressed in the form $$y_h(x)=Cf(x)+Dg(x)$$ where C and D are constants. And I recognise from r(x) that the ansatz for the particular solution should be $$y_p(x)=Eg(x)$$.

In this case, do I modify the ansatz by multiplying by $$x$$, i.e., setting $$y_p(x)=xEg(x)$$, or do I leave it as it was since $$g(x)$$ is different from $$f(x)+g(x)$$?

• If $y=Ce^X$ is a solution the homogeneous equation, then you already know that $y''-y' = 0 \ne \frac12e^x$, so it won’t work as a particular solution. – amd Apr 18 '20 at 7:48
$$1)$$For the particular solution the guess should be: $$y_p=Cxe^x$$ Since $$e^x$$ is already part of the homogeneous solution.
Note that you can rewrite the DE: $$y''(x) \ - \ y'(x) \ = \ \frac{1}{2}e^x$$ As: $$( y'(x)e^{-x})'= \ \frac{1}{2}$$ And integrate twice.
$$2)$$For the second question in that case, you may have to multiply by $$x$$ or $$x^2$$ the ansatz if it's part of the solution to the homogeneous DE. This is the rule for a second order linear DE with constant coefficients as you stated.
$$y''-y'=\frac{1}{2}e^x~~~~(1)$$ Let $$y'=z$$, then $$z'-z=\frac{1}{2}e^x$$ this is linear ODE where integrating factor is $$e^{-x}$$. So $$z=\frac{1}{2}e^{x}\int e^{x} e^{-x} dx+Ae^{x} \implies z=\frac{1}{2}xe^x+Ae^x\implies y'=\frac{1}{2}xe^x+Ae^c$$ Integrating it we get $$y(x)=\frac{1}{2}e^x+\frac{1}{2}xe^x+Ae^x+B$$ This may also be written as $$y(x)=\frac{1}{2}xe^x+Ce^x+B,~ C=A+1/2,$$ which is the total solution of (1), where $$\frac{1}{2}xe^x$$ gets justified as the particular solution of (1).