Definition of chemical potential of an ideal gas contradicts equation of state? My geometric intuition breaks down horribly regarding advanced concepts in thermodynamics, such as the use of thermodynamic potentials. My question here is therefore about the latter concepts (in particular, re: defining the chemical potential for an ideal gas)
$$$$
What I understand
What allows me to understand the first part of a standard thermodynamics syllabus is the understanding that (quasi-static/reversible) thermodynamics takes place on a manifold $\mathcal M$ of equilibrium states. For the ideal gas, this manifold has global coordinates $(S,P):\mathcal M\hookrightarrow \mathbb{R}^2$, and the energy function has de Rham differential
$$dE = TdS-PdV,$$
Quasistatic dynamics on this manifold of equilibrium states reduces to specifying 1-dimensional curves $\gamma:I\hookrightarrow\mathcal M$ on this manifold, which, in my thermodynamics course, is usually specified equivalently as a set of $\dim \mathcal M-1$ constraints. 
In case of the ideal gas, $\dim \mathcal M-1=1$, and so it suffices to specify the level set of an auxiliary function $g\in C^\infty(\mathcal M)$, and then $\gamma$ is completely specified, up to irrelevant reparametrizations. For example, the specific heat is defined via
$$\frac{\partial U}{\partial T}\bigg|_g:=\frac{(U\circ \gamma)'(0)}{(T\circ \gamma)'(0)}$$
where $\gamma$ is defined by the constraint of mapping into a level set of $g$.
$$$$
What I don't understand
What I don't understand is the setting in which we wish to define dynamics that involves changes of particle number $N$, leading to the definition of the chemical potential. In this setting, the picture I defined earlier for the ideal gas falls apart catastrophically. 
In this setting, my course instructor writes down that the energy function then has de Rham differential
$$dE = TdS-PdV+\mu dN.\tag{1}$$
In addition, all thermodynamic partial derivatives now have two functions, $g_1,g_2\in C^\infty(\mathcal M)$, specified as constant (Kardar's MIT notes also do this : link). 
All of this evidence points to the manifold of equilibrium states being implicitly extended to include a particle-number direction, i.e. defining a 3-fold $\widetilde{\mathcal M}$ with global coordinates $(S,P,N):\widetilde{\mathcal M}\hookrightarrow \mathbb{R}^3$. This would then lead to the extended de Rham differential (1) that my instructor wrote down, and would also explain why all partial derivatives now have two functions specified as constant, as 
$$\dim\widetilde{\mathcal M} -1 =3-1 =2.$$
Of course, now I have derived enough consequences for a dead-end, because now I will apply the equation of state for the ideal gas, which states that $N$ cannot be independent of $P,V$, because $T$ is completely determined by $P,V$ (as it usually is in e.g. a discussion of Carnot engines):
$$PV = NkT$$
and thus we cannot extend $\mathcal M\to \widetilde{\mathcal M}$ the manifold of states in this manner. In particular, Kardar's partial derivatives have too many constraints, as $\widetilde{\mathcal M}$ collapses to a 2-fold, and any path $\gamma:I\hookrightarrow \widetilde{\mathcal M}$ which keeps two independent functions $g_1,g_2$ constant must be a trivial path, i.e. a point.
For example, we can write
$$E=\frac{3}{2}NkT,$$
and so $\mu = \frac{3}{2}kT$, which contradicts the standard result on Wikipedia.
 A: The catch is in the very last passage of your question: if you're using $(S,V,N)$ as coordinates, then $T$ is a dependent variable: $T(S,V,N)$, so the partial derivative of the internal energy with respect to mole number requires an additional term:
$$\mathrm{d}E = \frac{1}{2}k\left[N\frac{\partial T}{\partial S} \,\mathrm{d}S +
N\frac{\partial T}{\partial V} \,\mathrm{d}V + \left(T+N\frac{\partial T}{\partial N}\right)\,\mathrm{d}N \right].$$
I personally like the way of thinking you had behind your question. I think you would enjoy reading these very insightful texts:


*

*A. S. Wightman: Convexity and the notion of equilibrium state in thermodynamics and statistical mechanics, pp. ix–lxxxv in R. B. Israel: Convexity in the Theory of Lattice Gases (Princeton 1979).

*M. Pekař, I. Samohýl: The Thermodynamics of Linear Fluids and Fluid Mixtures (Springer 2014), especially ch. 2.

*C. A. Truesdell (editor): Rational Thermodynamics (Springer 1984), especially the Historical Introit and ch. 1.

*G. Astarita: Thermodynamics: An Advanced Textbook for Chemical Engineers (Springer 1990), especially chs 1, 2.
Also may interest you:


*

*D. R. Owen: A First Course in the Mathematical Foundations of Thermodynamics (Springer 1984).


Gibbs's text is also very insightful (although convoluted at times) and always worth reading:


*

*J. W. Gibbs: On the equilibrium of heterogeneous substances, Trans. Connecticut Acad. III (1875–1878), pp. 108–248, 343–524, 530 https://archive.org/details/transactionsconn03conn.

