Using energy conservation theorem and method of integration by quadrature, find $x(t)$ for the mechanical system $x'' = -x$, considering a spring with mass $1$ and elasticity constant $1$.
My attempt:
$E = \frac12 \dot{x}^{2} + U(x) = k$, then $\dot{x} = \sqrt{2(E-U(x)}$
Suppose we know $\displaystyle g(x) = \int \frac{1}{\sqrt{2(E-U(x)}} dx$, then, by chain rule:
$\displaystyle\frac{d}{dt} g(x(t)) = \frac{1}{\sqrt{2(E-U(x)}} \frac{dx}{dt}=1$
Then $g(x(t)) = t+c$
Is this correct? Thanks
EDIT I know how to solve this differential equation, I want to know specifically how to solve it with energy conservation and quadrature, because this is an exercise of my Mathematica-Physics/Classical Mechanics course.
The potential energy of the spring is $\frac{1}{2}x^2$ so,
$$\frac{1}{2}x^2+\frac{1}{2} \left(\frac{dx}{dt} \right)^2=E$$
It follows,
$$(\frac{dx}{dt})^2=2E-x^2$$
Supposing that $\frac{dx}{dt} \geq 0$ (ie spring is moving in positive direction), we get:
$$\frac{dx}{dt}=\sqrt{2E-x^2}$$
$$dt=\frac{dx}{\sqrt{2E-x^2}}$$
$$t+c=\arcsin(\frac{x}{\sqrt{2E}})$$