# 9.2: Exact and Inexact Differentials

• • Contributed by Marcia Levitus

So far, we discussed how to calculate the total differential of a function. If you are given a function of more than one variable, you can calculate its total differential using the definition of a total differential of a function $$u$$: ($$du=\left(\frac{\partial u}{\partial x_1} \right)_{x_2...x_n} dx_1+\left( \frac{\partial u}{\partial x_2} \right)_{x_1, x_3...x_n} dx_2+...+\left( \frac{\partial u}{\partial x_n} \right)_{x_1...x_{n-1}} dx_n$$). You will have one term for each independent variable. What if we are given a differential (e.g.

$dz=(9x^2+6xy+y^2)dx+(3x^2+2xy)dy$

see Example 9.1) and we are asked to calculate the function whose total differential is $$dz$$? This is basically working Example 9.1 backwards: we know the differential, and we are looking for the function. Things are a little bit more complicated than this, because not all differentials are the total differentials of a function. For example, from the example above we know that

$dz=(9x^2+6xy+y^2)dx+(3x^2+2xy)dy$

is the total differential of

$z(x,y)=3x^3+3yx^2+xy^2.$

However, the differential $$dz = xydx + x^2 dy$$ is not the total differential of any function $$z(x,y)$$. You can write down every single function $$z(x,y)$$ in this planet, calculate their total differentials, and you will never see $$dz = xydx + x^2 dy$$ in your list.

Therefore, the question we are addressing is the following: given a differential, 1) is it the total differential of any function? 2) if it is, which function?

To illustrate the question, let’s say we are given the differential below (notice that I switched to $$P, V,$$ and $$T$$, which are variables you will encounter often in thermodynamics):

$\label{eq:diff6} dP=\frac{RT}{V-b}dT+\left[\frac{RT}{(V-b)^2}-\frac{a}{TV^2}\right]dV$

The question is whether this is the total differential of a function $$P=P(T,V)$$ (we are told that $$a$$ and $$b$$ are constants, and we already know that $$R$$ is a constant). By definition of total differential, if the function exists, its total differential will be:

$\label{eq:diff7} dP=\left (\frac{\partial P}{\partial T} \right )_{V} dT+\left (\frac{\partial P}{\partial V} \right )_{T} dV$

Comparing Equation \ref{eq:diff6} and \ref{eq:diff7}, if the function exists, its derivatives will have to be:

$\label{eq:diff8a} \left (\frac{\partial P}{\partial T} \right )_{V}=\frac{RT}{V-b}$

$\label{eq:diff8b} \left (\frac{\partial P}{\partial V} \right )_{T}=\left[\frac{RT}{(V-b)^2}-\frac{a}{TV^2}\right]$

If we find a function $$P=P(T,V)$$ that satisfies these equations at the same time, we know that Equation \ref{eq:diff6} will be its total differential.

From Equation \ref{eq:diff8a}, we can calculate $$P$$ by integrating with respect to $$T$$ at constant $$V$$:

$\label{eq:diff9} \int dP=\int \frac{RT}{V-b}dT\rightarrow P=\frac{R}{V-b}\frac{T^2}{2}+f(V)$

where we included an integration constant ($$f(V)$$) that can be any function of $$V$$ (we are integrating at constant $$V$$).

