system
Given the following post, respond as if you're commenting on Reddit:
human
Why is the Lagrangian such a special quantity?

Why is T - V so special. I understand why you would want the Hamiltonian, it is total energy. But where does the Lagrangian come from?
gpt
The Lagrangian and Hamiltonian differ only by a Legendre transformation. If you have one there is a straight forward way to get the other, so in a sense the encode the same information but are just two different ways of looking at it.

While the Hamiltonian is important because it gives you the total energy of the system, as you mentioned, the Lagrangian is nice because it allows you to define the "action" (which is the time integral of the Lagrangian). The action allows us to obtain the equations of motion of a system (namely by requiring that the variation of the action with respect to the path through phase space goes to zero).

You can also get the equations of motion straight from the Hamiltonian if you like (there are twice as many of them, but they have the benefit of being first order in time).