# Homework Help: Lagrangian mechanics, Lagrange multiplier.

1. May 5, 2014

### jamie.j1989

1. The problem statement, all variables and given/known data
I've thought of a problem to help me with Lagrange multipliers but have got stuck.

Consider a particle of mass m moving on a surface described by the curve y = x2, the particle is released from rest at t = 0 and a position x = l. I'm trying to work out the EOM's but have got stuck.

2. Relevant equations

$\grave{L}$ = T - V - λ(y - x2)

T = $\frac{1}{2}$m($\dot{x}$2+$\dot{y}$2)

V = -mgy

3. The attempt at a solution

The Euler Lagrange equations give,

m$\ddot{x}$ = 2λx (1)

m$\ddot{y}$ = mg - λ (2)

attempt at solving for (1)

x = Asinh(kt) + Bcosh(kt)

which gives

k = $\sqrt{\frac{2λ}{m}}$

initial conditions give A = 0, B = l

This is where I get confused, I don't understand how the solution is cosh, surely it would be sinusoidal? And I'm unsure how to solve for λ? Thanks.

2. May 5, 2014

### maajdl

You could also assume λ<0 and get some Asin(kt) + Bcos(kt) solution.
Then you can get y from the constraint and go on to find λ and finally get the frequency of oscillation.
Also check the direction of the y-axis: is V=+mgy or is V=-mgy ?

Last edited: May 5, 2014
3. May 5, 2014

### jamie.j1989

Hi. I've done that and got,

x = lcos(kt)
y = l2cos2(kt)

where k = $\frac{2g}{1+4l^{2}}$

But when substituting $\ddot{x}$ and $\ddot{y}$ back into (1) and (2), I get two different values for λ

for (1)

λ = -$\frac{mg}{1+4l^{2}}$

for (2)

λ = mg(1 - $\frac{4l^{2}}{1+4l^{2}}$cos(kt))

I've placed my axis as y vertical, x horizontal, as the acceleration is in the negative y wouldn't V = -mgy?

4. May 5, 2014

### maajdl

I suggest you to cheat a little bit.
You could solve the same problem by the standard way: the Newton's equations and taking a reaction force perpendicular to the surface, but unknown.
In this way you will know the solution, and see where the problems come from.
In addition, you will see the relation between the Lagrange multipliers (method) and the reaction force.

(is y upward or downward ?)

5. May 5, 2014

### jamie.j1989

y is in the up direction. When doing it by Newtons second law I get,

$\ddot{x}$ = -mgsin(θ)cos(θ)
= -mg$\frac{2x}{1+4x^{2}}$

$\ddot{y}$ = -mgcos(θ)cos(θ)
= -mg$\frac{1}{1+4y}$

Where mgcos(θ) is the reaction force and θ = arctan($\frac{dy}{dx}$)

I then get for x and y

x = $\sqrt{\frac{1}{4}(1-e^{-α})+l^{2}e^{-α}}$

y = $\frac{1}{4}(1-e^{-α})+l^{2}e^{-α}$

where α = 2$\frac{\dot{x}^{2}}{g}$

I'm not sure how to go further after that. Also when using the Lagrange multiplier I was trying to use the reaction force to solve for the initial conditions, should the reaction force come out naturally with the solution?

6. May 5, 2014

### dauto

The potential seems to have the wrong sign. is Y downward?

7. May 5, 2014

### jamie.j1989

no I've put y up, as a normal x,y plot of y = x^2, if g is pointing in the negative y, why is the potential the opposite sign?

8. May 6, 2014

### maajdl

With y upward and gravity downward, it takes energy to bring a mass upward.
Therefore, the potential energy increases with y .

9. May 6, 2014

### maajdl

The end-result is less interesting than the derivation, specially if you want some insight in the Lagrange method. Only your derivation can help in a discussion.
Also, your final result must be wrong, at least the dimensions are wrong.

Note: The constraint y=x² is dimensionally wrong too. This is really bad.

10. May 6, 2014

### TSny

As others have pointed out, the mg in (2) should have a negative sign. V = +mgy. When a mass is raised, its gravitational potential energy increases.

But, more importantly, you cannot assume λ is a constant. In general, λ is an unknown function of time. So, you have three unknown functions to determine: x(t), y(t), and λ(t). Your constraint equation y = x2 gives a third equation to work with.

The equations look to me to be very difficult to solve in general. But I think you could solve them approximately for small oscillations.

11. May 6, 2014

### Orodruin

Staff Emeritus
It seems to me you are mixing functionals and functions in your Lagrange multiplier. The problem your are solving is equivalent to extremizing

