# Functional derivative of energy with respect to density

I have read the paper of "A bird's-eye view of density-functional theory [PDF]" and I have a question about the functional derivative of the energy by the density.

I have found the following equation in the paper and attached the screenshot as follows.

This is the derivative of the energy functional with respect to the density, and the right side of this equation contains the external potential and Hartree potential terms. Each term is a scalar value at a position $$r$$.

So, I think this equation means that this derivative is zero at each position (all positions). For example, if I make a finite grid points and get $$G$$ points (e.g., $$r_1$$, $$r_2$$, ... $$r_G$$), I believe that the grid points have the derivatives and they are zero as:

$$\tag{1} δE/δn(r_1) = δE/δn(r_2) = ... = δE/δn(r_G) = 0.$$

Is it right?

If so, I can not have an intuitive understanding and the physical meaning of this. If the functional derivative results in its derivative being zero at each positions (all positions), does this mean that the energy does not change with the density, i.e., is this a constant function and does this mean the ground-state?

You are developing the right idea, but your Eq. 1 is a bit awkward. To understand why, let me say a bit about functionals and functional derivatives.

A functional acts on a function in its entirety, for example we need to know the full input function $$n(r)$$ in order to obtain the corresponding value for the functional:

$$\tag{1} E[n(r)] = \int_0^1n(r)\textrm dr.$$

The output is different for $$n(r) = n^2$$ versus for $$n(r) = \sqrt{n},$$ and each $$n(r)$$ function will give a different value for the functional $$E$$.

This is different from an ordinary composite function like $$f(g(r))$$ with round parentheses, because you do not need to take into account all of $$g(r)$$ in order to get $$f(g(r))$$, since $$f$$ is only acting on $$g$$ at a specific point like $$r=2$$, which means that $$f(g(2))$$ makes sense but $$E[n(2)]$$ is a bit awkward. Technically speaking, $$n(2)$$ can be considered a constant function, but a constant function of what? The integral in my Eq. 1 can still be evaluated (with respect to the variable that was already set to 2?), but the square brackets tell us that $$E[n(r)]$$ is meant to be evaluated based on all values of $$r$$, not just one of them.

Technically functionals are also functions, in which the domain contains functions (i.e. it maps functions to outputs, which can be scalars, vectors, functions, or even functionals; an example of the latter being a functional that turns polynomials into operators, like $$r^2 \rightarrow \frac{\textrm{d}^2}{\textrm{d}r^2}$$), but we use square brackets and round brackets to tell us how the author intends for us to use the two different types of operators.

Consider the difference between the following two derivatives:

$$\tag{2} \frac{\textrm{d}f(g(r))}{\textrm{d}r}~~~~~~~~~~~,~~~~~~~~~~~ \frac{\delta f[g(r)]}{\delta g(r)}~~.$$

It would be awkward to put $$g(r)$$ in the denominator of the first one, because the ordinary derviative $$\frac{\textrm{d}}{\textrm{d}r}$$ acts on functions whose domains are points (not functions), and likewise it would be awkward to put just a point like $$g(r_1)$$ in the denominator of the second one (otherwise why are you using the $$\frac{\delta}{\delta\left(\cdot\right)}$$ notation rather than the $$\frac{\textrm{d}}{\textrm{d}\left( \cdot \right)}$$ notation?).

Therefore, your Eq. 1 is written awkwardly.

Now consider what it really means for the functional derivative of the energy with respect to the density, to be 0. It means that changing the function $$n(r)$$ will not change the energy. For example if you shift the Gaussian $$n(r) = e^{-r^2}$$ to $$n(r) = e^{-(r-0.1)^2}$$, the energy does not change (if the functional derivative of $$E$$ with respect to $$n(r)$$ is 0). Contrarily, if the derivative of the energy with respect to a grid point $$r_1$$ is 0, it would mean:

$$\tag{3} \left. \frac{\textrm{d}E(n(r))}{\textrm{d}r_1} = \frac{\textrm{d}E}{\textrm{d}n}\frac{\textrm{d}n}{\textrm{d}r} \right|_{r=r_1}= 0,$$

which can happen if $$n(r)$$ is flat, meaning that it doesn't change if you move the grid point $$r_1$$.

It is not true that the density $$n(r)$$ has to be flat (constant with respect to $$r$$) in order for $$\frac{\delta E}{\delta n(r)}$$ to be 0. The density can take the shape of a roller coaster, and still we can have that the energy does not change when we change the shape of the roller coaster (i.e. the functional derivative of the energy with respect to the shape of the roller coaster is 0).

• Thank you for your detailed answer. I now have a much better understanding of functional derivative, but I think it very strange that the energy remains the same even though the density changes like a roller coaster.
– neco
Sep 2, 2021 at 20:04
• I have posted a new question. Please take a look at it too. mattermodeling.stackexchange.com/questions/6662/…
– neco
Sep 3, 2021 at 9:40

By asking about the discretization of $$\mathbf{r}$$, I think you may be trying to visualize/intuitively understand the spatial variation of the energy and density, $$\mathrm{d}E/\mathrm{d}\mathbf{r}$$ and $$\mathrm{d}n(\mathbf{r})/\mathrm{d}\mathbf{r}$$, and you are conflating that with the meaning of the functional derivative $$δE[n]/δn(\mathbf{r})$$.

If you have a density, $$n(\mathbf{r})$$, such that $$\tag{1} \frac{δE[n]}{δn(\mathbf{r})} = 0,$$ you have found a stationary point. This derivative should be interpreted as how the energy changes with respect to the density (at all $$\mathbf{r}$$). That is, assuming that the stationary point corresponds to a minimum (which is the goal here), the density that satifies my Eq. (1) minimizes the energy at all $$\mathbf{r}$$. Any change to the density (anywhere in space) will no longer minimize the energy. By definition, the ground state is the minimum energy state.

• +1 but uhoh! 24 seconds after you posted this I wrote something a bit contradictory, see my paragraph around my Eq. 2! Sep 2, 2021 at 14:18
• Yes, my notation in the discretization is a little sloppy :) your answer is excellent and much more clear in that aspect, so I'll go ahead and edit out the beginning of my answer. Sep 2, 2021 at 14:21
• I think our answers complement each other, since I talked about the awkwardness of OP's notation, and you actually addressed their concern about how the functional changes with respect to the density at each grid point (which I was going to write about next, but stopped when I saw that another answer was already posted while I was writing!). I guess this is why they want us to have at least 2 answers per question, so that two answers can complement each other and make something that is better than the sum of its parts :) Sep 2, 2021 at 14:26
• Thank you for your detailed answer. I have a better understanding now. I thought that since the right side potential v(r) is a scalar value at a position, the left side δE/δn(r) is also zero at a position.
– neco
Sep 2, 2021 at 20:03
• I have posted a new question. Please take a look at it too. mattermodeling.stackexchange.com/questions/6662/…
– neco
Sep 3, 2021 at 9:40