# How does one formulate boundary conditions in a variational approach?

Many equations of motion can be derived from a variational principle. To take a simple example, the wave equation $h^{ij} \partial_i \partial_j u = 0$ (where $h^{ij}$ is the Minkowski metric $\mathrm{diag}[-1,+1,+1,+1]$) can be derived from the Lagrangian density

$L = \frac{1}{2} h^{ij} (\partial_i u) (\partial_j u)$ :

It is $\frac{\delta L}{\delta \partial_i u} = h^{ij} \partial_j u$, from which follows the equation of motion via the usual ansatz $\frac{\delta L}{\delta u} - \partial_i \frac{\delta L}{\delta \partial_i u} = 0$.

This calculation neglects boundary conditions, which it should not since the ansatz implies an integration by parts which has a boundary term. Assuming e.g. I want to solve the wave equation in a box $0 \le x \le 1$, how would I e.g. impose Dirichlet or von Neumann boundary conditions?

I can think of two approaches:

(1) Assume that $u$ lives in a function space that already satisfies the boundary condition. However, this seems complicated in general -- is this workable?

(2) Impose a constraint (via a Lagrange multiplier) that corresponds to the boundary condition. This seems weird because the multiplier would live only on the boundary of the domain.

Do these approaches work? Is there another way?

-
I am a little uncertain about this. Variational principles are formulated with the start and end points of the dynamics fixed. – Lawrence B. Crowell Feb 6 '11 at 1:00
Vanishing of the boundary terms via Neumann and Dirichlet boundary conditions was also discussed here: physics.stackexchange.com/questions/3543/… – Luboš Motl Feb 6 '11 at 5:52

The boundary term when you vary your action is $\int \delta u n^i \partial_i u$ where $n^i$ is a unit normal vector to the boundary and the integral is over the boundary. You want this term to be stationary under the variation. You can achieve this by taking $n^i \partial_i u=0$, that is Neumann boundary conditions, or you can demand that $u$ has a fixed value at the boundary which requires that one only consider variations $\delta u$ that vanish on the boundary, that is Dirichlet boundary conditions. Both lead to a consistent variational principle.