Issue with the solution to the following differential equation I have a function $u(x)$, and it satisfies the following differential equation:
$\frac{d^2 u}{dx^2} = \lambda u(u^2-b^2)$ where $\lambda$ and $b$ are just two positive real constants.
The Boundary conditions are:
$u(x = -\infty) = -b$  and $u(x= \infty) = b$. For simplification, $u(x = 0) = 0$ can be used.
The goal is to find $u(x)$.
My attempt:
Let, $g(u) = \lambda u(u^2-b^2)$
$\frac{d^2u}{dx^2} = g(u)$
$\implies \frac{du'}{dx} = g(u)$ where $u' = \frac{du}{dx}$
$\implies \frac{du'}{du} \frac{du}{dx} = g(u)$
$\implies u'\frac{du'}{du}  = g(u)$
$\implies u'du' = g(u) du$
$\implies u'du' = \lambda u(u^2-b^2) du $
Integrating both sides, we get,
$\frac{u'^2}{2} = \lambda(\frac{u^4}{4}-\frac{b^2u^2}{2}) + K $ where $K$ is a constant.
$\implies u' = \sqrt{\frac{\lambda}{2}(u^4-2b^2u^2)+K}$
$\implies \frac{du}{\sqrt{(u^2-b^2)^2-b^4+K}} = \sqrt{\frac{\lambda}{2}} dx$
When I put this in mathematica now, it gives me some elliptic function now. And I am not sure where to go from here.
In class, my professor gave us as a hint that $u(x)$ has something to do with $tanh(x)$, but I am very confused as to how to proceed from what I have.
 A: Note that as $u\to const $ as $x\to \pm\infty$ we must have $u'\to 0$ as $x\to\pm\infty$. So let us start from the line you derived
$$\frac12u'^2 = \frac{\lambda}{4}u^2(u^2-2b^2) + K $$
Setting $u=b$ and $u'=0$ yields
$$K=\frac{\lambda}{4}b^4.$$
We now readily see that
$$\frac12 u'^2 = \frac{\lambda}{4}(u^2-b^2)^2.$$
Or equivalently
$$\left(\frac{u'}{u^2-b^2}\right)^2=\frac{\lambda}{2}.$$
For simplicity I will write $\lambda=2\mu^2$ (as $\lambda>0$) and thus we have
$$\frac{u'}{u^2-b^2}=\mu. $$
Note that we could have $\mu=\sqrt{\frac{\lambda}{2}}$ or $\mu=-\sqrt{\frac{\lambda}{2}}$. Integrating and applying the chain rule yields
$$\int \frac{du}{u^2-b^2} = \int \mu\,dx.$$
Making the substitution $u=bv$ we see that
$$-\frac{1}{b}\int \frac{dv}{1-v^2} = \int \mu\,dx$$
and thus
$$\textrm{arctanh } v = c-b\mu x\implies u=b\tanh (c-b\mu x)$$
where $c$ is an arbitrary constant. We see that the conditions $u(\pm\infty)=\pm b$ do not determine $c$, but in fact only dictate the sign of $\mu$ (which square root we take). It is clear we require $\mu=-\sqrt{\frac{\lambda}{2}}$. As $c$ is arbitrary we may define a new constant $\alpha$ such that
$$u=b\tanh \left(b\sqrt{\frac{\lambda}{2}}(x-\alpha)\right). $$
