I have been reading about the derivation of the Hamiltonian from the Lagrangian using a Legendre transform. The Lagrangian is a variable whose value, by definition, is independent of the coordinates used to express it. (The Lagrangian is defined by means of a formula in one set of coordinates, and the formula for its value in any other set of coordinates is simply what you get from substituting the coordinate-transformation functions into the original formula). The Hamiltonian is defined as the Legendre transform of the Lagrangian, with respect to a particular set of coordinates. The formula for that transform uses the chosen coordinates. So the Hamiltonian is not well-defined unless we can be certain that the value will be the same if we use any different set of coordinates to perform the Legendre transformation. The derivations I have seen have not addressed this point. They just seem to assume the Hamiltonian will be well-defined. Am I missing something obvious here? Is there a simple reason why the Hamiltonian's value will not depend on the coordinates used to derive it?