2.2.31 Problem 31
Internal
problem
ID
[9154]
Book
:
Second
order
enumerated
odes
Section
:
section
2
Problem
number
:
31
Date
solved
:
Friday, February 21, 2025 at 09:21:55 PM
CAS
classification
:
[[_2nd_order, _linear, _nonhomogeneous]]
Solve
\begin{align*} y^{\prime \prime }-2 b x y^{\prime }+b^{2} x^{2} y&=x \end{align*}
Solved as second order ode using change of variable on y method 1
Time used: 6.024 (sec)
This is second order non-homogeneous ODE. Let the solution be
\[
y = y_h + y_p
\]
Where \(y_h\) is the solution to the homogeneous ODE \( A y''(x) + B y'(x) + C y(x) = 0\), and \(y_p\) is a particular solution to the non-homogeneous ODE \(A y''(x) + B y'(x) + C y(x) = f(x)\). \(y_h\) is the solution to
\[
y^{\prime \prime }-2 b x y^{\prime }+b^{2} x^{2} y = 0
\]
In normal form the given ode is written as
\begin{align*} y^{\prime \prime }+p \left (x \right ) y^{\prime }+q \left (x \right ) y&=0 \tag {2} \end{align*}
Where
\begin{align*} p \left (x \right )&=-2 x b\\ q \left (x \right )&=x^{2} b^{2} \end{align*}
Calculating the Liouville ode invariant \(Q\) given by
\begin{align*} Q &= q - \frac {p'}{2}- \frac {p^2}{4} \\ &= x^{2} b^{2} - \frac {\left (-2 x b\right )'}{2}- \frac {\left (-2 x b\right )^2}{4} \\ &= x^{2} b^{2} - \frac {\left (-2 b\right )}{2}- \frac {\left (4 x^{2} b^{2}\right )}{4} \\ &= x^{2} b^{2} - \left (-b\right )-x^{2} b^{2}\\ &= b \end{align*}
Since the Liouville ode invariant does not depend on the independent variable \(x\) then the transformation
\begin{align*} y = v \left (x \right ) z \left (x \right )\tag {3} \end{align*}
is used to change the original ode to a constant coefficients ode in \(v\). In (3) the term \(z \left (x \right )\) is given by
\begin{align*} z \left (x \right )&={\mathrm e}^{-\int \frac {p \left (x \right )}{2}d x}\\ &= e^{-\int \frac {-2 x b}{2} }\\ &= {\mathrm e}^{\frac {b \,x^{2}}{2}}\tag {5} \end{align*}
Hence (3) becomes
\begin{align*} y = v \left (x \right ) {\mathrm e}^{\frac {b \,x^{2}}{2}}\tag {4} \end{align*}
Applying this change of variable to the original ode results in
\begin{align*} {\mathrm e}^{\frac {b \,x^{2}}{2}} \left (b v \left (x \right )+v^{\prime \prime }\left (x \right )\right ) = 0 \end{align*}
Which is now solved for \(v \left (x \right )\).
The above ode can be simplified to
\begin{align*} b v \left (x \right )+v^{\prime \prime }\left (x \right ) = 0 \end{align*}
This is second order with constant coefficients homogeneous ODE. In standard form the ODE is
\[ A v''(x) + B v'(x) + C v(x) = 0 \]
Where in the above \(A=1, B=0, C=b\). Let the solution be \(v \left (x \right )=e^{\lambda x}\). Substituting this into the ODE gives
\[ \lambda ^{2} {\mathrm e}^{x \lambda }+b \,{\mathrm e}^{x \lambda } = 0 \tag {1} \]
Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda x}\) gives
\[ \lambda ^{2}+b = 0 \tag {2} \]
Equation (2) is the characteristic equation of the ODE. Its roots determine the general solution form.Using the quadratic formula
\[ \lambda _{1,2} = \frac {-B}{2 A} \pm \frac {1}{2 A} \sqrt {B^2 - 4 A C} \]
Substituting \(A=1, B=0, C=b\) into the above
gives
\begin{align*} \lambda _{1,2} &= \frac {0}{(2) \left (1\right )} \pm \frac {1}{(2) \left (1\right )} \sqrt {0^2 - (4) \left (1\right )\left (b\right )}\\ &= \pm \sqrt {-b} \end{align*}
Hence
\begin{align*} \lambda _1 &= + \sqrt {-b}\\ \lambda _2 &= - \sqrt {-b} \end{align*}
Which simplifies to
\begin{align*}
\lambda _1 &= \frac {\sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2} \\
\lambda _2 &= -\frac {\sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2} \\
\end{align*}
The roots are complex but they are not conjugate of each others. Hence simplification using Euler relation is not possible here. Therefore the final solution is
\begin{align*}
v \left (x \right ) &= c_1 e^{\lambda _1 x} + c_2 e^{\lambda _2x} \\
&= c_1 e^{\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}} + c_2 e^{-\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}} \\
\end{align*}
Will add steps showing solving for IC soon.
Now that \(v \left (x \right )\) is known, then
\begin{align*} y&= v \left (x \right ) z \left (x \right )\\ &= \left (c_1 \,{\mathrm e}^{\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}+c_2 \,{\mathrm e}^{-\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}\right ) \left (z \left (x \right )\right )\tag {7} \end{align*}
But from (5)
\begin{align*} z \left (x \right )&= {\mathrm e}^{\frac {b \,x^{2}}{2}} \end{align*}
Hence (7) becomes
\begin{align*} y = \left (c_1 \,{\mathrm e}^{\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}+c_2 \,{\mathrm e}^{-\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}\right ) {\mathrm e}^{\frac {b \,x^{2}}{2}} \end{align*}
Therefore the homogeneous solution \(y_h\) is
\[
y_h = \left (c_1 \,{\mathrm e}^{\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}+c_2 \,{\mathrm e}^{-\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}\right ) {\mathrm e}^{\frac {b \,x^{2}}{2}}
\]
The particular solution \(y_p\) can be found using either the method of undetermined coefficients, or the method of variation of parameters. The method of variation of parameters will be used as it is more general and can be used when the coefficients of the ODE depend on \(x\) as well. Let
\begin{equation}
\tag{1} y_p(x) = u_1 y_1 + u_2 y_2
\end{equation}
Where \(u_1,u_2\) to be determined, and \(y_1,y_2\) are the two basis solutions (the two linearly independent solutions
of the homogeneous ODE) found earlier when solving the homogeneous ODE as
\begin{align*}
y_1 &= {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} \\
y_2 &= {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} \\
\end{align*}
In the Variation of parameters \(u_1,u_2\) are found using
\begin{align*}
\tag{2} u_1 &= -\int \frac {y_2 f(x)}{a W(x)} \\
\tag{3} u_2 &= \int \frac {y_1 f(x)}{a W(x)} \\
\end{align*}
Where \(W(x)\) is the Wronskian and \(a\) is the coefficient in front of \(y''\) in the given ODE. The Wronskian is given by \(W= \begin {vmatrix} y_1 & y_{2} \\ y_{1}^{\prime } & y_{2}^{\prime } \end {vmatrix} \). Hence
\[ W = \begin {vmatrix} {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} & {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} \\ \frac {d}{dx}\left ({\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}\right ) & \frac {d}{dx}\left ({\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}\right ) \end {vmatrix} \]
Which gives
\[ W = \begin {vmatrix} {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} & {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} \\ -\frac {\sqrt {b}\, {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}-\frac {i {\mathrm e}^{-\frac {x \sqrt {b}}{2}} \sqrt {b}\, {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+\frac {{\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}-\frac {i {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+{\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} x b \,{\mathrm e}^{\frac {b \,x^{2}}{2}} & \frac {\sqrt {b}\, {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+\frac {i {\mathrm e}^{\frac {x \sqrt {b}}{2}} \sqrt {b}\, {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}-\frac {{\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+\frac {i {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+{\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} x b \,{\mathrm e}^{\frac {b \,x^{2}}{2}} \end {vmatrix} \]
Therefore
\[
W = \left ({\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}\right )\left (\frac {\sqrt {b}\, {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+\frac {i {\mathrm e}^{\frac {x \sqrt {b}}{2}} \sqrt {b}\, {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}-\frac {{\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+\frac {i {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+{\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} x b \,{\mathrm e}^{\frac {b \,x^{2}}{2}}\right ) - \left ({\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}\right )\left (-\frac {\sqrt {b}\, {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}-\frac {i {\mathrm e}^{-\frac {x \sqrt {b}}{2}} \sqrt {b}\, {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+\frac {{\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}-\frac {i {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2}+{\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} x b \,{\mathrm e}^{\frac {b \,x^{2}}{2}}\right )
\]
Which simplifies to
\[
W = i {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{b \,x^{2}} {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}}+i {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{b \,x^{2}} {\mathrm e}^{\frac {x \sqrt {b}}{2}} \sqrt {b}\, {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}}-{\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{b \,x^{2}} {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}\, {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}}+{\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{b \,x^{2}} \sqrt {b}\, {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}}
\]
Which simplifies for \(0<x\) to
\[
W = 2 i \sqrt {b}\, {\mathrm e}^{b \,x^{2}}
\]
Therefore Eq. (2) becomes
\[
u_1 = -\int \frac {{\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} x}{2 i \sqrt {b}\, {\mathrm e}^{b \,x^{2}}}\,dx
\]
Which simplifies for \(0<x\) to
\[
u_1 = - \int -\frac {i x \,{\mathrm e}^{\frac {\left (2 i \sqrt {b}-x b \right ) x}{2}}}{2 \sqrt {b}}d x
\]
Hence
\[
u_1 = \frac {i \left (-\frac {{\mathrm e}^{-\frac {b \,x^{2}}{2}+i x \sqrt {b}}}{b}+\frac {i \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {b}\, x}{2}-\frac {i \sqrt {2}}{2}\right )}{2 b}\right )}{2 \sqrt {b}}
\]
And Eq. (3) becomes
\[
u_2 = \int \frac {{\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} x}{2 i \sqrt {b}\, {\mathrm e}^{b \,x^{2}}}\,dx
\]
Which simplifies for \(0<x\) to
\[
u_2 = \int -\frac {i x \,{\mathrm e}^{-\frac {x \left (2 i \sqrt {b}+x b \right )}{2}}}{2 \sqrt {b}}d x
\]
Hence
\[
u_2 = -\frac {i \left (-\frac {{\mathrm e}^{-\frac {b \,x^{2}}{2}-i x \sqrt {b}}}{b}-\frac {i \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {b}\, x}{2}+\frac {i \sqrt {2}}{2}\right )}{2 b}\right )}{2 \sqrt {b}}
\]
Therefore the particular solution, from equation (1) is
\[
y_p(x) = \frac {i \left (-\frac {{\mathrm e}^{-\frac {b \,x^{2}}{2}+i x \sqrt {b}}}{b}+\frac {i \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {b}\, x}{2}-\frac {i \sqrt {2}}{2}\right )}{2 b}\right ) {\mathrm e}^{-\frac {x \sqrt {b}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}}{2}} {\mathrm e}^{\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{-\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}}}{2 \sqrt {b}}-\frac {i {\mathrm e}^{\frac {x \sqrt {b}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}}{2}} {\mathrm e}^{-\frac {x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {i x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}}{2}} {\mathrm e}^{\frac {b \,x^{2}}{2}} \left (-\frac {{\mathrm e}^{-\frac {b \,x^{2}}{2}-i x \sqrt {b}}}{b}-\frac {i \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {b}\, x}{2}+\frac {i \sqrt {2}}{2}\right )}{2 b}\right )}{2 \sqrt {b}}
\]
Which simplifies to
\[
y_p(x) = \frac {\left (\sqrt {2}\, \sqrt {\pi }\, {\mathrm e}^{\left (\frac {1}{2}-\frac {i}{2}\right ) x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}-\frac {1}{2}+\left (-\frac {1}{2}-\frac {i}{2}\right ) x \sqrt {b}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (-x \sqrt {b}+i\right )}{2}\right )-\sqrt {2}\, \sqrt {\pi }\, {\mathrm e}^{\left (-\frac {1}{2}+\frac {i}{2}\right ) x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}-\frac {1}{2}+\left (\frac {1}{2}+\frac {i}{2}\right ) x \sqrt {b}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (i+x \sqrt {b}\right )}{2}\right )-2 i {\mathrm e}^{-\frac {\left (\left (-1+i\right ) \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}+\left (1-i\right ) \sqrt {b}+x b \right ) x}{2}}+2 i {\mathrm e}^{\frac {x \left (\left (-1+i\right ) \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}+\left (1-i\right ) \sqrt {b}-x b \right )}{2}}\right ) {\mathrm e}^{\frac {b \,x^{2}}{2}}}{4 b^{{3}/{2}}}
\]
Therefore the general solution is
\begin{align*}
y &= y_h + y_p \\
&= \left (\left (c_1 \,{\mathrm e}^{\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}+c_2 \,{\mathrm e}^{-\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}\right ) {\mathrm e}^{\frac {b \,x^{2}}{2}}\right ) + \left (\frac {\left (\sqrt {2}\, \sqrt {\pi }\, {\mathrm e}^{\left (\frac {1}{2}-\frac {i}{2}\right ) x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}-\frac {1}{2}+\left (-\frac {1}{2}-\frac {i}{2}\right ) x \sqrt {b}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (-x \sqrt {b}+i\right )}{2}\right )-\sqrt {2}\, \sqrt {\pi }\, {\mathrm e}^{\left (-\frac {1}{2}+\frac {i}{2}\right ) x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}-\frac {1}{2}+\left (\frac {1}{2}+\frac {i}{2}\right ) x \sqrt {b}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (i+x \sqrt {b}\right )}{2}\right )-2 i {\mathrm e}^{-\frac {\left (\left (-1+i\right ) \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}+\left (1-i\right ) \sqrt {b}+x b \right ) x}{2}}+2 i {\mathrm e}^{\frac {x \left (\left (-1+i\right ) \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}+\left (1-i\right ) \sqrt {b}-x b \right )}{2}}\right ) {\mathrm e}^{\frac {b \,x^{2}}{2}}}{4 b^{{3}/{2}}}\right ) \\
\end{align*}
Will add steps showing solving for IC soon.
Summary of solutions found
\begin{align*}
y &= \frac {\left (\sqrt {2}\, \sqrt {\pi }\, {\mathrm e}^{\left (\frac {1}{2}-\frac {i}{2}\right ) x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}-\frac {1}{2}+\left (-\frac {1}{2}-\frac {i}{2}\right ) x \sqrt {b}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (-x \sqrt {b}+i\right )}{2}\right )-\sqrt {2}\, \sqrt {\pi }\, {\mathrm e}^{\left (-\frac {1}{2}+\frac {i}{2}\right ) x \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}-\frac {1}{2}+\left (\frac {1}{2}+\frac {i}{2}\right ) x \sqrt {b}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (i+x \sqrt {b}\right )}{2}\right )-2 i {\mathrm e}^{-\frac {\left (\left (-1+i\right ) \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}+\left (1-i\right ) \sqrt {b}+x b \right ) x}{2}}+2 i {\mathrm e}^{\frac {x \left (\left (-1+i\right ) \sqrt {b}\, \sqrt {\operatorname {signum}\left (b \right )}+\left (1-i\right ) \sqrt {b}-x b \right )}{2}}\right ) {\mathrm e}^{\frac {b \,x^{2}}{2}}}{4 b^{{3}/{2}}}+\left (c_1 \,{\mathrm e}^{\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}+c_2 \,{\mathrm e}^{-\frac {x \sqrt {b}\, \left (\left (-1+i\right ) \sqrt {\operatorname {signum}\left (b \right )}+1+i\right )}{2}}\right ) {\mathrm e}^{\frac {b \,x^{2}}{2}} \\
\end{align*}
Solved as second order ode using Kovacic algorithm
Time used: 0.266 (sec)
Writing the ode as
\begin{align*} y^{\prime \prime }-2 b x y^{\prime }+b^{2} x^{2} y &= 0 \tag {1} \\ A y^{\prime \prime } + B y^{\prime } + C y &= 0 \tag {2} \end{align*}
Comparing (1) and (2) shows that
\begin{align*} A &= 1 \\ B &= -2 x b\tag {3} \\ C &= x^{2} b^{2} \end{align*}
Applying the Liouville transformation on the dependent variable gives
\begin{align*} z(x) &= y e^{\int \frac {B}{2 A} \,dx} \end{align*}
Then (2) becomes
\begin{align*} z''(x) = r z(x)\tag {4} \end{align*}
Where \(r\) is given by
\begin{align*} r &= \frac {s}{t}\tag {5} \\ &= \frac {2 A B' - 2 B A' + B^2 - 4 A C}{4 A^2} \end{align*}
Substituting the values of \(A,B,C\) from (3) in the above and simplifying gives
\begin{align*} r &= \frac {-b}{1}\tag {6} \end{align*}
Comparing the above to (5) shows that
\begin{align*} s &= -b\\ t &= 1 \end{align*}
Therefore eq. (4) becomes
\begin{align*} z''(x) &= \left ( -b\right ) z(x)\tag {7} \end{align*}
Equation (7) is now solved. After finding \(z(x)\) then \(y\) is found using the inverse transformation
\begin{align*} y &= z \left (x \right ) e^{-\int \frac {B}{2 A} \,dx} \end{align*}
The first step is to determine the case of Kovacic algorithm this ode belongs to. There are 3 cases depending on the order of poles of \(r\) and the order of \(r\) at \(\infty \). The following table summarizes these cases.
| | |
Case |
Allowed pole order for \(r\) |
Allowed value for \(\mathcal {O}(\infty )\) |
| | |
1 |
\(\left \{ 0,1,2,4,6,8,\cdots \right \} \) |
\(\left \{ \cdots ,-6,-4,-2,0,2,3,4,5,6,\cdots \right \} \) |
| | |
2
|
Need to have at least one pole
that is either order \(2\) or odd order
greater than \(2\). Any other pole order
is allowed as long as the above
condition is satisfied. Hence the
following set of pole orders are all
allowed. \(\{1,2\}\),\(\{1,3\}\),\(\{2\}\),\(\{3\}\),\(\{3,4\}\),\(\{1,2,5\}\). |
no condition |
| | |
3 |
\(\left \{ 1,2\right \} \) |
\(\left \{ 2,3,4,5,6,7,\cdots \right \} \) |
| | |
Table 2.43: Necessary conditions for each Kovacic case
The order of \(r\) at \(\infty \) is the degree of \(t\) minus the degree of \(s\). Therefore
\begin{align*} O\left (\infty \right ) &= \text {deg}(t) - \text {deg}(s) \\ &= 0 - 0 \\ &= 0 \end{align*}
There are no poles in \(r\). Therefore the set of poles \(\Gamma \) is empty. Since there is no odd order pole larger than \(2\) and the order at \(\infty \) is \(0\) then the necessary conditions for case one are met. Therefore
\begin{align*} L &= [1] \end{align*}
Since \(r = -b\) is not a function of \(x\), then there is no need run Kovacic algorithm to obtain a solution for transformed ode \(z''=r z\) as one solution is
\[ z_1(x) = {\mathrm e}^{\sqrt {-b}\, x} \]
Using the above, the solution for the original ode can now be found. The first solution to the original ode in \(y\) is found from
\begin{align*}
y_1 &= z_1 e^{ \int -\frac {1}{2} \frac {B}{A} \,dx} \\
&= z_1 e^{ -\int \frac {1}{2} \frac {-2 x b}{1} \,dx} \\
&= z_1 e^{\frac {b \,x^{2}}{2}} \\
&= z_1 \left ({\mathrm e}^{\frac {b \,x^{2}}{2}}\right ) \\
\end{align*}
Which simplifies to
\[
y_1 = {\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}
\]
The second solution \(y_2\) to the original ode is found using reduction of order
\[ y_2 = y_1 \int \frac { e^{\int -\frac {B}{A} \,dx}}{y_1^2} \,dx \]
Substituting gives
\begin{align*}
y_2 &= y_1 \int \frac { e^{\int -\frac {-2 x b}{1} \,dx}}{\left (y_1\right )^2} \,dx \\
&= y_1 \int \frac { e^{b \,x^{2}}}{\left (y_1\right )^2} \,dx \\
&= y_1 \left (-\frac {{\mathrm e}^{b \,x^{2}} {\mathrm e}^{-x \left (x b +2 \sqrt {-b}\right )}}{2 \sqrt {-b}}\right ) \\
\end{align*}
Therefore the solution
is
\begin{align*}
y &= c_1 y_1 + c_2 y_2 \\
&= c_1 \left ({\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}\right ) + c_2 \left ({\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}\left (-\frac {{\mathrm e}^{b \,x^{2}} {\mathrm e}^{-x \left (x b +2 \sqrt {-b}\right )}}{2 \sqrt {-b}}\right )\right ) \\
\end{align*}
This is second order nonhomogeneous ODE. Let the solution be
\[
y = y_h + y_p
\]
Where \(y_h\) is the solution to the homogeneous ODE \( A y''(x) + B y'(x) + C y(x) = 0\), and \(y_p\) is a particular solution to the nonhomogeneous ODE \(A y''(x) + B y'(x) + C y(x) = f(x)\). \(y_h\) is the solution to
\[
y^{\prime \prime }-2 b x y^{\prime }+b^{2} x^{2} y = 0
\]
The homogeneous solution is found using the Kovacic algorithm which results in
\[
y_h = c_1 \,{\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}-\frac {c_2 \,{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}}
\]
The particular solution \(y_p\) can be found using either the method of undetermined coefficients, or the method of variation of parameters. The
method of variation of parameters will be used as it is more general and can be used when the coefficients of the ODE depend on \(x\) as well. Let
\begin{equation}
\tag{1} y_p(x) = u_1 y_1 + u_2 y_2
\end{equation}
Where \(u_1,u_2\) to be determined, and \(y_1,y_2\) are the two basis solutions (the two linearly independent solutions of the homogeneous ODE) found earlier when solving the homogeneous ODE as
\begin{align*}
y_1 &= {\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}} \\
y_2 &= -\frac {{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}} \\
\end{align*}
In the Variation of parameters \(u_1,u_2\) are found using
\begin{align*}
\tag{2} u_1 &= -\int \frac {y_2 f(x)}{a W(x)} \\
\tag{3} u_2 &= \int \frac {y_1 f(x)}{a W(x)} \\
\end{align*}
Where \(W(x)\) is the Wronskian and \(a\) is the coefficient in
front of \(y''\) in the given ODE. The Wronskian is given by \(W= \begin {vmatrix} y_1 & y_{2} \\ y_{1}^{\prime } & y_{2}^{\prime } \end {vmatrix} \). Hence
\[ W = \begin {vmatrix} {\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}} & -\frac {{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}} \\ \frac {d}{dx}\left ({\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}\right ) & \frac {d}{dx}\left (-\frac {{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}}\right ) \end {vmatrix} \]
Which gives
\[ W = \begin {vmatrix} {\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}} & -\frac {{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}} \\ \left (x b +\sqrt {-b}\right ) {\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}} & -\frac {\left (x b -\sqrt {-b}\right ) {\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}} \end {vmatrix} \]
Therefore
\[
W = \left ({\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}\right )\left (-\frac {\left (x b -\sqrt {-b}\right ) {\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}}\right ) - \left (-\frac {{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}}\right )\left (\left (x b +\sqrt {-b}\right ) {\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}\right )
\]
Which simplifies to
\[
W = {\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}} {\mathrm e}^{-\frac {x \left (-x b +2 \sqrt {-b}\right )}{2}}
\]
Which simplifies to
\[
W = {\mathrm e}^{b \,x^{2}}
\]
Therefore Eq. (2) becomes
\[
u_1 = -\int \frac {-\frac {{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}} x}{2 \sqrt {-b}}}{{\mathrm e}^{b \,x^{2}}}\,dx
\]
Which simplifies to
\[
u_1 = - \int -\frac {x \,{\mathrm e}^{-\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}}d x
\]
Hence
\[
u_1 = \frac {-\frac {{\mathrm e}^{-\frac {b \,x^{2}}{2}-\sqrt {-b}\, x}}{b}-\frac {\sqrt {-b}\, \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {b}\, x}{2}+\frac {\sqrt {-b}\, \sqrt {2}}{2 \sqrt {b}}\right )}{2 b^{{3}/{2}}}}{2 \sqrt {-b}}
\]
And Eq. (3) becomes
\[
u_2 = \int \frac {{\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}} x}{{\mathrm e}^{b \,x^{2}}}\,dx
\]
Which simplifies to
\[
u_2 = \int x \,{\mathrm e}^{-\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}d x
\]
Hence
\[
u_2 = -\frac {{\mathrm e}^{-\frac {b \,x^{2}}{2}+\sqrt {-b}\, x}}{b}+\frac {\sqrt {-b}\, \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {b}\, x}{2}-\frac {\sqrt {-b}\, \sqrt {2}}{2 \sqrt {b}}\right )}{2 b^{{3}/{2}}}
\]
Therefore the particular solution, from equation (1) is
\[
y_p(x) = \frac {\left (-\frac {{\mathrm e}^{-\frac {b \,x^{2}}{2}-\sqrt {-b}\, x}}{b}-\frac {\sqrt {-b}\, \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {b}\, x}{2}+\frac {\sqrt {-b}\, \sqrt {2}}{2 \sqrt {b}}\right )}{2 b^{{3}/{2}}}\right ) {\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}}-\frac {{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}} \left (-\frac {{\mathrm e}^{-\frac {b \,x^{2}}{2}+\sqrt {-b}\, x}}{b}+\frac {\sqrt {-b}\, \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}} \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {b}\, x}{2}-\frac {\sqrt {-b}\, \sqrt {2}}{2 \sqrt {b}}\right )}{2 b^{{3}/{2}}}\right )}{2 \sqrt {-b}}
\]
Which simplifies to
\[
y_p(x) = -\frac {\sqrt {\pi }\, \sqrt {2}\, \left ({\mathrm e}^{\frac {b \,x^{2}}{2}+\sqrt {-b}\, x -\frac {1}{2}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (x b +\sqrt {-b}\right )}{2 \sqrt {b}}\right )-{\mathrm e}^{-\frac {1}{2}+\frac {b \,x^{2}}{2}-\sqrt {-b}\, x} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (-x b +\sqrt {-b}\right )}{2 \sqrt {b}}\right )\right )}{4 b^{{3}/{2}}}
\]
Therefore the general solution is
\begin{align*}
y &= y_h + y_p \\
&= \left (c_1 \,{\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}-\frac {c_2 \,{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}}\right ) + \left (-\frac {\sqrt {\pi }\, \sqrt {2}\, \left ({\mathrm e}^{\frac {b \,x^{2}}{2}+\sqrt {-b}\, x -\frac {1}{2}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (x b +\sqrt {-b}\right )}{2 \sqrt {b}}\right )-{\mathrm e}^{-\frac {1}{2}+\frac {b \,x^{2}}{2}-\sqrt {-b}\, x} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (-x b +\sqrt {-b}\right )}{2 \sqrt {b}}\right )\right )}{4 b^{{3}/{2}}}\right ) \\
\end{align*}
Will add steps showing solving for IC
soon.
Summary of solutions found
\begin{align*}
y &= c_1 \,{\mathrm e}^{\frac {x \left (x b +2 \sqrt {-b}\right )}{2}}-\frac {c_2 \,{\mathrm e}^{\frac {x \left (x b -2 \sqrt {-b}\right )}{2}}}{2 \sqrt {-b}}-\frac {\sqrt {\pi }\, \sqrt {2}\, \left ({\mathrm e}^{\frac {b \,x^{2}}{2}+\sqrt {-b}\, x -\frac {1}{2}} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (x b +\sqrt {-b}\right )}{2 \sqrt {b}}\right )-{\mathrm e}^{-\frac {1}{2}+\frac {b \,x^{2}}{2}-\sqrt {-b}\, x} \operatorname {erf}\left (\frac {\sqrt {2}\, \left (-x b +\sqrt {-b}\right )}{2 \sqrt {b}}\right )\right )}{4 b^{{3}/{2}}} \\
\end{align*}
Maple step by step solution
Maple trace
`Methods for second order ODEs:
--- Trying classification methods ---
trying a quadrature
trying high order exact linear fully integrable
trying differential order: 2; linear nonhomogeneous with symmetry [0,1]
trying a double symmetry of the form [xi=0, eta=F(x)]
-> Try solving first the homogeneous part of the ODE
checking if the LODE has constant coefficients
checking if the LODE is of Euler type
trying a symmetry of the form [xi=0, eta=F(x)]
checking if the LODE is missing y
-> Trying a Liouvillian solution using Kovacics algorithm
A Liouvillian solution exists
Group is reducible or imprimitive
<- Kovacics algorithm successful
<- solving first the homogeneous part of the ODE successful`
Maple dsolve solution
Solving time : 0.009
(sec)
Leaf size : 137
dsolve(diff(diff(y(x),x),x)-2*b*x*diff(y(x),x)+b^2*x^2*y(x) = x,y(x),singsol=all)
\[
y = \frac {4 \,{\mathrm e}^{\frac {x \left (b x -2 \sqrt {-b}\right )}{2}} c_{1} b^{{3}/{2}}+4 \,{\mathrm e}^{\frac {x \left (b x +2 \sqrt {-b}\right )}{2}} c_{2} b^{{3}/{2}}-\sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \left (b x +\sqrt {-b}\right )}{2 \sqrt {b}}\right ) \sqrt {\pi }\, {\mathrm e}^{-\frac {1}{2}+\frac {b \,x^{2}}{2}+x \sqrt {-b}}+\sqrt {\pi }\, \operatorname {erf}\left (\frac {\sqrt {2}\, \left (-b x +\sqrt {-b}\right )}{2 \sqrt {b}}\right ) {\mathrm e}^{-\frac {1}{2}+\frac {b \,x^{2}}{2}-x \sqrt {-b}} \sqrt {2}}{4 b^{{3}/{2}}}
\]
✓Mathematica DSolve solution
Solving time : 0.461
(sec)
Leaf size : 162
DSolve[{D[y[x],{x,2}]-2*b*x*D[y[x],x]+b^2*x^2*y[x]==x,{}},y[x],x,IncludeSingularSolutions->True]
\[
y(x)\to \frac {e^{\frac {b x^2}{2}-i \sqrt {b} x} \left (2 \sqrt {b} \int _1^x\frac {i e^{i \sqrt {b} K[1]-\frac {1}{2} b K[1]^2} K[1]}{2 \sqrt {b}}dK[1]-i e^{2 i \sqrt {b} x} \int _1^xe^{-\frac {1}{2} b K[2]^2-i \sqrt {b} K[2]} K[2]dK[2]-i c_2 e^{2 i \sqrt {b} x}+2 \sqrt {b} c_1\right )}{2 \sqrt {b}}
\]
✗Sympy solution
Solving time : 0.000
(sec)
Leaf size : 0
Python version: 3.13.1 (main, Dec 4 2024, 18:05:56) [GCC 14.2.1 20240910]
Sympy version 1.13.3
from sympy import *
x = symbols("x")
b = symbols("b")
y = Function("y")
ode = Eq(b**2*x**2*y(x) - 2*b*x*Derivative(y(x), x) - x + Derivative(y(x), (x, 2)),0)
ics = {}
dsolve(ode,func=y(x),ics=ics)
NotImplementedError : The given ODE Derivative(y(x), x) - (b**2*x**2*y(x) - x + Derivative(y(x), (x, 2)))/(2*b*x) cannot be solved by the factorable group method