Why is the Legendre transformation the correct way to change variables from $(q,\dot{q},t)\to (q,p,t)$? I always found Legendre transformation kind of mysterious. Given a Lagrangian $L(q,\dot{q},t)$, we can define a new function, the Hamiltonian, $$H(q,p,t)=p\dot{q}(p)-L(q,\dot{q}(q,p,t),t)$$ where $p=\frac{\partial L}{\partial \dot{q}}$. Here, we are also expressing $\dot{q}$ as a function of $(q,p,t)$ by inverting $p=\frac{\partial L}{\partial \dot{q}}$. This way of defining the new function of $(q,p,t)$ from a function of $(q,\dot{q},t)$ is called the Legendre transformation; $H$ is called the Legendre transdform of $L$.
But I might have defined a function of $(q,p,t)$ by a simpler route. Take $L(q,\dot{q},t)$ and simply re-express it as a function of $\tilde{L}(q,p,t)$ without doing any Legendre transformation. If we are interested in changing variables from $\dot{q}\to p$, this is as good.

*

*My question is, why not work with the function $\tilde{L}(q,p,t)$? An inelegant thing about $\tilde{L}(q,p,t)$ (as opposed to $H(q,p,t)$ obtained by making a Legendre transformation) is that we cannot find an equation of motion for $\tilde{L}(q,p,t)$. Also, it has no energy interpretation. Is there something more to it (mathematically and physically)? Why is the Legendre transformation always the correct way to go from $(q,\dot{q},t)\to (q,p,t)$?

 A: Legendre transformation is necessary to switch to new independent variables: $q, \dot{q}, t\rightarrow q,p,t$. The differential of $H$ is:
$$dH = \frac{\partial H}{\partial q}dp + \frac{\partial H}{\partial q}dq + \frac{\partial H}{\partial t}dt = 
\dot{q}(p)dp - \frac{\partial L}{\partial q}dq - \frac{\partial L}{\partial t}dt,$$
i.e. $H$ is genuinely a function of $q,p,t$, whereas the differential of $\bar{L}$ still requires knowing $\partial\dot{q}/\partial p$, even it is parametrized by $p$.
It is the same Legendre transformation (although with a different sign) that is used in thermodynamics to switch between different thermodynamic potentials, i.e. between different sets of independent variables and responses.
A: When you switch from Lagrangian mechanics to Hamiltonian mechanics, you are not just making a change of variables, but you are moving from a problem set on the tangent bundle $TM$ to a problem set on the cotangent bundle $T^*M$. Furthermore, you are gaining a whole new symplectic structure.
Keep in mind that your goal is to solve the equations of motion. As already observed in a comment above, if you just make a change of variables, what equation do you get? To derive the Lagrange equations, you minimize the action functional $S=\int \mathcal{L}(t,q,\dot{q})dt$ by varying $q$ and $\dot{q}$. If you try to apply a similar treatment without introducing the Hamiltonian function, you will encounter some difficulties.
A: *

*Explaining why OP's proposal won't work is usually more difficult than just showing how the standard construction works, but let us try: Besides practicality, a problem with OP's proposal $\tilde{L}(q,p,t)$ is that it is not self-contained. To deduce the EOMs$^1$, we need more information than what the function $\tilde{L}(q,p,t)$ itself provides, e.g. a relation between $\dot{q}$ and $p$.


*Example: A non-relativistic charge in an EM background: The Lagrangian is $$L~=~\frac{m}{2}{\bf v}^2+q({\bf v}\cdot{\bf A}-\phi).$$ Then $${\bf p}~=~\frac{\partial L}{\partial {\bf v}}~=~m{\bf v}+q{\bf A}.$$
So $$\tilde{L}~=~\frac{{\bf p}^2}{2m} - q\underbrace{\left(q\frac{{\bf A}^2}{2m}+ \phi\right)}_{=\phi_{\rm eff}},$$
i.e. from $\tilde{L}$ we don't know how much of $\phi_{\rm eff}$ is due to electric and/or magnetic potentials, respectively, even though they lead to different physics.


*In contrast, an important virtue of both the Lagrangian and the Hamiltonian formulations is that they each are self-contained formulations. Knowing the Lagrangian xor the Hamiltonian gives us the EOMs.


*Concerning the standard Legendre transformation, see also e.g. this & this related Phys.SE posts.
--
$^1$ The equation for $\tilde{L}$ can be transcribed from the equation for $L$, but it will contain other functions as well.
