# Computing functional derivative of exchange-correlation functional

Sakurai and Napolitano's chapter on density functional theory has claims that it is "straightforward" to find $$\delta U_{\text{xc}}/\delta n$$ for $$U_{\text{xc}}[n]=\int d^3 x n(\mathbf{x})\epsilon(n)\tag{2.33}$$ and a given $$\epsilon(n)$$, but I can't seem to figure out where to start with this calculation. My knowledge of variational calculus as it appears in Lagrangian mechanics has me calculating $$\int_{-\infty}^\infty \frac{\partial[n(x)\epsilon(x)]}{\partial n} d^3 x$$ but integrating using Mathematica led to a recursion error, so I am a bit confused, especially since this1 thesis claims that $$\frac{\delta U_{\text{xc}}}{\delta n(x)}= \frac{\partial[n(x)\epsilon(n(x))]}{\partial n(x)}.\tag{2.34}$$ I.e., free of the integral with respect to $$d^3 x$$. Which approach is correct? If the latter is correct, how does one arrive at that formula for $$\delta U_{xc} /\delta n(x)$$?

1 P. R. Tulip, Dielectric and Lattice Dynamical Properties of Molecular Crystals via Density Functional Perturbation Theory: Implementation within a First Principles Code.

• Should it be $\epsilon(r)$ or $\epsilon(n(r))$? Else the notation does not make sense to me. Commented Mar 17, 2022 at 7:39
• @JasonFunderberker the text has it written as is above, although I’m confident it’s supposed to be $\epsilon(n(r))$. Regardless I see your answer used the latter. Commented Mar 17, 2022 at 10:35
• Yes, but something like $\epsilon (n)$ is not really well-defined. If it is supposed to be a functional, then $E[n] = N \epsilon[n]$ and if it is a scalar function $\epsilon(x)$ then $E[n]$ is linear and thus its functional derivative is trivial. Hence, I assumed the non-trivial case, i.e. a function composition (which also makes sense in the realm of the LDA approximation). Anyway, I think this is just the usual sloppy notation in this kind of field. Commented Mar 17, 2022 at 12:41

In my opinion the notation is a bit weird. So let us first define $$\epsilon_n := \epsilon \circ n :x \mapsto \epsilon(n(x))$$ for some function $$\epsilon$$ and $$E[n] := \int \mathrm dx\, n(x) \, \epsilon_n(x)\quad.$$

We want to compute

$$\delta E[n][\varphi] := \lim\limits_{h \to 0} \frac{E[n+h\varphi]-E[n]}{h} \quad ,$$

where $$\varphi$$ denotes some suitable test function. We find

$$\delta E[n][\varphi] = \lim\limits_{h\to 0}\int \mathrm d x\, n(x) \frac{\epsilon_{n+h\varphi}(x)-\epsilon_n(x)}{h}+ \epsilon_{n+h\varphi}(x)\, \varphi(x) \quad . \tag{1}$$

To proceed, we compute $$\lim\limits_{h\to 0}\frac{\epsilon_{n+h\varphi}(x)-\epsilon_n(x)}{h} = \lim\limits_{h\to 0}\frac{\epsilon(n(x)+h\varphi(x))-\epsilon(n(x))}{h}\quad = \epsilon^\prime (n(x)) \, \varphi(x) \quad , \tag{2}$$

by using the chain rule. This eventually yields

$$\delta E[n][\varphi] = \int \mathrm d x\, \left(\epsilon(n(x)) + n(x)\, \epsilon^\prime (n(x)) \right)\varphi (x) \quad . \tag{3}$$ Finally, we see that by defintion

$$\frac{\delta E}{\delta n}[n](x) = \epsilon(n(x)) + n(x) \epsilon^\prime (n(x)) \quad,$$

which coincides with the form of the usual LDA exchange-correlation potential.