# Legendre transformations

The Hamiltonian form is defined in terms positions and conjugate momenta, whereas the Lagrangian form uses positions and velocities.

We need to be able to transform velocities into momenta, and to do this, we use the Legendre transformation.

### Simple case - two variables

Figure 6.1 - A monotonic function

We first suppose that we have two variables, $v, p$, such that $$p = p(v)$$ is a monotonic function of $v$. We also suppose that $$v = 0 \Leftrightarrow p = 0$$

Since $p$ is monotonic on $v$, the inverse also exists, $$v = v(p)$$

Nb. We're using $v, p$, along with $L, H$ below, for obvious reasons but this transformation has many applications in both maths and physics.

We now define two functions, \begin{align*}L = L(v) & \text{ where } \frac{\mathrm{d}}{\mathrm{d} v} L(v) = p\\H = H(p) & \text{ where } \frac{\mathrm{d}}{\mathrm{d} p} H(p) = v\end{align*}

Even though we defined $L$ in terms of $v$, and $H$ in terms of $p$, both $L, H$ can be considered as functions of either variable, \begin{align*}L &= L(v) = L\left(v(p)\right) = L(p)\\H &= H(p) = H\left(p(v)\right) = H(v)\end{align*}

Figure 6.2 - H, L as integrals

Now, we can integrate $p$ over $[0, v]$, $$\int_{0}^{v} p \mathrm{d}v = \int_{0}^{v} \frac{\mathrm{d} L}{\mathrm{d} v} \mathrm{d}v = L(v)$$

We can also integrate $v$ over $[0, p]$, $$\int_{0}^{p} v \mathrm{d}p = \int_{0}^{p} \frac{\mathrm{d} H}{\mathrm{d} p} \mathrm{d}p = H(p)$$

From the diagram, however, the sum of the two integrals is just the product of the two variables, $$pv = \int_{0}^{v} p \mathrm{d}v + \int_{0}^{p} v \mathrm{d}p = L + H$$

So, we find a relationship between $H, L$, $$H = pv - L$$

To confirm this relationship holds, we note that \begin{align*}\delta H &= p \delta v + v \delta p - \frac{\partial L}{\partial v} \delta v\\ &= v \delta p + \left( p - \frac{\partial L}{\partial v} \right) \delta v\\ &= v \delta p\\ &\Rightarrow \frac{\mathrm{d} H}{\mathrm{d} p} = v\end{align*} as expected.

### Many variables

Suppose now we can consider many variables. In short, we define (in Lagrangian terms), $$\frac{\partial L}{\partial v_i} = p_i$$ and then $H$ becomes $$H = \sum_{i} \left\{p_i v_i \right\} - L$$

Then, \begin{align*}\delta H &= \sum_{i} \left\{ p_i \delta v_i + v_i \delta p_i \right\} - \sum_{i}\frac{\partial L}{\partial v_i} \delta v_i\\&= \sum_{i} \left\{ v_i \delta p_i + \left(p_i - \frac{\partial L}{\partial v_i} \right) \delta v_i \right\}\\&= \sum_{i} v_i \delta p_i\end{align*} and so we get $$\frac{\partial H}{\partial p_i} = v_i$$