I'm trying to review some statistical mechanics from the following link
In doing so on the topic of variational theory and maximization with Lagrange multipliers, the author states that given a function:
$$ h(x_i) = f(x_i) - \lambda g(x_i), $$
then to extremize we require the condition:
$$ \frac{\partial h}{\partial x_i} = 0. $$
Though this is phrased a little differently than I am used to, the conclusion is the same and so I am okay with it.
However, later on the author solves this example with the case of a Grand Canonical Ensemble (GCE). In my own understanding, the GCE is described by the number of particles, and the energy. I arrived at the same constrain equations as the author however, based on my understanding the the parameteres of the same are described by $(E,N)$, I would have expected that there should have been two equations set to equal zero:
$$ \frac{\partial}{\partial E_n} \left[S - \lambda_E \sum P(E,N) E - \lambda_N \sum P(E,N) N - \lambda_1 \sum P(E,N) \right] = 0, $$ and
$$ \frac{\partial}{\partial N_n} \left[S - \lambda_E \sum P(E,N) E - \lambda_N \sum P(E,N) N - \lambda_1 \sum P(E,N) \right] = 0. $$
I was able to find another text that arrives at the same solutions for the probability function, with different variable substitutions (in terms of $\mu$ and $\beta$) so I presume that this procedure is the correct one. I suspect my confusion is related to idea of: what is a function of what. Which has been a bane of my existence through all of my courses on thermodynamics and statistical mechanics.
Any explanation would be greatly appreciated! :)