2.6.6.3 Solved using first_order_ode_riccati

Entering first order ode riccati solver

\[\begin {aligned} n^{\prime }&=\left (n^{2}+1\right ) x \end {aligned}\]

In canonical form the ODE is

\begin{align*} n' &= F(x,n)\\ &= \left (n^{2}+1\right ) x \end{align*}

This is a Riccati ODE. Comparing the ODE to solve

\begin{align*} n' &= n^{2} x +x \end{align*}

With Riccati ODE standard form

\[ n' = f_0(x)+ f_1(x)n+f_2(x)n^{2} \]

Shows that \(f_0(x)=x\), \(f_1(x)=0\) and \(f_2(x)=x\). Let

\begin{align*} n &= \frac {-u'}{f_2 u} \\ &= \frac {-u'}{u x} \tag {1} \end{align*}

Using the above substitution in the given ODE results (after some simplification) in a second order ODE to solve for \(u(x)\) which is

\begin{align*} f_2 u''(x) -\left ( f_2' + f_1 f_2 \right ) u'(x) + f_2^2 f_0 u(x) &= 0 \tag {2} \end{align*}

But

\begin{align*} f_2' &=1\\ f_1 f_2 &=0\\ f_2^2 f_0 &=x^{3} \end{align*}

Substituting the above terms back in equation (2) gives

\begin{align*} x u^{\prime \prime }\left (x \right )-u^{\prime }\left (x \right )+x^{3} u \left (x \right ) = 0 \end{align*}

Entering second order change of variable on \(x\) method 2 solverIn normal form the ode

\begin{align*} x \left (\frac {d^{2}u}{d x^{2}}\right )-\frac {d u}{d x}+x^{3} u = 0\tag {1} \end{align*}

Becomes

\begin{align*} \frac {d^{2}u}{d x^{2}}+p \left (x \right ) \left (\frac {d u}{d x}\right )+q \left (x \right ) u&=0 \tag {2} \end{align*}

Where

\begin{align*} p \left (x \right )&=-\frac {1}{x}\\ q \left (x \right )&=x^{2} \end{align*}

Applying change of variables \(\tau = g \left (x \right )\) to (2) gives

\begin{align*} \frac {d^{2}}{d \tau ^{2}}u \left (\tau \right )+p_{1} \left (\frac {d}{d \tau }u \left (\tau \right )\right )+q_{1} u \left (\tau \right )&=0 \tag {3} \end{align*}

Where \(\tau \) is the new independent variable, and

\begin{align*} p_{1} \left (\tau \right ) &=\frac {\frac {d^{2}}{d x^{2}}\tau \left (x \right )+p \left (x \right ) \left (\frac {d}{d x}\tau \left (x \right )\right )}{\left (\frac {d}{d x}\tau \left (x \right )\right )^{2}}\tag {4} \\ q_{1} \left (\tau \right ) &=\frac {q \left (x \right )}{\left (\frac {d}{d x}\tau \left (x \right )\right )^{2}}\tag {5} \end{align*}

Let \(p_{1} = 0\). Eq (4) simplifies to

\begin{align*} \frac {d^{2}}{d x^{2}}\tau \left (x \right )+p \left (x \right ) \left (\frac {d}{d x}\tau \left (x \right )\right )&=0 \end{align*}

This ode is solved resulting in

\begin{align*} \tau &= \int {\mathrm e}^{-\int p \left (x \right )d x}d x\\ &= \int {\mathrm e}^{-\int -\frac {1}{x}d x}d x\\ &= \int e^{\ln \left (x \right )} \,dx\\ &= \int x d x\\ &= \frac {x^{2}}{2}\tag {6} \end{align*}

Using (6) to evaluate \(q_{1}\) from (5) gives

\begin{align*} q_{1} \left (\tau \right ) &= \frac {q \left (x \right )}{\left (\frac {d}{d x}\tau \left (x \right )\right )^{2}}\\ &= \frac {x^{2}}{x^{2}}\\ &= 1\tag {7} \end{align*}

Substituting the above in (3) and noting that now \(p_{1} = 0\) results in

\begin{align*} \frac {d^{2}}{d \tau ^{2}}u \left (\tau \right )+q_{1} u \left (\tau \right )&=0 \\ \frac {d^{2}}{d \tau ^{2}}u \left (\tau \right )+u \left (\tau \right )&=0 \end{align*}

The above ode is now solved for \(u \left (\tau \right )\).Entering second order linear constant coefficient ode solverThis is second order with constant coefficients homogeneous ODE. In standard form the ODE is

\[ A u''(\tau ) + B u'(\tau ) + C u(\tau ) = 0 \]

Where in the above \(A=1, B=0, C=1\). Let the solution be \(u \left (\tau \right )=e^{\lambda \tau }\). Substituting this into the ODE gives

\[ \lambda ^{2} {\mathrm e}^{\lambda \tau }+{\mathrm e}^{\lambda \tau } = 0 \tag {1} \]

Since exponential function is never zero, then dividing Eq(2) throughout by \(e^{\lambda \tau }\) gives

\[ \lambda ^{2}+1 = 0 \tag {2} \]

Equation (2) is the characteristic equation of the ODE. Its roots determine the general solution form. Using the quadratic formula the roots are

\[ \lambda _{1,2} = \frac {-B}{2 A} \pm \frac {1}{2 A} \sqrt {B^2 - 4 A C} \]

Substituting \(A=1, B=0, C=1\) 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 (1\right )}\\ &= \pm i \end{align*}

Hence

\begin{align*} \lambda _1 &= + i\\ \lambda _2 &= - i \end{align*}

Which simplifies to

\begin{gather*} \begin {aligned} \lambda _1 &= i\\ \lambda _2 &= -i \end {aligned} \end{gather*}

Since the roots are complex conjugate of each others, then let the roots be

\begin{align*} \lambda _{1,2} &= \alpha \pm i \beta \end{align*}

Where \(\alpha =0\) and \(\beta =1\). Therefore the final solution using Euler relation can be written as

\begin{align*} u \left (\tau \right ) &= e^{\alpha \tau } \left ( c_1 \cos (\beta \tau ) + c_2 \sin (\beta \tau ) \right ) \end{align*}

Which becomes

\begin{align*} u \left (\tau \right ) &= e^{0}\left (c_1 \cos \left (\tau \right )+c_2 \sin \left (\tau \right )\right ) \end{align*}

Or

\begin{align*} u \left (\tau \right ) &= c_1 \cos \left (\tau \right )+c_2 \sin \left (\tau \right ) \end{align*}

The above solution is now transformed back to \(u\) using (6) which results in

\begin{align*} u &= c_1 \cos \left (\frac {x^{2}}{2}\right )+c_2 \sin \left (\frac {x^{2}}{2}\right ) \end{align*}

Taking derivative gives

\begin{equation} \tag{4} u^{\prime }\left (x \right ) = -c_1 x \sin \left (\frac {x^{2}}{2}\right )+c_2 x \cos \left (\frac {x^{2}}{2}\right ) \end{equation}

Substituting equations (3,4) into (1) results in

\begin{gather*} \begin {aligned} n &= \frac {-u'}{f_2 u}\\ n &= \frac {-u'}{u x}\\ n &= -\frac {-c_1 x \sin \left (\frac {x^{2}}{2}\right )+c_2 x \cos \left (\frac {x^{2}}{2}\right )}{x \left (c_1 \cos \left (\frac {x^{2}}{2}\right )+c_2 \sin \left (\frac {x^{2}}{2}\right )\right )} \end {aligned} \end{gather*}

Doing change of constants, the above solution becomes

\begin{align*} n = -\frac {-x \sin \left (\frac {x^{2}}{2}\right )+c_3 x \cos \left (\frac {x^{2}}{2}\right )}{x \left (\cos \left (\frac {x^{2}}{2}\right )+c_3 \sin \left (\frac {x^{2}}{2}\right )\right )} \end{align*}

Simplifying the above gives

\[ n = \frac {\sin \left (\frac {x^{2}}{2}\right )-c_3 \cos \left (\frac {x^{2}}{2}\right )}{\cos \left (\frac {x^{2}}{2}\right )+c_3 \sin \left (\frac {x^{2}}{2}\right )} \]
Direction field with Isoclines Direction field

Summary of solutions found

\[ n = \frac {\sin \left (\frac {x^{2}}{2}\right )-c_3 \cos \left (\frac {x^{2}}{2}\right )}{\cos \left (\frac {x^{2}}{2}\right )+c_3 \sin \left (\frac {x^{2}}{2}\right )} \]