2.12   ODE No. 12

  1. Problem in Latex
  2. Mathematica input
  3. Maple input

\[ y'(x)+y(x)^2-1=0 \] Mathematica : cpu = 0.0730206 (sec), leaf count = 34

\[\left \{\left \{y(x)\to \frac {e^{2 x}-e^{2 c_1}}{e^{2 x}+e^{2 c_1}}\right \}\right \}\] Maple : cpu = 0.047 (sec), leaf count = 8

\[ \left \{ y \left ( x \right ) =\tanh \left ( x+{\it \_C1} \right ) \right \} \]

Hand solution

\begin {align} \frac {dy}{dx}+y^{2}\left ( x\right ) -1 & =0\nonumber \\ \frac {dy}{dx} & =1-y^{2}\left ( x\right ) \tag {1} \end {align}

This is separable. Hence

\begin {align*} \frac {dy}{dx}\frac {1}{1-y^{2}\left ( x\right ) } & =1\\ \frac {dy}{1-y^{2}\left ( x\right ) } & =dx \end {align*}

Integrating\[ \int \frac {dy}{1-y^{2}\left ( x\right ) }=x+C \] Using \(\int \frac {1}{a+by^{2}}dy=\frac {\sqrt {-\frac {a}{b}}\tanh ^{-1}\left ( \frac {y}{\sqrt {\frac {-a}{b}}}\right ) }{a}\) and since \(a=1,b=-1\), then \(\int \frac {dy}{1-y^{2}\left ( x\right ) }=\tanh ^{-1}\left ( y\right ) \) and the above becomes

\[ \tanh ^{-1}\left ( y\right ) =x+C \]

Therefore

\begin {equation} y=\tanh \left ( x+C\right ) \tag {2} \end {equation}

In terms of exponential, since \(\tanh \left ( u\right ) =\frac {e^{u}-e^{-u}}{e^{u}+e^{-u}}\) then (2) can also be written as

\[ y=\frac {e^{x+C}-e^{-\left ( x+C\right ) }}{e^{x+C}+e^{-\left ( x+C\right ) }}=\frac {e^{x}e^{C}-e^{-x}e^{-C}}{e^{x}e^{C}+e^{-x}e^{-C}}\]

Multiplying numerator and denominator by \(e^{-C}e^{x}\)

\[ y=\frac {e^{2x}-e^{-2C}}{e^{2x}+e^{-2C}}\]

To get same answer as Mathematica, since \(C\) is constant, let \(C_{1}=-C\), then

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