1. Nov 9, 2013

### LFCFAN

Hello fellow PF members

I was wondering how one would go about finding the lagrangian of a problem like the following:

A particle is constrained to move along the a path defined by y = sin(x).

Would you simply do this:

x = x
y = sin(x)

x'^2 = x'^2

y'^2 = x'^2 (cos(x))^2

Kinetic energy = T = (1/2)m(x'^2 (1+ (cos(x))^2))

Potential = V = mgsin(x)

Therefore, the lagrangian is given by

L = T - V = (1/2)m(x'^2 (1+ (cos(x))^2)) - mgsin(x)

Or have a been totally wrong throughout?

Thanks a lot guys. Any input would be greatly appreciated.

2. Nov 9, 2013

### CAF123

I think it looks fine.

3. Nov 9, 2013

### LFCFAN

Thanks. Would it be similar for all y=f(x)?

4. Nov 9, 2013

### CAF123

If there is always the constraint that the particle moves along the curve,then yes. You can also generalise this to surfaces. Consider a particle moving along a surface $f(r,\theta, \phi) = 0$. This gives you a dependence among $r, \theta$ and $\phi$ and you can express any one of them in terms of another to eliminate the number of generalised coordinates and hence the number of Lagrange's equations you have to solve.

5. Nov 9, 2013

### K^2

You can solve this particular constrained problem by substitution y -> sin(x), yes. However, that's not the general way of working with constrained motion. Substitution is not always trivial. Instead, one may define the equation of constraint.

$$f(x, y) = y - sin(x) = 0$$

In general, constraint can be any constant function. In this case, y - sin(x) is the obvious choice.

With constraints included, your Lagrangian picks up an extra parameter - Undetermined Lagrange Multiplier. It is customary for undetermined multiplier to be denoted as $\lambda$.

$$\mathcal{L}(x, y, \lambda) = T - V - \lambda f(x)$$

If you have multiple constraints, you can have multiple functions $f_i(x, y, ...)$, each associated with its own multiplier $\lambda_i$. From here on, the necessary conditions for finding solution are exactly the same. So lets consider your kinetic and potential terms.

$$\mathcal{L} = \frac{1}{2}m\dot{x}^2 + \frac{1}{2}m\dot{y}^2 - mg~sin(x) - \lambda \left(y - sin(x)\right)$$

$$\frac{\partial \mathcal{L}}{\partial x} - \frac{d}{dt}\frac{\partial \mathcal{L}}{\partial \dot{x}} = -mg~cos(x) + \lambda~cos(x) - m\ddot{x} = 0$$
$$\frac{\partial \mathcal{L}}{\partial y} - \frac{d}{dt}\frac{\partial \mathcal{L}}{\partial \dot{y}} = - \lambda y - m\ddot{y} = 0$$

Or if we rearrange it into a bit more sightly form, we have the equations of motion.

$$m\ddot{x} = (\lambda - mg)cos(x)$$
$$m\ddot{y} = -\lambda$$

Here, it's pretty clear why multiplier $\lambda$ works as a constraint force in the EoM. The neat thing about it is that even if you are using generalized coordinates, where trying to think about generalized forces might be a bit tricky, $\lambda$ will continue to work as a generalized constraint force without you having to do any extra work.

Finally, if you solve the above keeping the constraint equation in mind, you should get exactly the same motion you'd get if you solved the problem using the substitution method.

6. Nov 9, 2013

### LFCFAN

Thanks a lot man.

But what I've done is correct, right? Literally can go on to find equations of motion with my lagrangian?

7. Nov 9, 2013

### dipole

No you should not just substitute a constraint into your Lagrangian. Look again at how the Euler-Lagrange equations were derived, they were derived under the assuming that $x,y,\dot{x},\dot{y}$ are independent .

Sometimes what you have done will work, but that's just an accident. In general it's incorrect and theres no guarantee the resulting equations of motion will be correct. What you should do, is either use the method of Lagrange multiplies like described above, or write down the Lagrangian without worrying about the constraint, and then apply it once you have the equations of motion.