# Derive variation in Gibbs free energy on variation of $n_i$ [closed]

My text book states, that in thermodynamic equilibrium, $\delta G=0$ on variation of $n_i$, and then gives the following equations:

$\displaystyle G(T,p,n_i)=\sum_i n_ig_i(T,p) - RT\sum_i n_i ln\frac{n}{n_i}\\ \displaystyle \delta G=\sum_i \delta n_i \left[g_i(T,p)-RT\ln\frac{n}{n_i}\right]-RT\sum_i n_i \left(\frac{\sum_j \delta n_j}{n}-\frac{\delta n_i}{n_i}\right)$

I understand the first equation, but sadly, my attempt at deriving the second one didn't work:

$\displaystyle \frac{\partial G}{\partial n_j}=g_j-RT\ln\frac{n}{n_j}+RTn_jn\frac{n_j}{n}\\ \displaystyle \delta G=\sum_i \delta n_ig_i-RT\sum_i\ln\frac{n}{n_i}\delta n_i+RT\sum_i n_i^2\delta n_i$

• Are you confused about what the $\delta$ notation means, or the mathematics of how to actually perform the variation? Or something else? Commented Jul 25, 2018 at 13:23
• @MichaelSeifert About the mathematics of performing the variation. I think it should just be $\delta G=\sum_i (\partial G/\partial n_i)\delta n_i$, but the sums are confusing me and I don't get the correct result.
– Keno
Commented Jul 25, 2018 at 13:27
• Can you edit the question to include your incorrect derivation? It'll be easier to see where you're going wrong. Commented Jul 25, 2018 at 13:28
• @MichaelSeifert Done
– Keno
Commented Jul 25, 2018 at 13:38

Your derivation has two errors. First, the quantity $n$ is (presumably) a sum of the $n_i$'s of all species: $$n = \sum_k n_k$$ and so must be varied as well as the explicit $n_i$ quantities: $$\delta n = \sum_k \delta n_k.$$
Second, you have an error in your derivative of the second term; applying the chain rule correctly, you should have $$\frac{d}{dx} \ln \left( \frac{a}{x} \right) = \frac{1}{a/x} \frac{d}{dx} \left( \frac{a}{x} \right) = \frac{x}{a} \left( - \frac{a}{x^2} \right) = - \frac{1}{x}.$$ Alternately, you could see this by writing $\ln(a/x) = \ln a - \ln x$ and taking the derivative of that. Splitting up the logarithms in this way usually makes your life easier when they come up in thermodynamic proofs (which is often.)