# Deriving $Tds$ relations in thermodynamics

The Tds relations I refer to are, $$Tds = du + Pdv$$$$Tds = dh - vdP$$ The first equation is derived (assuming internally reversible process) from the definition of entropy $ds = \delta Q/T$ and the idea that heat supplied is used to do work and increase internal energy. Note that work here refers to work at constant $P$.
The second $Tds$ equation is obatained using the definition of enthalpy as $h = u + Pv$ => $dh = du + Pdv + vdP$ and substituing $du + Pdv$ with $Tds$ as per the first equation => $dh = Tds+vdP$. Note that unlike the first relation, $P$ is allowed to vary here (the term $vdP$ appears as a result).

How is this substitution correct where we assume $P$ to be constant as well as a variable within the same relation?

The above approach to deriving the Tds relations is from Thermodynamics: An Engineering Approach, Cengel and Boles, 8e.

The first relation $T~ds=du+P~dv$ is the statement of the first law of thermodynamics. It is to be taken as a given, as a starting point from which you derive all other equations (such as the second equation you have derived for $dh$). In other words, nothing is supposed constant in $T~ds=du+P~dv$; it is applicable to arbitrary infinitesimal process.
• Yes, I see now. What I missed was that in $T ds=du+P dv$, $P$ can still be a function of $v$ and not always a constant. – gan Oct 29 '17 at 6:14