I'm reading nonlinear control systems book. The author provides this example $$ \dot{x} = r + x^2, \quad r < 0. $$ I would like to compute the analytical solution for the proceeding ODE. My attempt is
$$ \begin{align} \frac{dx}{dt} &= r + x^2 \\ \frac{dx}{r+x^2} &= dt \\ \int^{x(t)}_{x_0} \frac{1}{r+x^2} dx &= \int^{t}_{t_0} d\tau \\ \frac{\tan^{-1}\left(\frac{x}{\sqrt{r}}\right)}{\sqrt{r}} \Big|^{x(t)}_{x_0} &= (t-t_0) \end{align} $$
Now the problem with the assumption that $r<0$, how I can handle the substitution for the left side? I need to reach the final step where $x(t)$ is solely in the left side.

Let $r=-a^2$. Then $$\int\frac{dx}{x^2-a^2}=\int dt$$ $$-\frac{\log{\left( x+a\right) }-\log{\left( x-a\right) }}{2 a}=t+c$$ Take $c=\frac{\log C}{2a}$. $$\log{\left( \frac{x-a}{C\, \left( x+a\right) }\right) }=2 a t,$$ $$\frac{x-a}{x+a}=C\, {{e}^{2 a t}}.$$ General solution is $$x=\frac{a(1+Ce^{2at})}{1-Ce^{2at}}.$$