The catenary is the curve that is naturally formed when a chain of constant linear density hangs from two fixed points. This is a typical example on variational calculus showing the use of Lagrange multipliers. Next, I develop the problem entirely in Mathematica
You may need MathematicaPlayer if you do not have Mathematica.
This problem can be generalized to find the surface with minimum energy, which is shown next