# Hamiltonian mechanics - the independence of p and q

• QuasarBoy543298
In summary, Lagrangian mechanics assumes that the Lagrangian is a function of space coordinates, time, and the derivative of space coordinates by time (velocity). To derive the Hamiltonian, the Legendre transformation is used on the Lagrangian with respect to the derivative of space coordinates by time, resulting in a function with the space coordinates and momentum as independent variables. This is known as a "contact transformation" or "Legendre transformation." The natural independent variables for the Hamiltonian are the space coordinates and momentum, and the Euler-Lagrange equations, which are the equations of motion, take into account the relationship between the space coordinates and their derivatives. The Hamiltonian equations of motion take into account this relationship through the time derivative of
QuasarBoy543298
in the Lagrangian mechanics, we assumed that the Lagrangian is a function of space coordinates, time and the derivative of those space coordinates by time (velocity) L(q,dq/dt,t).

to derive the Hamiltonian we used the Legendre transformation on L with respect to dq/dt and got
H = p*(dq/dt) - L (q,(dq/dt)(q,p,t),t). so my question is - why we can treat p and q as independent coordinates here (dp/dq = 0...) , when obviously there is a conection?

By definition, the Hamiltonian is a function ##H(q,p,t)## with the ##q## and ##p## as independent variables. You eliminate the generalized velocities ##\dot{q}## with help of the ##p## (and ##q##). This is a socalled "contact transformation" or "Legendre transformation".

but dq/dt is dependent on q, so why we can transform p(q,dq/dt) to (dq/dt)(p,q) using Legendre transformation?

In the Lagrangian formulation the ##q## and ##\dot{q}## are considered independent variables of the Lagrange function, in the Hamiltonian formulation the ##q## and ##p## are considered independent variables of the Hamilton function. The Hamilton function is constructed such that this holds true (that's the Legendre transformation between the Lagrange and the Hamilton function!):
$$\mathrm{d} L = \mathrm{d} q \cdot \partial_q L + \mathrm{d} \dot{q} \cdot \partial_{\dot{q}} L$$
Now we have
$$H=\dot{q} \cdot p-L \quad \text{with} \quad p=\partial_{\dot{q}} L$$
and thus
$$\mathrm{d} H = \mathrm{d} \dot q \cdot p + \dot{q} \cdot \mathrm{d} p - \mathrm{d} L = \dot{q} \cdot \mathrm{d} p - \mathrm{d} q \cdot \partial_q L.$$
Thus the "natural independent variables" for ##H## are indeed ##q## and ##p##, and thus we have
$$\partial_p H=\dot{q}, \quad \partial_q H=-\partial_q L.$$
For the solutions of the Euler-Lagrange equations the latter equation gets
$$\partial_q H=-\partial_q L=-\frac{\mathrm{d}}{\mathrm{d} t} (\partial_{\dot{q}} L) = -\dot{p},$$
which gives the Hamilton canonical equations of motion.

Of course, you can also extend this to explicitly time-dependent Hamilton and Lagrange functions. Nothing changes in the above, you only get additionally
$$\frac{\partial L}{\partial t}=-\frac{\partial H}{\partial t}.$$

thank you for the quick response!
so if I understand correctly, we treat q and q dot as independent in the Lagrangian formalism (in the Lagrangian itself), but only when using EL equations we treat q dot as the derivative of q (or when constructing them from the extremal action principle). that is why we can treat them as independent until we demand EL to hold (or ds = 0...). that is why we can transform to p,q without having to worry about the relations between q and q dot. that relation wakes up only when constructing Hamilton equations using EL.

so at first (in the differential of H ), we treated H as a mathematical function with no relation between her coordinates, and the relation only comes from Hamilton's equations.

Yes, that's it! The trouble is the usual sloppyness of physicists in their notation using ##\dot{q}## at the same time as denoting the generalized velocities as independent variables in the Lagrange function and as the time derivative of the generalized coordinates when considering trajectories in configuration space and particularly the trajectories solving the Euler-Lagrange equations, which are the equations of motion of the mechanical system under consideration.

PeroK
thank you so much, it was really helpful !

## 1. What is Hamiltonian mechanics?

Hamiltonian mechanics is a mathematical framework for describing the motion of particles in a physical system. It is based on the principles of energy conservation and the concept of phase space, which is a mathematical space that represents all possible states of a system.

## 2. What is the Hamiltonian function?

The Hamiltonian function, denoted as H, is a key component of Hamiltonian mechanics. It is a mathematical function that represents the total energy of a system in terms of its position and momentum variables. It is often used to describe the time evolution of a system.

## 3. What is the significance of the independence of p and q in Hamiltonian mechanics?

The independence of p and q, also known as the principle of separability, is a fundamental concept in Hamiltonian mechanics. It states that the equations of motion for a system can be written in terms of two sets of variables: the position variables (q) and the momentum variables (p). This allows for a more efficient and concise description of a system's dynamics.

## 4. How does the independence of p and q relate to the conservation of energy?

The independence of p and q is directly related to the conservation of energy in Hamiltonian mechanics. Since the Hamiltonian function represents the total energy of a system, its independence from the variables q and p ensures that energy is conserved throughout the system's motion.

## 5. Can the independence of p and q be violated in certain systems?

Yes, in some systems, the independence of p and q may not hold. This is often the case in systems with non-conservative forces, such as friction or air resistance. In these cases, the Hamiltonian function may not accurately represent the total energy of the system, and the independence of p and q may be violated.

• Mechanics
Replies
7
Views
1K
• Mechanics
Replies
2
Views
2K
• Mechanics
Replies
3
Views
790
• Mechanics
Replies
43
Views
3K
• Mechanics
Replies
8
Views
1K
• Mechanics
Replies
3
Views
1K
• Mechanics
Replies
4
Views
1K
• Mechanics
Replies
5
Views
917
• Mechanics
Replies
2
Views
690
• Advanced Physics Homework Help
Replies
1
Views
714