I wanted to ask a question about implicit differentiation in partial differentiation.
When I was at school, I remember partial differentiation as something like this:
When you have a function composed of $x$ and $y$'s and you run into a $y$ term, differentiate with respect to $y$ and multiply by $\frac{dy}{dx}$ i.e. $$\frac{d}{dx} = \frac{d}{dy} \times \frac{dy}{dx}$$
Now, I read a problem on the Physics section yesterday afternoon that is relevant to my Chemistry course and I couldn't work it out.
If I have the equation
\begin{aligned} \frac{F\left(N_{A}, N_{B}\right)}{k T}=& N_{A} \ln \left(\frac{N_{A}}{N}\right)+N_{B} \ln \left(\frac{N_{B}}{N}\right) \\ &+\left(\frac{z w_{A A}}{2 k T}\right) N_{A}+\left(\frac{z w_{B B}}{2 k T}\right) N_{B}+\chi_{A B} \frac{N_{A} N_{B}}{N} \end{aligned}
I can get a quantity called the Chemical potential $\mu_{A}$ by differentiating the above equation with respect to $N_A$ while keeping $N_B$ and $T$ constant.
$$\mu_{A}=\left(\frac{\partial F} {\partial N_{A}}\right)_{T, N_{B}}$$
(The above equation is called the Free Energy Equation)
$N$ is the total number of molecules in the system, $N_A$ and $N_B$ are the number of molecules of A and B respectively. $N$ is not constant. They are related quite simply as via the sum:
$$N = N_A + N_B$$
which makes sense.
This equation also shows us that a small change in $N_A$ will also yield a small change in $N$ hence why $N$ is not constant, as mentioned above.
So I wanted to get from this equation, $\mu_{A}$
$$\frac{\mu_{A}}{k T}=\left[\frac{\partial}{\partial N_{A}}\left(\frac{F}{k T}\right)\right]_{T, N_{B}}$$
which makes sense.
The result given from the book (page 7), however, confused me. They gave the result as
$$=\ln \left(\frac{N_{A}}{N}\right)+1-\frac{N_{A}}{N}-\frac{N_{B}}{N}+\frac{z w_{A A}}{2 k T}+\chi_{A B} \frac{\left(N_{A}+N_{B}\right) N_{B}-N_{A} N_{B}}{\left(N_{A}+N_{B}\right)^{2}}$$
and only the last two terms made sense.
The OP asked where the terms
$$-\frac{N_{A}}{N}-\frac{N_{B}}{N}$$
came from and the answer given was as follows:
You missed the $N$ in the logarithm. Since $N_{B}$ is kept constant while changing $N_{A}$, the total number of particles $N=N_{A}+N_{B}$ changes as well. The missing term is $$\dfrac{\partial N}{\partial N_{A}}\dfrac{\partial}{\partial N}\left[N_{A}\ln\left(\dfrac{N_{A}}{N}\right)+N_{B}\ln\left(\dfrac{N_{B}}{N}\right)\right]=-\dfrac{N_{A}}{N}-\dfrac{N_{B}}{N}$$
and in the comments the value of $\dfrac{\partial N}{\partial N_{A}}$ was clarified to be $1$, again using the equation $N = N_A + N_B$. I understood this step.
but I then thought, if that was the case, how did the terms $$\ln \left(\frac{N_{A}}{N}\right)+1$$ arise then?
My original thought, similar to the OP was to differentiate:
$$\dfrac{\partial}{\partial N_{A}}\left[N_{A}\ln\left(\dfrac{N_{A}}{N}\right)+N_{B}\ln\left(\dfrac{N_{B}}{N}\right)\right]$$
but as explained, this assumed $N$ was constant, which it is not.
How are the terms $$\ln \left(\frac{N_{A}}{N}\right)+1$$
yielded by this application of implicit differentiation, if $\dfrac{\partial N}{\partial N_{A}} = 1$ using $\dfrac{\partial N}{\partial N_{A}}\dfrac{\partial}{\partial N}$?