In standard calculus, we find a number that minimizes a function . In the Calculus of Variations, we find a function that minimizes an integral , called a Functional.
This is the math behind “nature is lazy”: physics always chooses the path that minimizes “Action.”
The Euler-Lagrange Equation
To find the function that makes stationary (a minimum or maximum), we solve the Euler-Lagrange Equation:
Famous Problems
1. The Geodesic
What is the shortest path between two points? In flat space, the Euler-Lagrange equation tells us it is a straight line. On a curved surface (like Earth), it is a Great Circle.
2. The Brachistochrone
What shape of a wire allows a bead to slide from to in the shortest amount of time under gravity? Hint: It is not a straight line. It is a Cycloid (the path traced by a point on a rolling wheel).
3. Fermat’s Principle
Light travels between two points along the path that takes the least time. This principle alone allows us to derive Snell’s Law of refraction and the law of reflection.
Interactive Lab
import numpy as np
# Let's compare the time taken for a bead to slide down a straight line
# vs. a simple parabola (approximation of a cycloid)
g = 9.81
h = 10.0 # Height
L = 10.0 # Horizontal distance
# Straight line path
time_line = np.sqrt(2 * (L**2 + h**2) / (g * h))
# A curved path (e.g. y = x^2/10) actually allows the bead to pick up
# speed faster at the start, potentially reducing total time.
print(f"Time for straight line: {time_line:.2f}s")
print("Curved paths allow the object to trade potential energy for kinetic energy")
print("earlier in the run, resulting in a faster average velocity.")
python
1import numpy as np
2
3# Let's compare the time taken for a bead to slide down a straight line
4# vs. a simple parabola (approximation of a cycloid)
5g =9.81
6h =10.0# Height
7L =10.0# Horizontal distance
8
9# Straight line path
10time_line = np.sqrt(2*(L**2+ h**2)/(g * h))
11
12# A curved path (e.g. y = x^2/10) actually allows the bead to pick up
13# speed faster at the start, potentially reducing total time.
14print(f"Time for straight line: {time_line:.2f}s")
15print("Curved paths allow the object to trade potential energy for kinetic energy")
16print("earlier in the run, resulting in a faster average velocity.")
17
Use Cases
Classical Mechanics: Formulating the “Lagrangian” to find equations of motion.
Structural Engineering: Finding the shape of a bridge that minimizes stress.
Machine Learning: Variational Inference and optimizing neural network weights over a continuous space.
Exercises
Knowledge Check
In the Calculus of Variations, what is a 'Functional'?
Answer: A mapping from a space of functions to the real numbers.
A functional takes a whole function as 'input' and outputs a single number (like the total length of a path).
In the Calculus of Variations, what is a 'Functional'?
Knowledge Check
The Euler-Lagrange equation is to functionals what _____ is to regular functions.
Answer: The condition f'(x) = 0
Solving the Euler-Lagrange equation is how we find the 'critical points' where a functional is minimized or maximized.
The Euler-Lagrange equation is to functionals what _____ is to regular functions.
Knowledge Check
Why does light bend when it enters water (Refraction)?
Answer: To follow the path of least time, since light travels slower in water than in air.
According to Fermat's Principle, light 'chooses' to spend less distance in the slower medium (water) even if it means traveling more distance in the faster medium (air).
Why does light bend when it enters water (Refraction)?