I am a bit confused as to what I should use to derive the equations of motions from the lagrange equation.
Suppose I have a lagrange function:
$$L(x(t), \dot{x}(t)) = \frac{1}{2}m\dot{x}^2-\frac{1}{2}k(\sqrt{x^2+a^2}-a)$$
Method 1: Principle of least action
$$\delta L = \delta \dot{x}(m\dot{x})-\delta x \frac{kx(\sqrt{x^2+a^2}-a)}{\sqrt(x^2+a^2)}$$
$$\delta W = \int_{t_0}^{t_1} \delta L \ dt$$
After doing integration by parts, i obtain:
$$\delta W= -\int_{t_0}^{t_1} \delta x \biggl[m \ddot{x}+\frac{kx(\sqrt{x^2+a^2}-a)}{\sqrt(x^2+a^2)} \biggl] dt$$
for stationary points, $\delta W = 0$
Hence, inside the integral, $$m\ddot{x}+\frac{kx(\sqrt{x^2+a^2}-a)}{\sqrt(x^2+a^2)} = 0$$
and this is the equation of motion.
Method 2: Euler-Lagrange Equation
Alternatively, we can consider the euler lagrange equation:
$$\frac{\partial L}{\partial x} - \frac{d}{dt}\biggl(\frac{\partial L}{\partial \dot{x}} \biggl) = 0$$
By substituting $L$ into the euler-lagrange equation, we get the same equation of motion:
$$m\ddot{x}+\frac{kx(\sqrt{x^2+a^2}-a)}{\sqrt(x^2+a^2)} = 0$$
So method 2 is a lot easier than method 1, but why do we arrive at the same answer? I have a hunch both methods are essentially calculating the same thing, but I am not sure if this hunch is right because the euler lagrange equations seems a bit too simple as compared to principle of least action. Is there something i'm missing here?