Thermodynamic Equilibrium math. characterisation $d P=0$ question I have a basical question on the mathematical condition characterizing a system beeing in thermodynamic equilibrium: 
Let $P(A, B, C)$ is a thermodynamic potential with natural variables $A, B, C$ describing a given system
(e.g. : internal energy $U(S, V, N)$, Entropy $S(U, V, N)$, Helmholtz free energy  $F(T, V, N)$ or Gibbs energy $G(T, p, N)$
then for a system described by $P(A, B, C)$ is that is in thermodynamic equilibrium the necessary condition is  
$$d P= \frac{\partial P}{\partial A} dA +\frac{\partial P}{\partial B} dB +\frac{\partial P}{\partial C} dC=0$$
i.e. in TD equilibrium the potential is extremal (but recall that  it depends on concrete potential if the desired extremum is a maximum or minimum).
From basic analysis course we know that a neccessary condition on a function $P: \mathbb{R}^3 \to \mathbb{R}$ to have at point a $(A_0,B_0,C_0)$ an extremum tells that it's gradient at $(A_0,B_0,C_0)$ vanish, ie
$$(\nabla P)_{(A, B, C)=(A_0,B_0,C_0)}= \left(\frac{\partial P}{\partial A}, \frac{\partial P}{\partial B}, \frac{\partial P}{\partial C}\right)_{(A, B, C)=(A_0,B_0,C_0)}= (0,0,0)$$
This imply obviously that at extremal points neccessarily all partial derivatives in natural variables vanish.
On the other hand if we focus on the example of internal energy $P(A,B,C)=U(S, V, N)$, then using 
$$\mathrm{d} U = \frac{\partial U}{\partial S}  \mathrm{d} S  + \frac{\partial U}{\partial V} \mathrm{d} V + \sum_i\ \frac{\partial U}{\partial N_i} \mathrm{d} N_i\ = T \,\mathrm{d} S - p \,\mathrm{d} V + \sum_i\mu_i \mathrm{d} N_i\,$$
we have  
$$T = \frac{\partial U}{\partial S},\quad  p = \frac{\partial U}{\partial V},\quad \mu = \frac{\partial U}{\partial N}.$$
On the other hand there obviuosly exist systems in thermodinal equilibrium with $T, p,  \mu \neq 0$.
And this exactly my Question: if I have a TD system described by natural variables $A, B, C$ and TD potential $P(A,B,C)$ and I want to determine it's locus where it has it's TD equilibrium, how one should read & interpret the condition 
$$dP= \frac{\partial P}{\partial A} dA +\frac{\partial P}{\partial B} dB +\frac{\partial P}{\partial C} dC=0$$
correctly?
The mathematical criterium that demands that all partial derivatives have to vanish at extremal points lead me to an absurd statement as I tried to described above. That is I think that the condition $d P=0$ has in this case to be interpreted in another way as I did above. Can somebody explain what is the right interpretation of $d P=0$ plausibly compatible with physics and analysis. Where is the error in my reasonings above?
 A: At equilibrium, a thermodynamic potential is maximized or minimized with respect not to its natural variables but to whatever variables that are not externally constrained. An unconstrained variable could be: the extent to which chemical reaction has proceeded; the energy of subsystem 1 when the system is divided into two subsystems that can exchange heat with each other; etc.
Consider a thermodynamic relation concerning the Helmholtz free energy:
$$
dA = -SdT - PdV + \bigg(\frac{\partial A}{\partial X}\bigg)_{T, V} dX.
$$
Here, temperature ($T$) and volume ($V$) are natural variables of $A$, and X is some unconstrained variable. If we fix $T$ and $V$ (i.e., $dT = dV = 0$) and let the system reach equilibrium, the system will adjust itself such that $A$ is minimized with respect to $X$, making $(\partial A / \partial X)_{T, V} = 0$, i.e., $dA = 0$ for an arbitrary $dX$.
Note that if we lift the constraint $dV = 0$ as well when minimizing $A$, we will have $P = 0$, and OP found this strange. But this result isn't strange at all! Intuitively, a system with no constraint on its volume will expand forever to become infinitely large, in which case $P = 0$.
