In the same way, sometimes solutions for the position(s) of a system is the most natural basis system for describing/investigating a problem (use the Lagrangian) and sometimes solutions for its momentum are (use the Hamiltonian).
Of course, they're intrinsically linked since the evolution of one determines the evolution of the other.
In fact, I to this day have not found a book that caters to my level of mathematical knowledge (undergrad pure math) on variational calculus. They're either _way_ too handwavy (like Taylor), or _way_ beyond reach (relying on heavy functional analysis, weak convergence, all that stuff).
Is there a textbook/lecture series/what have you that explains the calculus of variations at a "non-handwavy" level, BUT does not tries to perform the calculations in the most general way possible. That is, pick a nice space (C^\infinity or some such) and then show me with full rigor how the calculus of variations can be constructed. I'd love some references :)
I've not read any book on the calculus of variations, but I think that the book by Gelfand and Fomin is the standard book. Maybe that is suitable?
By the way, you can motivate the Legendre transform / Langrange multipliers like this. Suppose we want to minimise f(x) subject to g(x) = 0. We can add the constraint g(x) = 0 to the objective function by defining Q(x) = 0 if g(x) = 0 and Q(x) = infinite otherwise. Then the problem is min f(x) + Q(x). This seems like the kind of thing that doesn't help, but now write Q(x) = max_p (p g(x)). You can see that this is indeed the same as the previous definition of Q. So we can write that problem as min_x max_p f(x) + p g(x). This is a bit silly, and the usual way to explain Lagrange multipliers is probably better, but you may find it amusing.
If you are familiar with the method of Lagrange multipliers, then what's happening can be explained as follows. Given the Lagrangian L(x,v) the problem of classical mechanics is to find a trajectory x(t),v(t) that extremises the integral of L(x(t),v(t))dt under the constraint x'(t) = v(t). Lagrange multipliers are a method to deal with constraints in optimisation problems. Usually it's taught in the finite dimensional case, but it also works in the infinite dimensional case. We introduce a Lagrange multiplier p(t) and add the constraint to the objective: integral of L(x(t),v(t)) + p(t)(x'(t) - v(t)) dt. To solve the problem we minimise this over x,v,p. If we carry out the minimisation over v first then we're left with two variables x,p. That's the Hamiltonian formulation of the problem, and it's called the dual problem in convex optimisation. So the momentum p is the Lagrange multiplier for the constraint x' = v.
In more detail: we rewrite L(x(t),v(t)) + p(t)(x'(t) - v(t)) = L(x(t),v(t)) - p(t)v(t) + p(t)x'(t). Now we separate out H(x,p) = min_v L(x,v) - pv, so the original problem becomes to minimise the integral of H(x,p) + p(t)x'(t). After applying the Euler-Lagrange equations we obtain Hamilton's equations:
dH/dx = dp/dt
dH/dp = -dx/dt