# Basic thermodynamics question about work

I am getting into thermodynamics, and I have a basic fundamental question about the definition of the change in internal energy $$\mathrm{d}U$$:

$$\mathrm{d}U = T\,\mathrm{d}S - P\,\mathrm{d}V + \sum\mu_i\,\mathrm{d}n_i$$

Firstly, I do not understand why it's not the case that $$\mathrm{d}W$$ is defined as $$P\,\mathrm{d}V + V\,\mathrm{d}P$$, but only as $$P\,\mathrm{d}V$$. I can imagine a situation where the volume is fixed, but number of particles increases, thus increasing the pressure. I would think that this increase in pressure would also increase the internal energy.

Secondly, in the same manner I also don't understand why $$\mathrm{d}Q$$ is defined as $$T\,\mathrm{d}S$$ and not as $$T\,\mathrm{d}S + S\,\mathrm{d}T$$. I would think that a change in temperature would surely change the internal energy.

• p.V is not W, so it's differential p.dV + V.dp is not dW. At constant V, no mechanical work is done. Similarly, T.S is not Q, so TdS + SdT is not dQ. dS is defined as dQ/T. Dec 9, 2019 at 6:41
• @Poutnik dS is not $\frac{\text{đq}}{T}$, it is $\frac{\text{đq}_{rev}}{T}$ Jacob: work is force x distance which, for pV work, gives $đw = - p_{ext}dV$. If you choose a reversible path, then $p_{ext} = p_{sys} = p$ => $đw_{rev} = - pdV$ Dec 9, 2019 at 7:16
• @theorist Sure. But it is implied in the above formulas as well as in my note. I have just kept symbols. Dec 9, 2019 at 7:29
• @Poutnik I'm all for shorthand, when it's appropriate. But the distinction between $q$ and $q_{rev}$ is central to thermodynamics, and not understanding that distinction is a key source of confusion for new students. Thus while you may understand that distinction, using $q$ for $q_{rev}$ when connecting entropy to heat flow is not only a big mistake, it also spreads confusion. Dec 9, 2019 at 15:03
• @theorist I agree, OTOH it would then require explanation of q Vs q_rev difference , what does not fit the comment scope. Dec 9, 2019 at 15:06

Well, the answer is tricky. But before the really tricky part, you may want to take a step back and consider a general statement of the 1st law,

$$dU = \sum_i \left(\frac{\partial U}{\partial q_i} \right)_j dq_i$$

where $$q_i$$ is an extensive coordinate of the system. Note this is consistent with our standard description of the relation between generalized forces and energy (the derivatives wrt coordinates are forces).

In the case of pV work, $$q_i = V$$ and

$$\left(\frac{\partial U}{\partial V} \right)_j = -p$$

The partial derivative in question is evaluated holding all other extensive variables (including number of particles) constant. If there is a change in chemical composition of the system we can define a chemical force (although referred to as the chemical potential of substance i) as

$$\left(\frac{\partial U}{\partial n_i} \right)_j = \mu_i$$

and an infinitesimally small amount of chemical work as

$$\left(\frac{\partial U}{\partial n_i} \right)_j dn_i = \mu_i dn_i$$

As noted in the comments, the formulation combining the first and second laws of thermodynamics presented in the OP is a particular representation of the first law for the case of reversible pV work, a more general formulation of the 1st law being

\begin{align} dU &= dq + dw\end{align}

Note that while $$dU$$ is exact, the differentials on the right-hand-side of the previous equation may be inexact. Distinguishing between pV and other types of work for a reversible process (for which the differentials $$dw$$ and $$dq$$ become exact) we can write

\begin{align} dU &= dq_{rev} + dw_{pV,rev} + dw_{nonpV,rev} \\ &= dq_{rev} + dw_{pV,rev} + \sum_i \mu_i dn_i \\ &= TdS + dw_{pV,rev} + \sum_i \mu_i dn_i \end{align}

