I am trying to find u that minimizes:
$$\int_0^\infty x^2(t)+u^2(t)dt$$
where the provided information is $x(0)=1$ and:
$$\dot x=x^2+u$$
Here is what I have done. I tried to use Euler-Lagurange Equations, and then try to solve this with things for second order nonlinear equation:

Because I can't find a way to go through it, I then tried to use another variable to replace $dx/dt$:

but then I stuck as well. Could you tell me how to solve this?
Let's start from the Euler-Lagrange equation: the correct result is $$ 2x\, {\color{red} -}\,4x\dot{x}+4x^3-(2\ddot{x}-4x\dot{x})=0, \tag{1} $$ which simplifies to $$ \ddot{x}=x+2x^3. \tag{2} $$ Multiplying both sides of $(2)$ by $\dot{x}$ and integrating with respect to $t$, we obtain $$ \dot{x}^2=x^2+x^4+A. \tag{3} $$ To determine the value of the constant $A$, we notice that $$ \int_0^{\infty}[x^2(t)+u^2(t)]\,dt <\infty \Rightarrow \lim_{t\to \infty}x(t)= \lim_{t\to \infty}u(t)=0, \tag{4} $$ hence $\lim_{t\to \infty}\dot{x}(t)=\lim_{t\to \infty}[u(t)+x^2(t)]=0$. Therefore, taking the limit $t\to\infty$ of both sides of $(3)$ yields $A=0$.
Eq. $(3)$ (with $A=0$) implies $\dot{x}=\pm\sqrt{x^2+x^4}$. Since $x(0)=1$ and we are looking for the solution to $(3)$ that vanishes at infinity, we must select the negative branch of the square root. Therefore, \begin{align} t&=-\int\frac{dx}{\sqrt{x^2+x^4}} \\ &=-\int\frac{d(\sinh\theta)} {\sinh\theta\sqrt{1+\sinh^2\theta}} \\ &=-\int\frac{d\theta}{\sinh\theta}=-\ln\left(\tanh\frac{\theta}{2}\right) + B \\ &\Rightarrow \tanh\frac{\theta}{2}=Ce^{-t}. \tag{5} \end{align} Since $x=\sinh\theta$, it follows from $(5)$ that $$ x=2\sinh\frac{\theta}{2}\cosh\frac{\theta}{2}= \frac{2\tanh\frac{\theta}{2}}{{\rm{sech}}^2\frac{\theta}{2}} =\frac{2\tanh\frac{\theta}{2}}{1-\tanh^2\frac{\theta}{2}} =\frac{2Ce^{-t}}{1-C^2e^{-2t}}. \tag{6} $$ The value of $C$ is determined by the condition $x(0)=1$: $$ 1=\frac{2C}{1-C^2}\Rightarrow C^2+2C-1=0 \Rightarrow C=-1\pm\sqrt{2}. \tag{7} $$ The solution $C=-1-\sqrt{2}$ leads to a singularity in $x(t)$ at $t=\ln(1+\sqrt{2})$, so we may discard it. The final solution to the Euler-Lagrange equation is, therefore, $$ x(t)=\frac{2(\sqrt{2}-1)e^{-t}}{1-(\sqrt{2}-1)^2e^{-2t}}. \tag{8} $$ Finally, the function $u$ that minimizes the functional is obtained from $(8)$ and the relation $u=\dot{x}-x^2$.