# Euler-Lagrange equation

The Euler-Lagrange Equation is the major formula of the Calculus of variations. It provides a way to solve for functions which extremize a given cost functional. It is widely used to solve optimization problems, and in conjunction with the action principle to calculate trajectories. It is analogous to the result from Calculus that a function attains its extreme values when its derivative vanishes.

## Statement

Formally, given a functional F(x,f(x),f'(x)) with continuous first partial derivatives, any function f which extremizes the cost functional

$J=\int _{a}^{b}F(x,f(x),f'(x))dx$

must also satisfy the ordinary differential equation

${\frac {dF}{df}}-{\frac {d}{dx}}{\frac {dF}{df'}}=0$

## Examples

A standard example is finding the shortest path between two points in the plane. Assume that the points to be connected are (a,c) and (b,d). The length of a path y=f(x) between these two points is:

$L=\int _{{a}}^{{b}}{\sqrt {1+\left({\frac {dy}{dx}}\right)^{2}}}dx$

The Euler-Lagrange equation yields the differential equation:

${\frac {d}{dx}}{\sqrt {1+\left({\frac {dy}{dx}}\right)^{2}}}=0\Rightarrow {\frac {dy}{dx}}=C$

In other words, a straight line.

## Multidimensional Variations

There are also various multi-dimensional versions of the Euler-Lagrange equations. If q is a path in n-dimensional space, then it extremizes the cost functional

$J=\int _{{t1}}^{{t2}}L(t,q(t),q'(t))dt$

only if it satisfies

${\frac {d}{dt}}{\frac {dL}{dq'_{k}}}-{\frac {dL}{dq_{k}}}=0$ $\forall k=1,2,...n$

This formulation is particularly useful in physics when L is taken to be be the Lagrangian.

Another multi-dimensional generalization comes from considering a function on n variables. If $\Omega$ is some surface, then

$J=\int _{{\Omega }}L(f,x_{1},...,x_{n},f_{{x_{1}}},...,f_{{x_{n}}})d\Omega$

is extremized only if f satisfies the partial differential equation

$L_{f}-\sum _{{i=0}}^{{n}}{\frac {d}{dx_{i}}}{\frac {dL}{dz_{{x_{i}}}}}=0$

When n=2 and L is the energy functional, this leads to the soap-film minimal surface problem.