The second equality follows from the first using the 2nd law. Then since $$dw=-p_{ext}dV$$ in the case of pV work and since $$p_{ext} = p_{sys}=p$$ when the work is carried out reversibly, you arrive at the expression in the OP.

I can imagine a situation where the volume is fixed, but number of particles increases, thus increasing the pressure. I would think that this increase in pressure would also increase the internal energy.

You have to be careful how you define the process that alters the number of particles. Do you have an open system that allows the particles in from the surroundings?

Assume you transfer an ideal gas at constant T from the surroundings into the system, which consists of a vessel at lower pressure with a small orifice which we seal at some point. Since the gas is ideal there is no change in energy with pressure at constant T. There is no mechanical work done, since there is no volume change, but the change in the number of particles clearly amounts to a transfer of energy. This is accounted for in the term $$\sum_i \mu_i dn_i$$ of $$dU$$, provided the entropy is constant. Changing the number of particles amounts to "chemical" work.

Secondly, in the same manner I also don't understand why dQ is defined as TdS and not as TdS+SdT. I would think that a change in temperature would surely change the internal energy.

A change in temperature can change the internal energy, but that does not require a change in the definition of heat or entropy. The equation $$dQ=TdS$$ holds only for a reversible transfer of heat, it is not general.

Now to the tricky part.

You can write

$$dU = -pdV-Vdp +SdT + TdS + \sum_i \mu_i dn_i + \sum_i n_i d\mu_i$$

since

$$U = -PV + TS + \sum_i n_i \mu_i$$

The thing is you can show that

$$0 = -Vdp +SdT + \sum_i n_i d\mu_i$$

This is known as the Gibbs-Duhem relation.

• In general this is a good and thorough answer. However, the equation: $dU = dq + dw + \sum_i \mu_i dn_i$ is incorrect. It is valid only if the change of state is reversible (where $dw_{rev} = -PdV$ is PV work, and $dq_{rev} = TdW$). See, e.g., Denbigh 1981, p 81. Remember that work is defined as change in the surroundings. It can only be equated with system state functions for a reversible change. Calling $\sum_i \mu_i dn_i$ "chemical work" is misleading. Dec 10, 2019 at 2:12
• @ratsalad I need to give your comments further thought but I currently disagree. You can write $dU = dq+dw_{pV} + dw_{non-pV}$. The non-pV part includes chemical changes - changes in free energy that might be associated with chemical potential, and that can be used to do non-pV work. Whatever happens to the remainder is secondary provided the sum $dw + dq$ is conserved, since dU is exact. I might need to present this differently though. Dec 10, 2019 at 15:50
• Your new equation is indeed valid. The problem is the identification of $dw_{non-PV}$ with $\sum_i \mu_i dn_i$, which can only be made for a reversible process. It's similar to how $dq$ can only be identified as $TdS$ for a reversible path. In general, $TdS \geq dq$, and $dw_{rev} = -PdV + \sum_i \mu_i dn_i \leq dw$. In many practical cases $dq = \sum_i \mu_i dn_i$, like when you short-circuit the terminals of a car battery, $dw = 0$ and the energy in $\sum_i \mu_i dn_i$ is liberated completely as heat. Dec 10, 2019 at 16:30
• @ratsalad Thanks for your comment. I see that I convoluted a couple of steps trying to make a point about work associated with a chemical process, when I should be talking more generally about non-pV work. Hopefully it's a bit more clear. Dec 10, 2019 at 20:03
• @Andrew That convention is a subjective choice that is not generally followed in the thermodynamic literature. For instance, Atkins and Denbigh use $dx$ for inexact differentials. In fact the distinction is primarily a convenience, a hint to the reader, and is not mathematically necessary, since both inexact and exact differentials are, fundamentally, differential forms (i.e. infinitesimal changes). An exact differential is a special case that can be expressed as the differential of a function. Whether a given differential is exact or inexact has to be proven based on assumptions. Dec 11, 2019 at 13:47