# Partial Differentiation

Reading assignment: Appendix A

There is a connection between regular functions and derivatives.

This material is indebted to Chapter 3 of Carl Helrich's, Modern Thermodynamics...

### Landscapes

Cezanne painted the Montagne Sainte Victoire in southern France obsessively.

A well-behaved landscape is one in which the altitude is uniquely determined by the latitude and longitude.

A function $h(x,y)$ is regular if it is analytic (smoothly changing) and single-valued.

latitude and longitude are coordinates, that is, they have exact differentials.

We have seen that $h$ is a regular function if you can draw a contour map of the surface.

#### Another criterium for a well behaved landscape...

Since the height only depends on the latitude and longitude, If we leave a point, and later come back to it by some (actually any) other route, we should be back at the same height that we started.

The temperature $T$ of an ideal gas in a cylinder is a regular function of $P$ and $V$, and can be figured by solving the ideal gas law, $$T=\frac{PV}{nR}.$$ If we mess with the piston, and the temperature of the heat bath, we can move the state of our ideal gas to different positions on a $P-V$ diagram. But if we manage to return to the original pressure and temperature, we find that we once again have the same temperature as when we started out.

...an imaginary landscape that is not well-behaved.

It's not necessary to stay in the imaginary world to find features which are not 'well behaved'.

### A test for exact/inexact differentials

Our "back at the same place, back at the same height" criteria for some quantity $h$ can be expressed as $$\oint_{\cal P} dh = 0$$ for all possible paths ${\cal P}$.

Let's show that the differential of work is, I claim, inexact... $$\delta W = P\,dV$$ by coming up with some path, any path where $\oint \delta w \neq 0$. Consider this path

$$\oint \delta W = \oint P\,dV =0 + \int_{V_1}^{V_2} P_2\,dV+0+\int_{V_2}^{V_1} P_1\,dV = (P_2-P_1)(V_2-V_1).$$ This is clearly not vanishing.

In general I'll use that $\delta$ symbol to indicate inexact differentials.

What about temperature? For an ideal gas... $$T=\frac{1}{nR}(PV)$$ We'll discuss, how to find $dT$ from this.

HW for Friday: Show that $\oint dT=0$ for the path shown above.

[Do examples of contour integration.]

### Is there a *local* test for regular functions?

So far, our tests to see whether $h(x,y)$ is a regular function of $x$ and $y$:

• Can we draw a contour map of $h(x,y)$?
• Is $\oint_{\cal P} \delta h = 0$ for all paths ${\cal P}$?

...both involve global knowledge about $h(x,y)$.

Is there any local characteristic of $h$ that might betray whether it is a regular function or not?

(And if it *is* a regular function it also has an exact differential.)

## Partial derivatives - slopes

Consider a surface in 3 dimensions where the $z-$coordinate of this surface is given by a function of $x$ and $y$: $$z(x,y)\equiv f(x,y)$$

What does it mean to take the derivative of such a function?

We could hold $y$ constant and do something in the spirit of the definition of a derivative for functions of one variable: $$f_x = \lim_{h \rightarrow 0 }\frac{f(x+h,y)-f(x,y)}{h}.$$

...or hold $x$ constant: $$f_y = \lim_{h \rightarrow 0 }\frac{f(x,y+h)-f(x,y)}{h}.$$

These are the definitions of the partial derivatives: $$f_x \equiv \frac{\partial f}{\partial x}, \ \ f_y\equiv \frac{\partial f}{\partial y}.$$

Graphically, these are the slopes of lines which are

• Tangent to a surface,
• have a constant $y$-value ($f_x$) or a constant $x$-value ($f_y$).

See these visualizations (require java) of partial derivatives and directional derivatives.

$f_x$ is a function of $x$ and $y$, $f_x(x,y)$, as is $f_y$. Sometimes I'll write: $$$\frac{\partial f}{\partial x}$_y$$ where the subscript $y$ explicitly means "$y$ is being held constant".

When $f=f(s,t,u,v,w,....)$ is a function of more than two variables, then the partial derivative $\frac{\del f}{\del t}$ means "hold all of the variables constant except $t$".

#### Example

1. Plot the function $f(x,y) = 4-x^2-2y^2$,
2. Find general expressions for $\frac{\del f}{\del x}$ and $\frac{\del f}{\del y}$
3. Evaluate the the partial derivatives at $(x,y)=(1,1)$

With $f(x,y) = 4-x^2-2y^2$, then, $$f_x(x,y) = -2x,\ \ f_y(x,y)=-4y,$$

