## MA101.20 Generalisation of the chain rule to partials

Consider the following simple example. Let f be a function of two variables defined by:

$f(x,y)=x^2 y$ where $x,y \in \mathbb{R}$.

By substituting,

$X = u \cos{v}$
$Y = u + 3v$

Let us define a function F of two variables by $F(x,y) = u^2 \cos{^2}{v}(u + 3v)$

Then we can calculate

$\frac{\partial{F}}{\partial{u}} = 3u\cos{^2}{v}(u+2v)$

With the obvious intentions regarding the partial derivatives $\frac{\partial{f}}{\partial{x}}, \frac{\partial{x}}{\partial{u}}, \frac{\partial{x}}{\partial{u}}, \frac{\partial{y}}{\partial{u}}$ we can also calculate

\displaystyle \begin{aligned} &\frac{\partial{f}}{\partial{x}} \cdot \frac{\partial{x}}{\partial{u}}+\frac{\partial{f}}{\partial{y}} \cdot \frac{\partial{y}}{\partial{u}} \\&= 2xy\cos{v}+x^2\cdot 1 \\&= 2u\cos{v}(u+3v)\cos{u} + y^2\cos{^2}{v} \\&= 3u\cos{^2}{v}(u+2v) \\&= \frac{\partial{F}}{\partial{u}} \end{aligned}

It can also be checked that

\displaystyle \begin{aligned} &\frac{\partial{f}}{\partial{x}} \cdot \frac{\partial{x}}{\partial{v}}+\frac{\partial{f}}{\partial{y}} \cdot \frac{\partial{y}}{\partial{v}} = \frac{\partial{F}}{\partial{v}} \end{aligned}

These two results are indeed true for a general function $f(x,y)$ and substitution $x=x(u,v), y=y(u,v)$. They are regarded as a generalisation of the chain rule for one variable. Again $\frac{\partial{F}}{\partial{u}}$ and $\frac{\partial{F}}{\partial{v}}$ are often confusingly written as $\frac{\partial{f}}{\partial{u}}$ and $\frac{\partial{f}}{\partial{v}}$.

The rule is then

$\displaystyle \frac{\partial{f}}{\partial{u}} = \frac{\partial{f}}{\partial{x}} \cdot \frac{\partial{x}}{\partial{u}}+\frac{\partial{f}}{\partial{y}} \cdot \frac{\partial{y}}{\partial{u}}$

$\displaystyle \frac{\partial{f}}{\partial{v}} = \frac{\partial{f}}{\partial{x}} \cdot \frac{\partial{x}}{\partial{v}}+\frac{\partial{f}}{\partial{y}} \cdot \frac{\partial{y}}{\partial{v}}$

It is very important to remember what is meant by all these items.

Note the chain rule can be used both ways.

ie let $f(x,y)$, $x=x(u,v)$, $y=y(u,v)$ define $F(u,v)$

We have

$\displaystyle \frac{\partial{F}}{\partial{u}} = \frac{\partial{f}}{\partial{x}} \cdot \frac{\partial{x}}{\partial{u}}+\frac{\partial{f}}{\partial{y}} \cdot \frac{\partial{y}}{\partial{u}}$

But also $f(u,v)$ defines $f(x,y)$ (substituting for u and v in terms of x and y)

So,

$\displaystyle \frac{\partial{f}}{\partial{x}} = \frac{\partial{f}}{\partial{u}} \cdot \frac{\partial{u}}{\partial{x}}+\frac{\partial{f}}{\partial{v}} \cdot \frac{\partial{v}}{\partial{x}}$

and, of course, we put F as f throughout.

These results are special cases of the so called general chain rule.

If we have a function $f(x_{1},...x_{n})$ where x are substitutions

$\displaystyle x_1 = \phi (u_{1},...u_{n})$
$\displaystyle x_2 = \phi (u_{1},...u_{n})$
$\displaystyle \vdots$
$\displaystyle x_n = \phi (u_{1},...u_{n})$

Then $\displaystyle \frac{\partial{f}}{\partial{u_1}} = \frac{\partial{f}}{\partial{x_1}} \cdot \frac{\partial{x_1}}{\partial{u_1}}+ \frac{\partial{f}}{\partial{x_2}} \cdot \frac{\partial{x_2}}{\partial{u_1}}+\cdots+ \frac{\partial{f}}{\partial{x_n}} \cdot \frac{\partial{x_n}}{\partial{u_1}}$

###### Special cases

i) $\displaystyle f=f(x,y), x=x(t), y=y(t)$