In order to get an expression for $$P(T,V)$$, we need to find out $$f(V)$$ so we can complete the right side of Equation \ref{eq:diff9}. To do that, we are going to take the derivative of $$P$$ (Equation \ref{eq:diff9} with respect to $$V$$, and compare with Equation \ref{eq:diff8b}:

$\label{eq:diff10} \left(\frac{\partial P}{\partial V}\right)_T=-\frac{RT^2}{2(V-b)^2}+\frac{df(V)}{dV}$

Looking at Equation \ref{eq:diff8b} and \ref{eq:diff10}, we see that the two expressions do not match, regardless of which function we chose for $$f(V)$$. This means that Equation \ref{eq:diff6} does not represent the total differential of any function $$P(V,T)$$. We call these differentials inexact differentials. If a differential is the total differential of a function, we will call the differential exact.

What we did so far is correct, but it is not the easiest way to test whether a differential is exact or inexact. There is, in fact, a very easy way to test for exactness. We’ll derive the procedure below, but in the future we can use it without deriving it each time.

Given the differential $$dz=f_1(x,y)dx+f_2(x,y)dy$$, the differential is exact if

$\label{eq:test} \left(\frac{\partial f_1(x,y)}{\partial y} \right )_x=\left(\frac{\partial f_2(x,y)}{\partial x} \right )_y$

If Equation \ref{eq:test} does not hold, the differential is inexact. For instance, if $$dz=(9x^2+6xy+y^2)dx+(3x^2+2xy)dy$$, the functions $$f_1$$ and $$f_2$$ are $$f_1=9x^2+6xy+y^2$$ and $$f_2=3x^2+2xy$$. To test this differential, we perform the partial derivatives

$\left(\frac{\partial f_1(x,y)}{\partial y} \right )_x =6x+2y$

and

$\left(\frac{\partial f_2(x,y)}{\partial x} \right )_y=6x+2y$

The two derivatives are the same, and therefore the differential is said to be exact.

Let’s prove why the test of Equation \ref{eq:test} works. Let’s consider a differential of the form $$dz=f_1(x,y)dx+f_2(x,y)dy$$. If the differential is exact, it is the total differential of a function $$z(x,y)$$, and therefore:

$\label{eq:diff11} dz=f_1(x,y)dx+f_2(x,y)dy=\left (\frac{\partial z}{\partial x} \right )_{y} dx+\left (\frac{\partial z}{\partial y} \right )_{x} dy$

We know that the mixed partial derivatives of a function are independent of the order they are computed:

$\left (\frac{\partial^2 z}{\partial y\partial x} \right )=\left (\frac{\partial^2 z}{\partial x\partial y} \right ) \nonumber$

From Equation \ref{eq:diff11},

$f_1(x,y)=\left (\frac{\partial z}{\partial x} \right )_{y} \rightarrow \left(\frac{\partial f_1(x,y)}{\partial y} \right )_x=\left (\frac{\partial^2 z}{\partial x\partial y} \right ) \nonumber$

$f_2(x,y)=\left (\frac{\partial z}{\partial y} \right )_{x} \rightarrow \left(\frac{\partial f_2(x,y)}{\partial x} \right )_y=\left (\frac{\partial^2 z}{\partial y\partial x} \right ) \nonumber$

Because the mixed partial derivatives are the same, for an exact differential:

$\left(\frac{\partial f_1(x,y)}{\partial y} \right )_x=\left(\frac{\partial f_2(x,y)}{\partial x} \right )_y$

This equation is true only for an exact differential because we derived it by assuming that the function $$z=z(x,y)$$ exists, so its mixed partial derivatives are the same. We can use this relationship to test whether a differential is exact or inexact. If the equality of Equation \ref{eq:test} holds, the differential is exact. If it does not hold, it is inexact.

Example $$\PageIndex{1}$$

Test whether the following differential is exact or inexact:

$dz=\frac{1}{x^2}dx-\frac{y}{x^3}dy \nonumber$

Solution

To test whether $$dz$$ is exact or inexact, we compare the following derivatives

$\left(\frac{\partial (1/x^2)}{\partial y} \right )_x\overset{?}{=}\left(\frac{\partial (y/x^3)}{\partial x} \right )_y \nonumber$

$\left(\frac{\partial (1/x^2)}{\partial y} \right )_x=0 \nonumber$

$\left(\frac{\partial (y/x^3)}{\partial x} \right )_y=-3yx^{-4} \nonumber$

We conclude that $$dz$$ is inexact, and therefore there is no function $$z(x,y)$$ whose total differential is $$dz$$.

Example $$\PageIndex{2}$$

Determine whether the following differential is exact or inexact. If it is exact, determine $$z=z(x,y)$$.

$dz=(2x+y)dx+(x+y)dy \nonumber$

Solution

To test whether $$dz$$ is exact or inexact, we compare the following derivatives

$\left(\frac{\partial (2x+y)}{\partial y} \right )_x\overset{?}{=}\left(\frac{\partial (x+y)}{\partial x} \right )_y \nonumber$

If this equality holds, the differential is exact.

$\left(\frac{\partial (2x+y)}{\partial y} \right )_x=1 \nonumber$

$\left(\frac{\partial (x+y)}{\partial x} \right )_y=1 \nonumber$

Therefore, the differential is exact. Because it is exact, it is the total differential of a function $$z(x,y)$$. The total differential of $$z(x,y)$$ is, by definition,

$dz=\left (\frac{\partial z}{\partial x} \right )_{y} dx+\left (\frac{\partial z}{\partial y} \right )_{x} dy \nonumber$

Comparing this expression to the differential $$dz=(2x+y)dx+(x+y)dy$$:

$\left (\frac{\partial z}{\partial x} \right )_{y}=(2x+y)$

$\label{eq:examplea} \left (\frac{\partial z}{\partial y} \right )_{x}=(x+y)$

To find $$z(x,y)$$, we can integrate the first expression partially with respect to $$x$$ keeping $$y$$ constant:

$\int dz=z=\int (2x+y)dx=x^2+xy+f(y) \nonumber$

So far we have $\label{eq:exampleb} z = x^2+xy+f(y)$

so we need to find the function $$f(y)$$ to complete the expression above and finish the problem. To do that, we’ll take the derivative of $$z$$ with respect to $$y$$, and compare with Equation \ref{eq:examplea}. The derivative of Equation \ref{eq:exampleb} is:

$\left (\frac{\partial z}{\partial y} \right )_{x}=x+\frac{df(y)}{dy} \nonumber$

comparing with Equation \ref{eq:examplea} we notice that $$\frac{df(y)}{dy}=y$$, and integrating, we obtain $$f(x)=y^2/2+c$$

Therefore, $$dz=(2x+y)dx+(x+y)dy$$ is the total differential of $$z=x^2+xy+y^2/2+c$$.

We can check our result by working the problem in the opposite direction. If we are given $$z=x^2+xy+y^2/2+c$$ and we are asked to calculate its total differential, we would apply the definition:

$dz=\left (\frac{\partial z}{\partial x} \right )_{y} dx+\left (\frac{\partial z}{\partial y} \right )_{x} dy \nonumber$

and because

$\left (\frac{\partial z}{\partial x} \right )_{y} =y+2x \nonumber$

and

$+\left (\frac{\partial z}{\partial y} \right )_{x}=y+x \nonumber$

we would write $$dz=(2x+y)dx+(x+y)dy$$, which is the differential we were given in the problem.

Check two extra solved examples in this video: http://tinyurl.com/kq4qecu