Evaluating at (1,1): $$f_x(1,1) = -2,\ \ f_y(1,1)=-4.$$

Graphically:

What is the graphical meaning of the double partial differential $$\frac{\del^2f}{\del x^2}\equiv \frac{\del}{\del x}\left(\frac{\del f}{\del x}\right)?$$

What is the graphical meaning of $$\frac{\del}{\del x}\left(\frac{\del f}{\del y}\right)?$$ or.. $$\frac{\del}{\del y}\left(\frac{\del f}{\del x}\right)?$$

Bring a sheet of paper along. Illustrate "twist" in $x$-direction with twist of paper.

### The Pfaffian

Let $f(x,y)$ be the height of a surface. On a topo map, the $x$-coordinate is the distance east from the lower-left corner of the map and the $y$-coordinate is the distance north from that corner. Then

• $$\frac{\partial f}{\partial x}$_y$ is the slope as you look east, and
• $$\frac{\partial f}{\partial y}$_x$ is the slope as you look north.

How does your height ($f(x,y)$) change ($\Delta f$) if you take a step $\Delta x$ towards the east? Or a step $\Delta y$ north?

• $[\Delta f]_x$ as you move east is approximately $$\frac{\partial f}{\partial x}$_y\ [\Delta x]_y$, and
• $[\Delta f]_y$ as you move north is approximately $$\frac{\partial f}{\partial y}$_x\ [\Delta y]_x$.

Of course, most of the time you are not moving exactly east or north. So, take apart some general change in position into components in the east and north directions. This sum might be a good approximation to your change in height: $$\Delta f \approx \frac{\partial f}{\partial x}\,\Delta x + \frac{\partial f}{\partial y}\, \Delta y.$$

If $f$ is a regular function, then we should get the same change in height from $O$ to $P$ whether we take the path $i,ii$ or $I,II$, or another way of putting that is...$$\oint \Delta f \approx \Delta f_i+\Delta f_{ii}-\Delta f_{II}-\Delta f_I=0$$

But the slopes $f_y$ on paths $I$ and $ii$ are not exactly the same. Let's say that what we mean by 'the' slope "$\del f/\del y$" is actually the slope at $O$:
$$\left.\frac{\del f}{\del y}\right|_O$$

So, we need a first-order approximation for the slope $f_y$ if we move over $\Delta x$ to the right in terms of the slope at $O$...

### Local test for a regular function

In the figure, if $\oint \Delta f(x,y)=0$, then the integral over the two paths from $O$ to $P$ should be identical, that is $\int_{i+ii}\Delta f = \int_{I+II}\Delta f$. Now we make a second order approximation for $\Delta f$:

We need to fill in the following table...

slope$\Delta f$
i $\frac{\del f}{\del x}$ $\Delta x \frac{\del f}{\del x}$
ii $\frac{\del f}{\del y}+\Delta x\frac{\del }{\del x}\frac{\del f}{\del y}$ $\Delta y\left(\frac{\del f}{\del y}+\Delta x\frac{\del }{\del x}\frac{\del f}{\del y}\right)$
i+ii $\Delta x\frac{\del f}{\del x} +\Delta y\frac{\del f}{\del y}+ \Delta x\Delta y\frac{\del }{\del x}\frac{\del f}{\del y}$

I $\frac{\del f}{\del y}$ $\Delta y \frac{\del f}{\del y}$
II $\frac{\del f}{\del x}+\Delta y\frac{\del }{\del y}\frac{\del f}{\del x}$ $\Delta x\left(\frac{\del f}{\del x}+\Delta y\frac{\del }{\del y}\frac{\del f}{\del x}\right)$
I+II $\Delta x\frac{\del f}{\del x}+ \Delta y\frac{\del f}{\del y}+ \Delta x\Delta y\frac{\del }{\del y}\frac{\del f}{\del x}$

...we should find that the condition for the integral around the closed loop to vanish is that $$\frac{\partial}{\partial y}\frac{\partial f}{\partial x} = \frac{\partial}{\partial x}\frac{\partial f}{\partial y}$$ ...that the surface twist in the $x$-direction is exactly equal to the surface twist in the $y$-direction. This is our local test to see if a differential is exact or inexact.

By the way, for a regular function of two independent variables, the order of partial differentiation doesn't matter. (So say the mathematicians). So for regular functions, and quantities that have exact differentials, we can write without worrying about the order... $$\frac{\partial^2 f}{\partial x\partial y}.$$