$\displaystyle \frac{\partial{f}}{\partial{t}} = \frac{\partial{f}}{\partial{x}} \cdot \frac{\partial{x}}{\partial{t}}+\frac{\partial{f}}{\partial{y}} \cdot \frac{\partial{y}}{\partial{t}}$

ii) $\displaystyle f=f(x,y), y=y(x), x=x$

$\displaystyle \frac{\partial{f}}{\partial{x}} = \frac{\partial{f}}{\partial{x}} +\frac{\partial{f}}{\partial{v}} \cdot \frac{\partial{v}}{\partial{x}}$

## MA101.17 Continuity of functions of two variables

We can say that $f(x,y)\to L$ as the $(x,y) \to (a,b)$, or $\displaystyle \lim_{(x,y)\to (a,b)} f(x,y) = L$.

If, intuitively speaking, by going close enough to (a,b) we can get f(a,b) as close as we like to L.

f(x,y) is said to be continuous at (a,b) if $\displaystyle \lim_{(x,y)\to (a,b)} f(x,y) = f(a,b)$.

Just as with one variable limits from below and above may be different, with two variables we may get various limits coming in from different paths.

##### Example

$\displaystyle f(x,y)=\frac{xy}{x^2+y^2} \qquad (x,y) \neq (0,0)$

Consider coming in to (0,0) along the line y=mx (m fixed). Along this line we have:

$\displaystyle f(x,y) = f(x,mx) = \frac{xmx}{x^2 + m^2x^2} = \frac{m}{1+m^2}$

Thus along y=mx,

$\displaystyle \lim_{(x,y)\to (0,0)} f(x,y) = \lim_{x\to 0} \frac{m}{1+m^2} = \frac{m}{1+m^2}$

If we come in along the line $y=x^2$,

$\displaystyle \lim_{along y=x^2} f(x,y) = \lim_{x\to 0} \frac{x^3}{x^2+x^4} = \lim_{x\to 0}\frac{1}{\frac{1}{x}+x} = 0$.

## MA101.16 Functions of two variables or more

For a function of two (real) variables each element of its domain is an ordered pair of real numbers (x,y) only, and each element of its range is a real number, z, say.

x and y are called independent variables, and z the dependent variable.

To specify such functions we must have both a rule, and a domain.

##### Example

i) \begin{aligned} z=\sqrt{1-x^2-y^2} \qquad&\mbox{domain: }&&\{(x,y) | x^2 +y^2 \leq 1\} \\&\mbox{range: }&&[0,1]\end{aligned}

ii) \begin{aligned} f(x,y)=\sqrt{2-x}+\sqrt{9-y^2} \qquad&\mbox{domain: }&&\{(x,y) | x \leq 2, -3\leq y\leq3\} \\&\mbox{range: }&&[0,\infty)\end{aligned}

If no known domain is specified we again take it to be the largest subset of $\mathbb{R}^2$ for which the rule makes sense.

A graph of $z=f(x,y)$ may be drawn in the usual way. (ie. (x,y) in the horizontal plane called the xy plane, and z moving along a third, vertical axis.

For obvious reasons informative graphs are often quite difficult to draw. It’s often useful to draw profiles of f, that is the surface curves where their surface meets planes parallel to the coordinate axis.

##### Example

Sketch $x=e^{-xy}$

Consider the intersection with x=constant, y=constant and z=constant.

\begin{aligned} x=0 \qquad&z=1 \qquad\qquad&&y=0 &&&&z=1\\x=1 \qquad&z=e^{-y} \qquad\qquad&&y=1 &&&&z=e^{-x}\\x=2 \qquad&z=e^{-2y} \qquad\qquad&&y=2 &&&&z=e^{-2x} \end{aligned}

$z=\frac{1}{2} \Rightarrow \frac{1}{2}=e^{-xy} \Rightarrow e^{xy}=2 \Rightarrow xy=\ln{2} \\ z=e^{-1} \Rightarrow e^1 = e^{xy} \Rightarrow xy=1$

Another useful diagram of f(x,y) is that provided by drawing the contour lines (or level curves). That is we sketch in the x,y plane the graph of y=f(x,y) for various values of z.

Look at $z=e^{-xy}$ again.

$-xy = \ln{z}$ so $xy =-\ln{z}$

When,

\begin{aligned}&z=1 \qquad&&xy=0 \\&z=e&&xy=-1 \\&z=e^4&& xy=-4 \\&z=e^{-1}&&xy=1 \\&z=e^{-4}&&xy=4 \end{aligned}

##### Example

Sketch $z=x^2+y^2$

For a function $w=f(x,y,z)$ we can not sketch profile, and the best we can do is sketch level surfaces.

##### Example

$w=x+y+z$

For $w=2 \Rightarrow 2-x-y=z$ etc…