Navigating Infinite Paths

Calculus of Variation

Sudhanva N Rao

Think about the following problems: Finding the shortest path between two points on a cylinder’s surface or finding the shape of a cable hanging between two points. Differentiate and equate to zero, high school calculus? Unfortunately traditional calculus can only extremise functions but in these problems we are looking for functions which extremise certain quantities. So for example I need the path on that surface of a cylinder joining two points which minimises the length of the path. These require a more powerful tool: the calculus of variations. This field is motivated by the desire to determine which function or curve among infinitely many possible candidates yields the best, or extremal, value of a given integral quantity, often referred to as a functional.

The story of the calculus of variations goes back to the late 1600s, sparked by some pretty intriguing challenges. One famous problem came from Johann Bernoulli, who asked: what’s the quickest path for a ball rolling downhill between two points? This seemingly simple question caught the attention of big names like Isaac Newton and the Bernoulli brothers, who all chipped in to solve it. Their work laid the groundwork for a whole new way of thinking about optimization—not just numbers, but functions and curves. Later, mathematicians like Euler and Lagrange formalized these ideas, creating the foundational tools and equations that still guide the field today. Their efforts turned a collection of puzzles into a rigorous branch of mathematics that’s still very much alive.

At its core, the calculus of variations is about finding the best function to optimize a certain quantity. 

To begin, we need to understand the functional, the object we’re trying to optimize. In simple terms, a functional is a kind of “function of functions.” It’s not just about finding the minimum or maximum of a single value, like in regular calculus. Instead, you’re optimizing over entire functions.

$$J[y] = \int^{b}_{a} L(x,y(x), y'(x))dx$$

Here, \(y(x)\) is the function we’re trying to optimize, and \(y′(x)\) is its derivative. The term \(L(x,y(x),y′(x))\) is known as the Lagrangian, which can represent a variety of physical quantities, such as energy, distance, or cost. The functional \(J[y]\) represents the total quantity (like total energy or total time) that we want to minimize or maximize by finding the right function \(y(x)\).

Now, how do we actually find the function that optimizes this quantity?

A variation refers to a small tweak or perturbation we make to the function \(y(x)\). We’re looking at how the integral \(J[y]\) behaves when we slightly alter \(y(x)\). If the value of the functional changes in response to a small variation, then the function \(y(x)\) isn’t optimal. What we want is for the value of the functional to remain stationary (not change) under small variations.

The ultimate goal is to find the function where this variation is zero. But why? Because if a function’s value doesn’t change when we make small tweaks to it, then we know it’s “the best” in some sense—it’s a minimum or maximum (or a saddle point) of the functional. So basically we’re trying to find the function that doesn’t change under any small variations, which guarantees that it’s an extremum.

$$\delta \int^{b}_{a} L(x,y(x),y'(x)) dx = 0$$

On integrating by parts:

$$\frac{\partial L}{\partial y} – \frac{d}{dx} \left( \frac{\partial L}{\partial y’} \right) = 0$$

And yes. All the problems which seemed impossible have been reduced to just setting up the integral \(J[y]\) and invoking the EL equations subject to the boundary conditions. The optimal \(y(x)\) will satisfy the EL equations. 

The Euler-Lagrange equation serves as the fundamental principle of the calculus of variations. It establishes the necessary condition for a function to attain optimality, either by minimizing or maximizing a specified functional. This equation finds applications in diverse scientific and engineering disciplines, particularly in physics, where it governs the motion of particles and fields, and in optimization and control theory. 

Some Applications

Now that we have the theory in place, let’s take a look at some real-world problems where the calculus of variations is used.

The Brachistochrone Problem (The Fastest Descent)

One of the classic problems in the calculus of variations is the brachistochrone problem. The question is: what is the path a ball should take to travel from point AA to point BB in the shortest time, under the influence of gravity?

Using the calculus of variations, this problem leads to a curve known as a cycloid, which turns out to be the solution. It’s a fascinating example because it shows that the fastest path isn’t a straight line, but a curve that appears to “dip” and then climb—an unexpected result at the time!

The Catenary Curve (Hanging Cable)

Another example is the catenary problem, which involves finding the shape of a cable hanging under its own weight, such as a power line. The curve that describes this shape is called the catenary.

This shape minimizes the potential energy of the cable, and you can use the calculus of variations to derive it. It’s used in real-world engineering, for example in the design of suspension bridges.

Fermat’s Principle of Least Time (Light Path)

In optics, Fermat’s Principle of Least Time states that light will take the fastest path between two points. This can be derived using the calculus of variations, where we minimize the travel time of light. The principle leads to Snell’s Law of refraction, which describes how light bends when it passes through different media (like air to water).

Machine learning

As AI models grow more complex, we often need to optimize certain performance metrics, like minimizing error or maximizing efficiency. Techniques inspired by the calculus of variations, such as gradient descent, are used to adjust model parameters. Even neural networks rely on optimization techniques that find parallels in the ideas we’ve covered here.

Concluding Remarks

The calculus of variations provides a unifying framework to solve optimization problems where you are minimizing or maximizing a quantity that depends on an entire function, rather than just a single variable. Whether it’s finding the fastest path, optimizing energy systems, or understanding physical laws, the principles of this field have countless applications in both theoretical and practical contexts.
In the end, the calculus of variations is more than a set of equations—it’s a lens through which we can view the world of optimization, efficiency, and choice. Whether you’re designing a bridge, developing new technology, or working on the next breakthrough in AI, these ideas will continue to shape the future.