“Know how to solve every problem that has been solved.” “What I cannot create, I do not understand.” — Richard Feynman

Functional Derivatives

Quantum Chemistry

A walkthrough of functional derivatives aimed at someone who has never taken one. We'll do it twice — once in math language, once in physics language — and untangle the notation that gets overloaded in DFT.

What is a functional?

A function takes a number and gives you back a number. takes and hands you . A functional takes a whole function and gives you back a number. takes the function and hands you .

You've already met a bunch of functionals without thinking of them that way:

The square brackets are a physicist convention that says "I'm a functional, not a function." means "evaluate at the number ." means "apply to the whole function ." It's a small notational courtesy that turns out to matter once we start taking derivatives.

One more thing before we move on. Functions you draw — like a parabola or a sine wave — have an infinity of points in them. Choosing a function is like picking values at infinitely many independent knobs. That's the picture to keep in your head: a functional is a function of infinitely many variables. Its "input space" is the space of all functions.

Two views of "the derivative"

For an ordinary function , the derivative answers a simple question: how does change when you nudge by a little? Answer: .

For a functional , the analogous question is: how does change when you nudge by a little? But "nudge " needs more saying than "nudge " — is a whole function, infinitely many points. Are you wiggling it at ? At ? Everywhere at once? The answer has to handle every possible variation simultaneously.

We write the functional derivative . And here is the disambiguation that took me a while to internalize: there are two different things people mean by this symbol in DFT, and they look different on paper.

Math view: a linear operator

In the math view, the functional derivative at is a "linear functional" — a linear operator that takes a function (, the direction of the variation) and returns a number (the linear part of how changes):

So in the math view, is an operator, not a function. It eats , it returns a number.

Physics view: a function of x

In the physics view, the functional derivative is a function of . The way you use it is through the integral:

where is whatever variation you're making and the integrand is the physics-view functional derivative. You compute it by varying , expanding to linear order in , and reading off whatever function sits next to it inside the integral.

Are the two views the same thing?

For almost everything you meet in DFT — energy integrals, Coulomb terms, kinetic-energy functionals — yes. The math view's linear operator is represented by integration against a kernel, and that kernel is the physics view's function of . Different names for the same object.

For weirder functionals like (just evaluate at zero), the physics view forces , a Dirac delta. The math view shrugs: the operator is "evaluate at zero." Both correct; same object, different language.

Practical advice. The physics view is what you compute with. Vary , expand to linear order, read off from inside the integral. Done. The math view is there for the moments when you want to ask whether what you wrote down even makes sense — for that you need to think about which space of functions you're working in. We mostly won't need it.

The notation zoo

DFT loves the symbol . Reading a paper you'll see it used for at least four different things, often in the same paragraph, with the author assuming you'll sort them out from context. The four jobs:

  1. — a small change in . Just like is "a small change in ," is "a small change in the density." It's itself a function. When you write you mean "evaluate at the density with a small wiggle added."
  2. — the Dirac delta. A "function" that's zero everywhere except at , where it spikes infinitely. Defined by for any reasonable . Picture it as a tall thin bump in the limit where the bump becomes infinitely narrow and infinitely tall, with the total area always 1.
  3. — the functional derivative we just defined.
  4. — the Kronecker delta. Equals 1 if , 0 otherwise. Discrete-index version of (2). Same Greek letter, completely different beast — and the only one in this list that's just a number rather than a function or distribution.

A paper will mix several of these in a single line. Take this formula, which appears any time someone differentiates the density with respect to itself:

Three different uses of on one line. The two 's in the ratio on the left form the functional-derivative symbol (use 3). The inside that ratio is "small change in " (use 1). The on the right is the Dirac delta (use 2). The equation itself reads as: "the density at is independent of the density at unless they're the same point" — which is what you'd expect, since the density at one point isn't tied to the density anywhere else.

When you read DFT, the rule is: figure out which kind of object each is acting on, line by line. It's annoying at first; it becomes automatic.

Three worked examples

Each one follows the same recipe: write , expand to first order in , and identify whatever function sits next to inside the integral. That function is .

Example 1:

The simplest non-trivial functional. Apply the recipe:

The first term is . The third is , throw it out at linear order. The middle term is the linear correction:

Match it against the definition and read off:

The functional derivative of "integrate the square of the function" is "twice the function itself." Same shape as — the rule still works, you just remember that is a function of , so the answer is a function of too.

Example 2: The Hartree energy

This is the example that pays the most rent. The Hartree energy is the Coulomb interaction between the charge density and itself:

Apply the recipe. Expand and keep only first-order terms in :

The two terms are the same after renaming in one of them (since is symmetric). They add:

The bracket is what multiplies inside the integral, so:

The functional derivative of the Hartree energy is the Hartree potential. The "Coulomb potential due to the electron density" that you write inside the Fock equation is a functional derivative. If you've worked with Hartree-Fock at all, you've been computing functional derivatives without calling them that.

Example 3: Thomas-Fermi kinetic energy (a local functional)

This one matters for understanding what "local approximation" means. The Thomas-Fermi model approximates the kinetic energy as something that depends only on the density at each point:

where is a constant that doesn't matter for the calculation. Apply the recipe, but is a non-linear function of , so use a Taylor expansion:

Plug back in and read off:

Two things to notice. First, the answer is a function of — same as the input — confirming that the functional derivative of a "nice" functional is itself a function. Second, the answer at a point depends only on at that same point — no other locations are involved. That's what "local" means in "local-density approximation." LDA exchange-correlation functionals work exactly the same way: the xc potential at is a function only of the density at .

Exotic rules

The recipe so far ("expand to first order, read off the function next to ") covers most everyday cases. Three situations require small extensions.

The chain rule

Suppose depends on through some intermediate function . The functional derivative breaks up exactly like the ordinary calculus chain rule:

If the intermediate map is non-local — say is most naturally written in terms of orbitals rather than the density — the chain rule picks up an integral:

This is the rule you need for orbital-dependent functionals — like Hartree-Fock exchange — when you want to convert back into . The procedure for doing this in DFT is the Optimized Effective Potential (OEP) method, and every step of it is just the non-local chain rule above, written out.

Gradient functionals and integration by parts

What if depends on the gradient of , not just itself? The von Weizsäcker kinetic-energy functional is the canonical example:

Apply the recipe. Wiggle : the gradient changes by , and after expanding the integrand to linear order in , you end up with a term that looks like . Annoying — the standard form wants alone inside the integral, not its gradient. The fix is integration by parts:

Assuming the boundary terms vanish (good for any physically reasonable density that decays at infinity), you push the gradient off and onto whatever was multiplying it, picking up a minus sign. Everything ends up in the standard form, and you can read off the functional derivative as a function of .

The general moral: when the functional depends on derivatives of , the functional derivative involves derivatives of whatever multiplied , with signs flipping per integration by parts. This is exactly the same trick that turns calculus of variations into the Euler-Lagrange equation — in fact the EL equation is itself a functional-derivative result, just applied to the classical action.

Constraints and Lagrange multipliers

In DFT the density isn't free to be anything — it has to integrate to electrons:

When you minimize subject to this constraint, you can't just set — that would be the unconstrained answer, and it would generically violate the particle-number condition. The right move is a Lagrange multiplier :

Now set . The functional derivative of the constraint is just 1, so:

The functional derivative of the total energy equals a constant (independent of ). That constant is the chemical potential — the energy cost of adding one more electron to the system. So the right statement isn't "the functional derivative is zero," it's "the functional derivative is flat." Same flavor of move as ordinary constrained optimization, just with a function-valued gradient.