$S[x(t),y(t)] = \int (T-V) dt$

under the condition that

$F[x(t),y(t)] = \int (y - x^2) dt = C$

where C is a constant, not under the constraint that y = x2. In order to write down the equations of motion for the constrained system, all you have to do is to use the constraint to replace one of the degrees of freedom in the Lagrangian with the other and you end up with a system with one degree of freedom. Do this and fix your dimensions and you should be fine.

12. May 6, 2014

### jamie.j1989

So I can't use λ(y-x2)? Would I fix the dimensions by just multiplying x2 by a constant with units m-1?

13. May 6, 2014

### maajdl

Concerning constrained motion treated by the Lagrange method, read this up to eq 720:

http://farside.ph.utexas.edu/teaching/336k/Newtonhtml/node90.html

Go back to the Newtonian laws of motion.
The normal force that is explicitly used in the Newton eom, is related to that.

Concerning the dimensions problem: just write y = a x², with a having the ad-hoc dimensions.
Alternatively, write y/yo = (x/xo)² .
Having dimensions is not only needed for correctness, but it is also helpful to detect mistakes.

14. May 7, 2014

### jamie.j1989

So after comparing the two methods, I've concluded that λ is the vertical component of the reaction force. And after attempting the Lagrange multiplier method again I have

λ = $\frac{mg}{1-4a^{2}l^{2}cos(αt)}$

where α is a function of λ in my solution to (1) x = lcos(αt). This seems sensible because when I substitute for t = 0 and x(t=0) = l

λ = $\frac{mg}{1-4a^{2}l^{2}}$ = $\frac{mg}{1-\grave{y}^{2}}$ = mgcos2(θ) = Ncos(θ)

Where N is the reaction force. Can I determine the frequency of oscillation considering α = α(t)?

15. May 7, 2014

### maajdl

It is difficult to give you an answer.
Your derivation is missing and it is more important for the discussion that the end result.
You are right that λ is directly related to the reaction force.

You don't explain the meaning of a in the expression for λ .
Therefore, I cannot check your claim in the second equation in detail.

Missing your derivation, I cannot identify how you might derive the actual motion, or how you could determine α(t).
I am also a little bit puzzled that the derivative of α(t) doesn't appear anywhere in your post.
Are you sure you did all the calculations assuming α=α(t)?
Didn't you need to write a derivative of α(t) somewhere?
The second derivative you mentioned earlier (see below) should end up with derivatives of α(t) (which is = k?).
Isn't it?

16. May 7, 2014

### BiGyElLoWhAt

Ok, maybe this is the wrong place to ask this:
I've dealt with the Lagrangian before, but what's happening here seems different than what I did; so can someone explain, How is $T - V - \lambda (y - x^2)$ any different than $T - V$, considering that y is defined:$y = x^2$, this seems to me what OP has is $T - V - \lambda (y-y) = T - V$. I don't see how this is any more useful than the $T - V$ definition, also, OP went from hyperbolic functions to regular trig functions?
to
Or is that a typo? Just trying to follow along here.

17. May 7, 2014

### TSny

A brief discussion of this example is here.

18. May 7, 2014

### TSny

It turns out that adding $\lambda (y - x^2)$ to the Lagrangian allows you to formally treat x and y as independent variables even though they are not really independent. So, x and y can be treated on an equal footing after introducing the λ term. If you don't introduce the Lagrange multiplier term, then you would need to write the Lagrangian in terms of one independent variable in this problem (x or y). This is very easy to do for this problem since the constraint y = x2 is already solved for y! So, you can easily eliminate y from the Lagrangian and find the equation of motion for x without using a Lagrange multiplier.

But for a more complicated constraint equation, it might not be easy to solve the constraint explicitly for one of the variables. If you use the Lagrange multiplier method, you don't need to bother to do this. Also, it turns out that the the Lagrange multiplier λ is closely related to the force of constraint. So, if you are interested in the forces of constraint, the Lagrange multiplier method can be helpful.

19. May 7, 2014

### BiGyElLoWhAt

I think I see what you're saying. So is that term intended to be implicitly 0?

20. May 7, 2014

### TSny

Well, it's zero whenever x and y satisfy the constraint. But when you modify the Lagrangian with the multiplier term, x and y are to be thought of as independent and therefore not necessarily satisfying the constraint ab initio. The multiplier λ is also treated as an independent variable in the Lagrangian and Lagrange's equation for λ is just the constraint equation. So, x and y end up having to satisfy the constraint! It's kind of weird, but it works.