text: The first law of thermodynamics states that:
  where  and  are infinitesimal amounts of heat supplied to the system by its surroundings and work done by the system on its surroundings, respectively.
  According to the second law of thermodynamics we have for a reversible process:
  Hence:
  By substituting this into the first law, we have:
  Letting  be reversible pressure-volume work done by the system on its surroundings,
  we have:
  This equation has been derived in the case of reversible changes. However, since U, S, and V are thermodynamic state functions that depends on only the initial and final states of a thermodynamic process, the above relation holds also for non-reversible changes. If the composition, i.e. the amounts  of the chemical components, in a system of uniform temperature and pressure can also change, e.g. due to a chemical reaction, the fundamental thermodynamic relation generalizes to:
  The  are the chemical potentials corresponding to particles of type .
  If the system has more external parameters than just the volume that can change, the fundamental thermodynamic relation generalizes to
  Here the  are the generalized forces corresponding to the external parameters . (The negative sign used with pressure is unusual and arises because pressure represents a compressive stress that tends to decrease volume. Other generalized forces tend to increase their conjugate displacements.)