Example 8
\begin{align*} y^{\prime }-2y & =2\sqrt {y}\\ y\left ( 0\right ) & =1 \end{align*}

This one is tricky. As it is also Bernoulli ode. The Bernoulli ode has form \(y^{\prime }+py=qy^{n}\) where here \(p=-2\) and \(q=2\) and \(n=\frac {1}{2}\). It turns out solving this as quadrature causes a problem with IC due to how the integration works out. Let solve it both ways to show this.

\begin{align*} y^{\prime } & =f\left ( y\right ) \\ & =2\sqrt {y}+2y \end{align*}

We see right away that by existence and uniqueness, \(f\) and \(\frac {\partial f}{\partial y}\) are defined at IC. Hence solution exist and unique on some region that includes the point \(\left ( 0,1\right ) \). To solve as quadrature we just need to integrate. This gives (using Mathematica’s Integrate)

\begin{align*} \int \frac {dy}{\sqrt {y}+y} & =\int 2dx\\ 2\ln \left ( 1+\sqrt {y}\right ) & =2x+c \end{align*}

Now we need to find \(c\). At IC we have

\[ 2\ln \left ( 2\right ) =c \]

Hence the solution is

\begin{align*} 2\ln \left ( 1+\sqrt {y}\right ) & =2x+2\ln \left ( 2\right ) \\ \ln \left ( 1+\sqrt {y}\right ) & =x+\ln \left ( 2\right ) \\ 1+\sqrt {y} & =e^{x}e^{\ln 2}\\ & =2e^{x}\end{align*}

Hence

\begin{align*} \sqrt {y} & =2e^{x}-1\\ y & =\left ( 2e^{x}-1\right ) ^{2}\\ & =4e^{2x}-4e^{x}+1 \end{align*}

This is valid for \(2e^{x}-1>0\). So it might be better to keep the solution implicit as \(\sqrt {y}=2e^{x}-1\).  Let look at Maple’s integrate. It gives

\begin{align*} \int \frac {dy}{\sqrt {y}+y} & =\int 2dx\\ \ln \left ( y-1\right ) +2\operatorname {arctanh}\left ( \sqrt {y}\right ) & =2x+c \end{align*}

Here is the problem. At \(y=1\) we get \(\ln \left ( 0\right ) \). Even though both antiderivatives are correct, since they both differentiate back to \(\frac {1}{\sqrt {y}+y}\), using Maple’s result causes problem solving for the constant of integration since its anti-derivative is complex valued for all \(y\). Let now solve the same ode using Bernoulli method. The form is

\[ y^{\prime }+py=qy^{n}\]

where here \(p=-2\) and \(q=2\) and \(n=\frac {1}{2}\). Starting by dividing by \(y^{\frac {1}{2}}\) gives

\[ y^{\prime }y^{-\frac {1}{2}}-2y^{\frac {1}{2}}=2 \]

Let \(v=y^{1-n}=y^{\frac {1}{2}}\) and therefore \(v^{\prime }=\frac {1}{2}y^{-\frac {1}{2}}y^{\prime }\) or \(y^{\prime }=2v^{\prime }y^{\frac {1}{2}}\). Hence the above becomes

\begin{align*} 2v^{\prime }-2v & =2\\ v^{\prime }-v & =1 \end{align*}

Integrating factor is \(e^{-x}\). Hence \(\frac {d}{dx}\left ( e^{-x}v\right ) =e^{-x}\) or \(ve^{-x}=-e^{-x}+c\). Therefore \(v=-1+ce^{x}\). Which means \(\sqrt {y}=-1+ce^{x}\). At \(x=0,y=1\) this gives

\begin{align*} 1 & =-1+c\\ c & =2 \end{align*}

Hence the solution is

\[ \sqrt {y}=-1+2e^{x}\]

Which is the same solution using the integration result given by Mathematica. We see that using Bernoulli in this example makes the integration easier and solving for constant of integration is also easier.