Problem 188
Hard Initial-Value Problems

Find the general solution of xy'' + 2y' - xy = e^x

Find the general solution of $xy'' + 2y' - xy = e^x$.

Explanation of Method

The substitution $u=xy$ removes the $2/x$-type coupling, collapsing the equation to the constant-coefficient $u''-u=e^x$, solved at resonance and translated back.

Step 1: Choosing the substitution $u=xy$

The combination $xy''+2y'$ is exactly what appears when $u=xy$ is differentiated twice and the resonant terms are stripped away; this motivates setting

\[ u = xy, \qquad \text{i.e.} \qquad y = \frac{u}{x}, \]

with $u=u(x)$ the new unknown function.

Step 2: Transforming the derivatives

Differentiating $y=u/x=ux^{-1}$ twice by the product rule: \[y' = \frac{u'}{x} - \frac{u}{x^2}, \qquad y'' = \frac{u''}{x} - \frac{2u'}{x^2} + \frac{2u}{x^3}.\]

Step 3: Substituting into the equation

Multiplying each transformed derivative by its coefficient in $xy''+2y'-xy$: \[xy'' = u'' - \frac{2u'}{x} + \frac{2u}{x^2}, \qquad 2y' = \frac{2u'}{x} - \frac{2u}{x^2}, \qquad -xy = -u.\]

Adding all three, the $2u'/x$ terms cancel and the $2u/x^2$ terms cancel, leaving

\[ xy''+2y'-xy = u'' - u. \]

So the equation collapses to a constant-coefficient equation in $u$: $u'' - u = e^x$.

Step 4: Homogeneous solution

The characteristic equation $r^2-1=0$ has roots $r=\pm1$, so

\[ u_h = C_1e^x + C_2e^{-x}. \]

Step 5: Particular solution (resonant case)

Since the forcing term $e^x$ coincides with the homogeneous solution $e^x$ (i.e.\ $r=1$ is a simple root of the characteristic equation), the standard trial $u_p=Ae^x$ must be promoted to $u_p=Axe^x$. Then

\[ u_p' = A(1+x)e^x, \qquad u_p'' = A(2+x)e^x. \]

Substituting into $u''-u=e^x$: \[A(2+x)e^x - Axe^x = 2Ae^x = e^x \;\Longrightarrow\; A = \frac12.\]

So $u_p=\dfrac{x}{2}e^x$, and the general solution for $u$ is

\[ u = C_1e^x + C_2e^{-x} + \frac{x}{2}e^x. \]

Step 6: Back-substituting $y=u/x$

The solution is recorded in the result below.

Step 7: Verification — homogeneous piece

For $y_1=e^x/x$, the quotient/product rule gives $y_1'=\dfrac{(x-1)e^x}{x^2}$, and differentiating once more, $y_1'' = \frac{(x^2-2x+2)e^x}{x^3}$.

Substituting into $xy''+2y'-xy$, writing every term over $x^2$: \[xy_1''+2y_1'-xy_1 = \frac{(x^2-2x+2)e^x}{x^2} + \frac{2(x-1)e^x}{x^2} - e^x = \frac{e^x\bigl[(x^2-2x+2)+(2x-2)\bigr]}{x^2} - e^x = e^x - e^x = 0.\ \checkmark\]

(The same computation with $x\to -x$ confirms $y_2=e^{-x}/x$.)

Step 8: Verification — particular piece

For $y_p=e^x/2$ (the surviving term of $u_p/x=(x/2)e^x/x$), $y_p'=y_p''=e^x/2$. Substituting: \[xy_p''+2y_p'-xy_p = x\cdot\frac{e^x}{2} + 2\cdot\frac{e^x}{2} - x\cdot\frac{e^x}{2} = e^x,\]

the two $xe^x/2$ terms cancelling and leaving exactly $e^x$ from the $2y_p'$ term.\ $\checkmark$


Result

Final answer:

\[\boxed{\,y = \frac{C_1e^x}{x} + \frac{C_2e^{-x}}{x} + \frac{e^x}{2}\,}\]

Remark

Independence of $y_1,y_2$ — Wronskian. In standard form $y''+(2/x)y'-y=e^x/x$, Abel's formula with $P(x)=2/x$ predicts $W(x)=C/x^2$. Direct computation, using $y_1'$ above and $y_2'=-\dfrac{(x+1)e^{-x}}{x^2}$, gives

\[ W = y_1y_2'-y_1'y_2 = \frac{-(x+1)-(x-1)}{x^3} = -\frac{2}{x^2} \neq 0, \]

confirming $\{y_1,y_2\}$ is a genuine fundamental system, consistent with the Abel prediction.