I'm currently studying ODE's and had a question regarding the solution to a problem. The exercise problem is relatively simple:
Find the solution for the following ODE:
$$y' = 1 - y^2$$
I'm experiencing some confusion regarding the solution. Probably because it's been a very long time since I've studied calculus.
My approach is:
$$ \begin{align} y' & = 1 - y^2 \\ \frac{1}{1 - y^2}y' & = 1 \\ \int \frac{1}{1 - y^2}\,dy & = \int 1 \, dx \\ \end{align} $$
Solving the integral on the left:
$$ \begin{align} \int \frac{1}{1 - y^2}\,dy & = \int \left( \frac{1}{2(1 + y)} + \frac{1}{2(1 - y)} \right)\,dy \\ & = \frac{1}{2}\int \frac{1}{1 + y}\,dy + \frac{1}{2}\int \frac{1}{1 - y}\,dy \\ & = \frac{1}{2} \ln(\vert1 + y\vert) + \frac{1}{2} \ln{(\vert 1 - y\vert)} + C \end{align} $$
And therefore I concluded that the solution to the ODE is:
$$ \begin{align} \frac{1}{2} \ln{(\vert 1 + y \vert)} + \frac{1}{2} \ln(\vert 1 - y \vert ) & = x + C \\ \ln(\vert 1 + y \vert) + \ln(\vert 1 - y \vert) & = 2x + C \\ \ln(\vert 1 - y^2 \vert ) & = 2x + C \\ \vert 1 - y^2 \vert & = Ce^{2x} \end{align} $$
and therefore:
$$ y = \begin{cases} \begin{align} \sqrt{-Ce^{2x} + 1} && 1 - y^2 \ge 0 \\ \sqrt{Ce^{2x} + 1} && 1 - y^2 \lt 0 \end{align} \end{cases} $$
However, the solution is simply:
$$ y = \tanh{(x + C)} $$
My questions are the following:
How should I be able to recognize that apparently the integral that the solution uses to go to $\tanh$ is a standard integral? I've thought of ways that I could derive it, but other than memorization it seems difficult to find the connection.
When do I know whether or not to include the absolute values for the solutions when a natural logarithm is involved? I've noticed in many cases the final solution doesn't include the absolute value forms, but there's rarely a justification or explanation as to why that conclusion was made.
Thanks in advance.
You can make the problem simpler using $y=iz$ and the equation becomes $$iz'=1+z^2\implies \frac{z'}{1+z^2}=-i\implies \tan ^{-1}(z)=-i x+C$$ Back to $y$ $$\tan ^{-1}(iy)=-i x+C \implies i\tanh ^{-1}(y)=-i x+C\implies y=\tanh(x+C)$$