Problem 190
Hard Initial-Value Problems

Solve the initial value problem y'' - 2xy' + (x^2+2)y =…

Solve the initial value problem $y'' - 2xy' + (x^2+2)y = e^{(x^2+2x)/2}$, with $y(0)=\dfrac14, \qquad y'(0)=\dfrac12$.

Explanation of Method

Peeling off a Gaussian factor with $y=e^{x^2/2}v(x)$ reduces this IVP to the constant-coefficient equation $v''+3v=e^x$, solved and matched to the given initial data.

Step 1: Choosing the substitution $y=e^{x^2/2}v(x)$

The coefficients $-2x$ and $x^2+2$ are exactly what arises when a Gaussian-type factor $e^{x^2/2}$ is peeled off a second derivative; this suggests setting

\[ y = e^{x^2/2}v(x) \]

for a new unknown function $v(x)$, to absorb the $x$-dependent coefficients.

Step 2: Transforming the derivatives

By the product rule, using $\dfrac{d}{dx}e^{x^2/2}=xe^{x^2/2}$: $y' = e^{x^2/2}\bigl(v'+xv\bigr)$.

Differentiating again: \[y'' = xe^{x^2/2}\bigl(v'+xv\bigr) + e^{x^2/2}\bigl(v''+v+xv'\bigr) = e^{x^2/2}\bigl(v''+2xv'+v+x^2v\bigr).\]

Step 3: Substituting into the equation

Factor $e^{x^2/2}$ out of $y''-2xy'+(x^2+2)y$: \[\bigl(v''+2xv'+v+x^2v\bigr) - 2x\bigl(v'+xv\bigr) + (x^2+2)v = v'' + \underbrace{2xv'-2xv'}_{0} + \underbrace{x^2v-2x^2v+x^2v}_{0} + v + 2v.\]

All the $x$-dependent terms cancel exactly, leaving

\[ y''-2xy'+(x^2+2)y = e^{x^2/2}\bigl(v''+3v\bigr). \]

On the right, dividing the forcing term by the same factor $e^{x^2/2}$: $\frac{e^{(x^2+2x)/2}}{e^{x^2/2}} = e^{(x^2+2x-x^2)/2} = e^x$.

So the equation reduces to the constant-coefficient equation

\[ v'' + 3v = e^x. \]

Step 4: Solving for $v(x)$

The characteristic equation $r^2+3=0$ has roots $r=\pm i\sqrt3$, so $v_h=C_1\cos(\sqrt3x)+C_2\sin(\sqrt3x)$. Since $r=1$ is not a root, try $v_p=Ae^x$: $v_p''+3v_p=Ae^x+3Ae^x=4Ae^x=e^x\Rightarrow A=1/4$. Hence

\[ v = C_1\cos(\sqrt3x) + C_2\sin(\sqrt3x) + \frac{e^x}{4}. \]

Step 5: Back-substituting $y=e^{x^2/2}v$

\[ y = e^{x^2/2}\left[C_1\cos(\sqrt3x) + C_2\sin(\sqrt3x) + \frac{e^x}{4}\right]. \]

Step 6: Applying $y(0)=1/4$

At $x=0$: $e^{0}=1$, $\cos0=1$, $\sin0=0$, so

\[ y(0) = C_1 + \frac14 = \frac14 \;\Longrightarrow\; C_1 = 0. \]

With $C_1=0$, the solution simplifies to $y=e^{x^2/2}\bigl[C_2\sin(\sqrt3x)+e^x/4\bigr]$.

Step 7: Applying $y'(0)=1/2$

Differentiating the product $y=e^{x^2/2}\cdot w$, with $w=C_2\sin(\sqrt3x)+e^x/4$: $y' = xe^{x^2/2}w + e^{x^2/2}w', \qquad w' = \sqrt3\,C_2\cos(\sqrt3x) + \frac{e^x}{4}$.

At $x=0$, the first term vanishes (its factor $x=0$), and $e^{0}=1$, so

\[ y'(0) = w'(0) = \sqrt3\,C_2 + \frac14 = \frac12 \;\Longrightarrow\; \sqrt3\,C_2 = \frac14 \;\Longrightarrow\; C_2 = \frac{1}{4\sqrt3} = \frac{\sqrt3}{12}. \]

Step 8: Solution

Equivalently, factoring $e^{x^2/2}/12$ out of both terms (using $e^{x^2/2}e^x=e^{(x^2+2x)/2}$): $y = \frac{e^{x^2/2}}{12}\Bigl[\sqrt3\sin(\sqrt3x) + 3e^x\Bigr]$.

Step 9: Verification

Check the initial conditions directly: $y(0)=\dfrac{\sqrt3}{12}\cdot1\cdot0+\dfrac14\cdot1=\dfrac14.\ \checkmark$ And $y'(0)=\sqrt3\,C_2+\dfrac14=\sqrt3\cdot\dfrac{\sqrt3}{12}+\dfrac14=\dfrac{3}{12}+\dfrac14=\dfrac14+\dfrac14=\dfrac12.\ \checkmark$

For the differential equation itself, it suffices (by the reversibility of Step 3) to verify $v''+3v=e^x$ for $v=C_2\sin(\sqrt3x)+e^x/4$. The homogeneous piece satisfies

\[ \frac{d^2}{dx^2}\bigl[C_2\sin(\sqrt3x)\bigr] = -3C_2\sin(\sqrt3x), \qquad \text{so} \qquad v_h''+3v_h = -3C_2\sin(\sqrt3x)+3C_2\sin(\sqrt3x)=0 \]

identically, for every $C_2$. The particular piece $v_p=e^x/4$ satisfies $v_p''=e^x/4$, so

\[ v_p''+3v_p = \frac{e^x}{4}+\frac{3e^x}{4} = e^x.\ \checkmark \]

Hence $v''+3v=e^x$ holds identically, and since Step 2–3 showed $y''-2xy'+(x^2+2)y=e^{x^2/2}(v''+3v)$ is an exact algebraic identity (no approximation), multiplying through by $e^{x^2/2}$ confirms that the boxed $y$ satisfies the original equation $y''-2xy'+(x^2+2)y=e^{(x^2+2x)/2}$ exactly.


Result

Final answer:

\[\boxed{\,y = \frac{\sqrt3}{12}\,e^{x^2/2}\sin(\sqrt3x) + \frac14\,e^{(x^2+2x)/2}\,}\]

Remark

Remark. The Gaussian factor $e^{x^2/2}$ is nowhere zero, so $y=e^{x^2/2}v$ is a genuine bijection between solutions $y$ and solutions $v$; no solutions are gained or lost in the transformation, and the reduction to a constant-coefficient equation for $v$ is exact for all real $x$.