Here's a long-winded description of the difference between exact differentials and inexact differentials:
A generalized differential can be written in the form:
[itex]\sum_j Q_j dx_j[/itex]
where the [itex]x_j[/itex] are independent state variables, and [itex]Q_j = Q_j(x_1, x_2, ...)[/itex] are functions of those state variables. In contrast, an exact differential is the special case where there is a single state function [itex]F(x_1, x_2, ...)[/itex] and
[itex]Q_j = \dfrac{\partial F}{\partial x_j}[/itex]
In that special case, [itex]\sum_j Q_j dx_j = dF[/itex], an exact differential.
How do you know whether there is such an [itex]F[/itex]? Well, you can figure it out by using a special property of partial derivatives, which is that the order of differentiation doesn't matter:
[itex]\dfrac{\partial}{\partial x} \dfrac{\partial}{\partial y} F = \dfrac{\partial}{\partial y} \dfrac{\partial}{\partial x} F[/itex]
In terms of the [itex]Q_j[/itex], this means that:
[itex]\dfrac{\partial Q_j}{\partial x_k} = \dfrac{\partial Q_k}{\partial x_j}[/itex]
Now, relating all this back to the question about work:
[itex]dW = -P dV[/itex]
A complete set of independent state variables for a monoatomic gas is volume, temperature and number of particles: [itex]V, T, N[/itex]. So to make an exact differential out of [itex]-P dV[/itex], you would have to add other terms, to get something like:
[itex]d ? = -P dV + Q_1 dT + Q_2 dN[/itex]
where the mixed derivatives work out:
- [itex]\dfrac{\partial Q_1}{\partial V} = - \dfrac{\partial P}{\partial T}[/itex]
- [itex]\dfrac{\partial Q_2}{\partial V} = -\dfrac{\partial P}{\partial N}[/itex]
- [itex]\dfrac{\partial Q_1}{\partial N} = \dfrac{\partial Q_2}{\partial T}[/itex]
One set of choices that work out are:
[itex]Q_1 = S[/itex] (entropy)
[itex]Q_2 = \mu[/itex] (chemical potential)
With these choices, our inexact differential [itex]dW[/itex] is turned into the exact differential, [itex]dU = =Pdv + S dT + \mu dN[/itex]