Why one energy is not enough
The internal energy U(S,V) is the 'natural' energy, but S and V are awkward masters. You almost never hold entropy fixed — how would you even clamp it? In a real experiment you fix T with a thermostat and P with the surrounding atmosphere. We want an energy-like quantity whose natural variables are the ones we control.
The Legendre transform
The trick that swaps a variable for its conjugate slope is the Legendre transformation. The plain picture: instead of describing a convex curve y(x) by its stream of points, describe it by its family of tangent lines — by the slope p=dy/dx at each point rather than the point itself. Nothing is lost, because a convex curve is equally well pinned down by its tangents.
Concretely: to trade S for its conjugate slope T=(\partial U/\partial S)_V, subtract the product TS from U. The result, the Helmholtz free energy F=U-TS, is a function of T and V that carries exactly the same information as U.
Subtracting TS cancels the T\,dS term and swaps the natural variable S for T.
Enthalpy, Helmholtz, Gibbs
Apply the same move to each variable you want to swap. Trade V for P and you get the enthalpy H. Trade S for T and you get F. Trade both and you get the Gibbs free energy G — the potential natural to the lab pair (T,P).
The four potentials: internal energy U and its three Legendre transforms.
Each potential's natural variables can be read straight off its differential.
What each potential is good for
The deep reason these matter is the second law in disguise. An isolated system maximizes entropy, but a system in thermal (and mechanical) contact with a reservoir instead minimizes the appropriate potential. Spontaneous change drives F down at fixed (T,V), and G down at fixed (T,P); equilibrium is the minimum.
The spontaneity and equilibrium criteria for a system held at fixed temperature.
Each potential has a concrete meaning too: F is the maximum work extractable isothermally (hence 'free' energy); H tracks the heat exchanged at constant pressure (why chemists love it); and G governs phase and chemical equilibrium at ordinary lab conditions. For a single-component system G=\mu N, foreshadowing the chemical potential of Guide 4.