# Lagrangian mechanics, one-dimensional simple harmonic oscillator [closed]

Question

Consider a one-dimensional simple harmonic oscillator, i.e. a particle moving in a potential, $$u(x)=\frac{k}{2}x^2$$

(a) Explain why energy is conserved and solve the problem by reducing to a one-dimensional integral.

(b) Obtain a direct solution of problem 1(a) by obtaining Lagrangian and from it the equations of motion, then solving the equations of motion directly. Express any symbols you introduce in terms of physical quantities.

An Attempt at the solution

As provided by user below: $$\mathcal{L} = T - U = \frac{1}{2}m\dot{x}^2 - \frac{1}{2}kx^2$$ Euler-Lagrange tell us $$\frac{\partial \mathcal{L}}{\partial x} = \frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot{x}}$$

here, $$\frac{\partial \mathcal{L}}{\partial x} = -kx$$ $$\frac{d}{dt} \frac{\partial \mathcal{L}}{\partial \dot{x}} = \frac{d}{dt} (m\dot{x}) = m\ddot{x}$$

and so $$m\ddot{x} = -kx$$

I have found the solution of this differential equation to be $$x(t) = c_1 \cos\left(\sqrt{\frac{k}{m}} t \right) + c_2 \sin\left(\sqrt{\frac{k}{m}} t\right).$$ My Problem

I was just wondering if you could explain to me the significance of the constants. I am thinking that I am unable to determine them without some initial condition (which in this question I am not given) so hence am unable to 'simplify' further?

However, I have seen that looking at time, $t=0$, gives $x_0=c_1$, which would be simply saying that $c_1$ is the initial postion. I can similarly guess that $t=\sqrt{\frac{m}{k}}\left(\frac{n\pi}{2}\right)$, would give $c_2=x(\sqrt{\frac{m}{k}}\left(\frac{n\pi}{2}\right))$. However, this second part is clearly not constant so I clearly can not do this. My question is, can I find this condition (if I am even correct in doing this in the first place?)

• Have you taken any courses on ODEs? – Kyle Kanos Mar 2 '18 at 11:16

$$T = \frac{1}{2}m \dot{x}^2$$
$$L = T - U$$