So, for well-behaved landscapes, We'll return to our first-order approximation for the change in height, (which is exact in the limit of small differentials) and write this with a 'd' to indicate that it's an exact differential $$df = \frac{\partial f}{\partial x}\, dx + \frac{\partial f}{\partial y}\, dy.$$

This is called the Pfaffian of $f$. We can integrate it to find *the* value of $f$ at some other point in the landscape. $$f(x,y) = f(x_0,y_0) + \int_{f(x_0,y_0)}^{f(x,y)} df$$ along any path we choose.

### Integrating factors

So, if someone on the street tries to sell you on an exact differential... $$dz=y\,dx-x\,dy.$$

Test it to see if it obeys the local test for a regular function...(the 'curl' test): $$\begineq \frac{\partial}{\partial x}\frac{\partial z}{\partial y} &=& \frac{\partial}{\partial y}\frac{\partial z}{\partial x}\\ \frac{\partial}{\partial x} (-x) &=& \frac{\partial}{\partial y} y\\ -1 &=& 1.\endeq$$

Oops! So, this is not an exact differential, and we should really write: $$\delta z = y\,dx-x\,dy.$$

But if you try the same kind of test on: $$dw=\frac{\delta z}{y^2}=\frac{ydx-xdy}{y^2}=d$\frac{x}{y}$,$$

it passes. $dw$ is an exact differential.

So $1/y^2$ is called an integrating factor. There are many more integrating factors.

### More results

Read Carter's Appendix A for the following:

• A recipe for coming up with integrating factors;

• The reciprocal relation: $$$\frac{\partial x}{\partial z}$_y = \frac{1}{$\frac{\partial z}{\partial x}$_y};$$

• The cyclical relation: $$$\frac{\partial x}{\partial y}$_z$\frac{\partial y}{\partial z}$_x$\frac{\partial z}{\partial x}$_y=-1.$$

## Relationship with Potential Theory

In Electrodynamics and Mechanics we found that these characteristics of a conservative force $\myv{F}(\myv{r})$ each imply the others:

$$\myv{F} = - \myv{\nabla} U \iff \myv{\nabla} \times \myv{F}=0 \iff \oint_{\mathcal{P}} \myv{F}\cdot d\myv{r}=0.$$

• The potential energy $U(x,y)$ plays the role of height $f(x,y)$ in our landscape picture.
• The partial derivatives of the potential energy $U$ are proportional to the components of a force:$$F_x = -\frac{\partial V}{\partial x}$$
• The curl of the force has to vanish in order for it to be possible to define a potential energy function: This turns out to be identical to our condition that the order of partial derivatives of $f$ shouldn't matter.
• Exact differential corresponds to something like 'a conservative force'

#### $\myv{F} = - \myv{\nabla} V$

Force is the gradient of a potential. The $x-$ and $y-$components are:

$$F_x = -\frac{\partial V}{\partial x}; F_y = -\frac{\partial V}{\partial y}$$

#### $\myv{\nabla} \times \myv{F}=0$

A condition for a force to be conservative (that is, something you can derive from a potential) is that the curl of the force has to vanish. In this case, the 'force' only has two components, and so the curl can be considered to be a scalar since it only ever points in the same $\uv{z}$ direction:

\begin{aligned}\myv{\nabla} \times \myv{F}=\begin{vmatrix} \uv{x} & \uv{y} & \uv{z}\\ \frac{\partial}{\partial x} & \frac{\partial}{\partial y} & 0\\ F_x & F_y & 0 \end{vmatrix} =\uv{z}$\frac{\partial F_y}{\partial x}-\frac{\partial F_x}{\partial y}$ = \\ = \uv{z}$\frac{\partial}{\partial x}\frac{\partial V}{\partial y}-\frac{\partial}{\partial y}\frac{\partial V}{\partial x}$ = 0 \end{aligned}

#### $\oint_{\mathcal{P}} \myv{F}\cdot d\myv{r}=0$

When the contour integral along any closed path $\mathcal{P}$ is zero, that means that the integral of the potential is the same along any path.

\begin{aligned} 0 = \oint_{\mathcal{P}} \myv{F}\cdot d\myv{r} = \oint_{\mathcal{P}} $F_x\ dx +F_y\ dy$\\ \oint_{\mathcal{P}}$-\frac{\partial V}{\partial x}dx-\frac{\partial V}{\partial y}dy$ = -\oint_{\mathcal{P}}$\myv{\nabla}V \cdot d\myv{r}$ = -\oint_{\mathcal{P}} dV \end{aligned}

Mark Barrett