Chain rule for functional derivates with the same variables I am following an online course where we should sometimes compute functional derivatives. The scope of the course is density functional theory, so we have the density $n(r)$ and we have functionals of the form $F[n(r)]$.
$$n(r) = \sum_i \Psi_i^*(r)\Psi_i(r)$$
In the course we need to perform derivatives with respect to $\Psi_i^*(r)$ not with respect to $n(r)$. One quick result is that:
$$\frac{\delta n(r)}{\delta \Psi_i^*(r)} = \frac{\delta \Psi_i^*(r)}{\delta \Psi_i^*(r)} \Psi_i(r) = \Psi_i(r)$$
One of the students used the chain rules for functional derivatives:
$$\frac{\delta F[n(r)]}{\delta \Psi_i^*(r')} = \int \frac{\delta F[n(r)]}{\delta n(r)}\frac{\delta n(r)}{\delta \Psi_i^*(r')}dr = \int \frac{\delta F[n(r)]}{\delta n(r)}\delta(r - r')\Psi_i(r) dr = \frac{\delta F[n(r)]}{\delta n(r')}\Psi_i(r')$$
Which is a really helpful result because it allows to compute derivatives directly with respect to $n(r)$ and still get what we want by just multiplying by $\Psi_i(r')$.
Now the problem I have, is that, in this line he introduced a new variable $r'$ while it shouldn't, the derivative should be with one variable $r$ everywhere, and I believe that this is not valid when the variables are the same (the integral doesn't vanish.).
What I did is that I used the functional derivative definition of composed function $F[g(f(r))]$ and adapted to each functional I needed to derive which lead to the same results with more work
While I acknowledge that the first solution is faster, I wouldn't be able to find it by myself because it doesn't make so much sense to me.
Any thoughts?
 A: Some of your expressions are problematic, if not meaningless, and maybe that's at the heart of your confusion. Fair warning: I would use the mainstream definition of the functional derivative used in physics, very often not math, as, e.g. in Largangian mechanics. Drop the different indices i, and the summation over them, since they don't enter the problem and just contribute extraneous functions which act like numerical coefficients in ordinary calculus.
You then pretend n(r) itself is a functional(which depends on some "parameter" r, even though not on the argument r' entering in the variation of the function you are about to differentiate it with respect to!), which you may differentiate unambiguously, to obtain the canonical expression,
$$  n(r)= \int\!\! dr' ~n(r') \delta(r'-r) ~~~\leadsto  \\
\frac{\delta n(r)}{\delta  \Psi^*(r')} = \int\!\! dr' ~  \Psi^*(r') \Psi(r') \delta(r'-r)   = \Psi (r')  \delta(r-r'),  \tag{1}$$
a function of r and r'.
Now, switch gears and think of n(r) as a function, again, entering in a functional F[n]. Since the functional  F does not depend on the argument of this function, we skip the "dummy" argument r of it.  Then, the functional derivative of it is the following  function of r',
$$\frac{\delta F[n]}{\delta \Psi^*(r')} = \int \frac{\delta F[n]}{\delta n(r)}\frac{\delta n(r)}{\delta \Psi^*(r')}dr = \int \frac{\delta F[n]}{\delta n(r)}\delta(r - r')\Psi(r') dr = \frac{\delta F[n]}{\delta n(r')}\Psi(r')~.\tag{2}$$
You might think of this as the directional functional derivative of F in the direction of $\frac{\delta n(r)}{\delta \Psi^*(r')}$.
Test-drive it with an overly silly easy functional, such as
$$
F[n]=  \int\!\! dr   ~ n(r)^5 =  \int\!\! dr   ~ \Psi^*(r)^5 \Psi(r) ^5 .
$$
Directly, you have the function
$$
\frac{\delta F[n]}{\delta \Psi^*(r')} = 5\Psi^*(r')^4 \Psi(r') ^5 , 
$$
but, by use of (2), you also get the same function
$$
\frac{\delta F[n]}{\delta \Psi^*(r')} = \int\!\!dr~ 5n(r)^4  \delta(r - r') \Psi(r')  =   5\Psi^*(r')^4 \Psi(r') ^5.
$$

*

*When in doubt, use finite-dimensional vectors, and take  vector derivatives
of scalar functions thereof, and only at the very end take the number of components j to go to infinity and utilize a continuous variable r for them.
So, (2) is something like $$\partial F(y)/\partial x_i^* =\sum_j \partial F /\partial y_i~~ \partial y_j/\partial x_i^* = \sum_j \partial F /\partial y_i~~   x_i \delta_{ij} ,$$ which might illustrate the necessity of two variables before their ultimate merge.

