# Example: Solve a Second Order Nonhomogeneous ODE with Constant Coefficients by Variation of Parameters (2R-17)

Problem to solve:

$$(D^2-2D+1)y=\frac{e^x}{x^3}$$

$$y=(c_1+c_2x)e^x+\frac12\frac{e^x}{x}$$

Our solution begins by rewriting the ODE in a more familiar form:

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

This is of the linear second order type $y''+p(x)y'+q(x)y=r(x)$ where $p(x)$ and $q(x)$ may also be constants.

The characteristic equation $(\lambda-1)^2=0$ yields:

$$y_h=(c_1+c_2x)e^x$$

To solve for the particular solution by Variation of Parameters we first extract $y_1$ and $y_2$ from $y_h$ while holding $c_1=1$ and $c_2=1$:

$$y_1=e^x, y_2=xe^x$$

We now compute the Wronskian giving us:

$$W=\begin{bmatrix} e^x & xe^x \\ e^x & e^x+xe^x \end{bmatrix} = e^{2x}$$

Also note that:

$$r=e^xx^{-3}$$

We are now ready to proceed in finding the particular solution:

$$y_p=y_{p1}+y_{p2}$$

where:

$$y_{p1}=-y_1\int\frac{y_2 \cdot r}{W}dx=-e^x\int\frac{xe^x \cdot e^xx^{-3}}{e^{2x}}dx=\frac{e^x}{x}$$

$$y_{p2}=y_2\int\frac{y_1 \cdot r}{W}dx=xe^x\int\frac{e^x \cdot e^xx^{-3}}{e^{2x}}dx=-\frac{1}{2}\frac{e^x}{x}$$

Hence:

$$y_p=y_{p1}+y_{p2}=\frac{e^x}{x}-\frac{1}{2}\frac{e^x}{x}=\frac{1}{2}\frac{e^x}{x}$$

Our solution is:

$$y=y_h+y_p=(c_1+c_2x+\frac{1}{2x})e^x$$

Edit: I initially had difficulty replicating the answer given in the text but the solution came to me as I created this post so there was no need to ask a question. Thanks to all for your input.

• What's the question? You got the same result as the book. Jan 24, 2015 at 3:46
• maybe you want the solution verification tag? Is the question simply: is my solution correct? That is a valid question. Jan 24, 2015 at 5:30
• It started out as a "where did I go wrong" post but in the process of typing it the solution came to me. This often happens to me. However I did not want to discard this post so I rewrote it as an example (see title). I especially like this problem because I opted (I could use any method) to solve it by Variation of Parameters which was not really derived for ODE's with constant coefficients. Jan 24, 2015 at 22:28
• Thank you for taking my post off hold. Jan 26, 2015 at 20:13

$$(D^2-2D+1)y=\frac{e^x}{x^3}$$ $$y_h=(c_1+c_2x)e^x$$ Now let's get a particular solution： $$y_p=\frac{1}{D^2-2D+1}\frac{e^x}{x^3}=\frac{1}{(D-1)^2}\frac{e^x}{x^3}=e^x\frac{1}{D^2}\frac{1}{x^3}=e^x\int\int\frac{1}{x^3}dxdx=e^x\frac{1}{2x}=\frac{1}{2x}e^x$$ It's the same as your solution. I think it's easier.