Q:

Equivalence of different definitions for chemical potential

In some books, the chemical potential is defined in term of the Gibbs energy as
$$
\mu_i \equiv \left( \frac{\partial G}{\partial n_i}  \right)_{P,T,n_j}
$$
where $n_j$ indicates all mole numbers except the ith species mole number.
In other books, it is defined in term of the Helmholtz energy as
$$
\mu_i \equiv \left( \frac{\partial A}{\partial n_i}  \right)_{V,T,n_j}
$$
Looking up at the Physics Stack Exchange, I could also find:
$$
\mu_i \equiv \left( \frac{\partial U}{\partial n_i}  \right)_{S,V,n_j}
$$
And I suppose (by analogy) that one may also define it as
$$
\mu_i \equiv \left( \frac{\partial H}{\partial n_i}  \right)_{S,P,n_j}
$$
Are all these definitions equivalent? Why?
Or they give rise to different quantities and one should be consistent when using one definition or the other?
I have tried to work out one definition from the other using thermodynamics identities but I could not make it out.

A:

Let's start from the second TD law:
$$
\tag 1 dU(S,V) = TdS - pdV,
$$
In case of variable number of particles it is modified by the adding $\mu dn$ term to the right side:
$$
dU(S, V, n) = TdS - pdV + \mu d n.
$$
The other TD potentials are related with $U$ by Legendre transformation with variables $T, S, p, V$, but not $\mu$ or $n$. So it's obviously that the relation
$$
\mu = \left( \frac{\partial Y (n, X)}{\partial n}\right)_{X = const}
$$
is true for all of four TD potentials $Y$.

