Why is the change in energy between products and reactants equal to the heat of reaction?

Suppose we have an infinitesimal process in which reactants are converted to products. Let the variables $$N_i$$ represent the particle numbers of each of these molecule types, and the energy and volume of the system are given by $$E$$ and $$V$$ respectively. Then the entropy of the system is given by $$S=S(E,V,N_1,...,N_m)$$ and the change in entropy in a quasistatic process is given by a first-order expansion which gives, on using standard definitions for the various partial derivatives $$dS=\frac{1}{T}dE+\frac{p}{T}dV-\sum\frac{\mu_i}{T}dN_i$$ However we also have $$TdS=dQ$$, so $$dQ=dE+pdV-\sum\mu_idN_i$$ But $$\sum\mu_idN_i \neq0$$ in general as far as I can tell, so how is the statement given in the title of my question (which is also on page 325 of the textbook by Reif) true (i.e. $$dQ \neq dE$$)? Indeed, it seems this is only true at equilibrium, where $$\sum\mu_idN_i =0$$.

Edit: I should mention that, intuitively, I expect the statement in my title to be true. In particular, since the system is at constant volume and since the chemical reaction is internal to the system (closed system), the only way that the surroundings can interact with the system is via thermal interaction. A possible analogy is a composite system of two containers of gas at different pressure, with a piston between them held fixed initially. Once the piston is released, the pressures will equilibrate; certainly, the composite system now has a higher entropy, entropy which was generated (if we calculate via some imagined quasistatic process) by heat transfer. What is relevant in this analogy to the case I give is the fact that the volumes $$V_1$$ and $$V_2$$ of the two containers do not appear in the composite system expression $$TdS=dQ$$. The mapping between the analogy and my question would be $$V_i \to N_i$$ because they are ostensibly both "internal" to the overall, composite system. They describe states of internal subsystems if you will.

A further edit: It seems to me that this may have something to do with chemical reactions being nonquasistatic (except in the particular case of us being right at chemical equilibrium), and $$dQ=TdS$$ therefore not holding (i.e. it's an internal process akin to nonquasistatic volume expansion of gas, so there is an extra, nonquasistatic component of entropy generation). Not sure how this helps me or if it's true at all, but it's something that came to mind.

• For your information. What classical thermodynamics calls heat of reaction (heat of formation) we now know is associated with a change in the rest mass of products compared to reactants through $E = mc^2$. For exothermic reaction rest mass decreases and kinetic energy is released. True for both chemical and nuclear reactions, but change in rest mass very much greater for nuclear. Jun 6, 2022 at 21:54
• @JohnDarby While what you say applies to chemical reactions as well, it is an impractical view due to the smallness of the reaction energies compared to the rest mass. Thus, the energy of chemical reactions is better understood as the difference in the binding energies of chemical bonds in the reactants and products. Jun 9, 2022 at 7:23
• @Roger Vadim Yes, good point. I wanted to point out that $E = mc^2$ is not just 'nuclear' as some think. Jun 9, 2022 at 22:03

At every point in the quasistatic chemical reaction the system is in equilibrium with its environment, that is the Gibbs free energy takes minimum value, i.e., $$dG = \sum_i\mu_idN_i=0$$ see Chemical equilibrium and Chemical potential (Thermodynamic definition).

On the other hand, standard enthalpy of reaction (i.e., the reaction heat at constant pressure) is defined as $$Q_P=\Delta H = \Delta(E+PV).$$

Indeed, if the reaction were not quasistatic, the reaction heat defined above would not be heat in usual thermodynamic sense, as defined by $$dQ=TdS$$.

• Thank you for your answer. I should be clear that I am not talking about a reaction occurring at equilibrium (yet) and the reaction is occurring at constant volume.
– EE18
Jun 9, 2022 at 11:12
• @EE18 It is not an equilibrium in the sense that there is a reaction going on, but you specify that it is an ininitesimal process / quasistatic process, i.e. at every point in time the reagents can be considered in thermal equilibrium with the environment - hence $dG=0$. Your equations are written for a reaction at constant pressure ($PdV$ rather than $VdP$). Jun 9, 2022 at 12:20
• I'm not sure why $pdV$ wouldn't be acceptable -- I'm simply enforcing $dV=0$. As for your comment that $dG = 0$ (I suppose it would be $dF = 0$ since I refer to constant volume, but this is largely irrelevant), I don't agree. In fact, the reaction proceeds (suppose for instance that I am at an initial state with all reactants and no products) precisely because $dG<0$.
– EE18
Jun 9, 2022 at 13:29
• @EE18 Probably you are right about $pdV$. In what sense do you call the reaction infinitesimal/quasistatic process? In my opinion it means that the reagents and products are in equilibrium with the environment/bath at every moment of time. It is to this equilibrium that the thermodynamic identities apply in the OP, and it is for this equilibrium that produces $dG=0$. Overall we are not in equilibrium situation - the entropy is growing and will continue to grow while the forward and reverse reaction rates do not equilibrate - we cannot use thermodynamic identities for chemical equilibrium. Jun 9, 2022 at 13:47
• I use quasistatic in the sense defined by Reif in Chapter 2: the process is occurring slow enough relative to the relevant system relaxation times that we may consider the system's ensemble to have a well-defined probability distribution. This does not mean that the system is in equilibrium (for example, a gas at high pressure may expand quasistatically against some lower, atmospheric pressure. If the process is slow enough then the gas is in some internal equilibrium at all points in time, so its probability distribution is thus well-defined at all times).
– EE18
Jun 9, 2022 at 14:06