Calculus/Multivariable calculus

 ← Lines and Planes in Space Calculus Ordinary differential equations → Multivariable calculus

This chapter serves as an introduction to multivariable calculus. Multivariable calculus is more complicated than when we were dealing with single-variable functions because more variables means more situations to be concerned about. In the following chapters, we will be discussing limits, differentiation, and integration of multivariable functions, using single-variable calculus as our basis.

Topology in ${\displaystyle \mathbb {R} ^{n}}$

In your previous study of calculus, we have looked at functions and their behavior. Most of these functions we have examined have been all in the form

${\displaystyle f(x):\mathbb {R} \to \mathbb {R} }$

and only occasional examination of functions of two variables. However, the study of functions of several variables is quite rich in itself, and has applications in several fields.

We write functions of vectors - many variables - as follows:

${\displaystyle f:\mathbb {R} ^{m}\to \mathbb {R} ^{n}}$

and ${\displaystyle f({\vec {x}})}$ for the function that maps a vector in ${\displaystyle \mathbb {R} ^{m}}$ to a vector in ${\displaystyle \mathbb {R} ^{n}}$ .

Before we can do calculus in ${\displaystyle \mathbb {R} ^{n}}$ , we must familiarize ourselves with the structure of ${\displaystyle \mathbb {R} ^{n}}$ . We need to know which properties of ${\displaystyle \mathbb {R} }$ can be extended to ${\displaystyle \mathbb {R} ^{n}}$ . This page assumes at least some familiarity with basic linear algebra.

Lengths and distances

If we have a vector in ${\displaystyle \mathbb {R} ^{2}}$ we can calculate its length using the Pythagorean theorem. For instance, the length of the vector ${\displaystyle (2,3)}$ is

${\displaystyle {\sqrt {3^{2}+2^{2}}}={\sqrt {13}}}$

We can generalize this to ${\displaystyle \mathbb {R} ^{n}}$ . We define a vector's length, written ${\displaystyle \|{\vec {x}}\|}$ , as the square root of the sum of the squares of each of its components. That is, if we have a vector ${\displaystyle {\vec {x}}=(x_{1},\ldots ,x_{n})}$ ,

${\displaystyle \|{\vec {x}}\|={\sqrt {x_{1}^{2}+\cdots +x_{n}^{2}}}}$

Now that we have established some concept of length, we can establish the distance between two vectors. We define this distance to be the length of the two vectors' difference. We write this distance ${\displaystyle d({\vec {x}},{\vec {y}})}$ , and it is

${\displaystyle d({\vec {x}},{\vec {y}})={\big \|}{\vec {x}}-{\vec {y}}{\big \|}={\sqrt {\sum _{i=1}^{n}(x_{i}-y_{i})^{2}}}}$

This distance function is sometimes referred to as a metric. Other metrics arise in different circumstances. The metric we have just defined is known as the Euclidean metric.

Open and closed balls

In ${\displaystyle \mathbb {R} }$ , we have the concept of an interval, in that we choose a certain number of other points about some central point. For example, the interval ${\displaystyle [-1,1]}$ is centered about the point 0, and includes points to the left and right of 0.

In ${\displaystyle \mathbb {R} ^{2}}$ and up, the idea is a little more difficult to carry on. For ${\displaystyle \mathbb {R} ^{2}}$ , we need to consider points to the left, right, above, and below a certain point. This may be fine, but for ${\displaystyle \mathbb {R} ^{3}}$ we need to include points in more directions.

We generalize the idea of the interval by considering all the points that are a given, fixed distance from a certain point - now we know how to calculate distances in ${\displaystyle \mathbb {R} ^{n}}$ , we can make our generalization as follows, by introducing the concept of an open ball and a closed ball respectively, which are analogous to the open and closed interval respectively.

an open ball
${\displaystyle B({\vec {a}},r)}$
is a set in the form ${\displaystyle {\Big \{}{\vec {x}}\in \mathbb {R} ^{n}{\Big |}d({\vec {x}},{\vec {a}})
a closed ball
${\displaystyle {\overline {B}}({\vec {a}},r)}$
is a set in the form ${\displaystyle {\Big \{}{\vec {x}}\in \mathbb {R} ^{n}{\Big |}d({\vec {x}},{\vec {a}})\leq r{\Big \}}}$

In ${\displaystyle \mathbb {R} }$ , we have seen that the open ball is simply an open interval centered about the point ${\displaystyle x=a}$ . In ${\displaystyle \mathbb {R} ^{2}}$ this is a circle with no boundary, and in ${\displaystyle \mathbb {R} ^{3}}$ it is a sphere with no outer surface. (What would the closed ball be?)

Boundary points

If we have some area, say a field, then the common sense notion of the boundary is the points 'next to' both the inside and outside of the field. For a set, ${\displaystyle S}$ , we can define this rigorously by saying the boundary of the set contains all those points such that we can find points both inside and outside the set. We call the set of such points ${\displaystyle \partial S}$ .

Typically, when it exists the dimension of ${\displaystyle \partial S}$ is one lower than the dimension of ${\displaystyle S}$ . e.g. the boundary of a volume is a surface and the boundary of a surface is a curve.

This isn't always true; but it is true of all the sets we will be using.

A set ${\displaystyle S}$ is bounded if there is some positive number such that we can encompass this set by a closed ball about ${\displaystyle {\vec {0}}}$ . --> if every point in it is within a finite distance of the origin, i.e there exists some ${\displaystyle r>0}$ such that ${\displaystyle {\vec {x}}}$ is in S implies ${\displaystyle {\vec {x}} .

Limits

We will focus on the limits of two-variable functions while reviewing the limits of single-variable functions. Multivariable limits are significantly harder than single-variable limits because of different directions. Assume that there is a single-variable function:

${\displaystyle y=f(x)}$

In order to ensure that ${\displaystyle \lim _{x\rightarrow c}f(x)}$ exists, we need to test it from two directions: one approaching ${\displaystyle c}$ from the left side (${\displaystyle x\rightarrow c^{-}}$) and the other approaching ${\displaystyle c}$ from the right side (${\displaystyle x\rightarrow c^{+}}$). Recall that

${\displaystyle \lim _{x\rightarrow c}f(x)}$ exists when ${\displaystyle \lim _{x\rightarrow c^{-}}f(x)=\lim _{x\rightarrow c^{+}}f(x)}$.

For example, ${\displaystyle \lim _{x\rightarrow 0}{\frac {1}{x}}}$ does not exist because ${\displaystyle \lim _{x\rightarrow 0^{-}}{\frac {1}{x}}=-\infty }$ and ${\displaystyle \lim _{x\rightarrow 0^{+}}{\frac {1}{x}}=\infty }$. Now, assume that there is a function with two variables:

${\displaystyle z=f(x,y)}$

If we want to take a limit, for example, ${\displaystyle \lim _{(x,y)\rightarrow (a,b)}f(x,y)}$, not only do we need to consider the limit from the direction of the ${\displaystyle x}$-axis, we also need to consider the limit from all directions, which includes the ${\displaystyle y}$-axis, lines, curves, etc. Generally speaking, if there is one direction where the calculated limit is different from others, the limit does not exist. We will be discussing this in detail here.

Differentiable functions

A two variable function ${\displaystyle f(x,y)=(x^{2}+3y^{2})^{1-x^{2}-y^{2}}}$

When we expand our scope into the 3-dimensional world, we have significantly more situations to consider. For example, derivatives. In previous chapters, derivatives only have one direction (the ${\displaystyle x}$-axis) because there is only one variable.

${\displaystyle {\frac {d(x^{3}+4x)}{dx}}=3x^{2}+4}$

When we have two or more variables, the rate of change can be calculated in different directions. For example, take a look at the image on the right. This is the graph of a two-variable function. Since there are two variables, the domain will be the whole ${\displaystyle xy}$-plane. We will graph the output ${\displaystyle f(x,y)}$ on the ${\displaystyle z}$-axis. The equation for the function on the right is:

${\displaystyle f(x,y)=(x^{2}+3y^{2})^{1-x^{2}-y^{2}}}$

How can we calculate a derivative? The answer is to use partial derivatives. As the name suggests, it can only calculate a derivative "partially" because we can only calculate the rate of change of a graph in one direction.

Partial derivatives

Notations are important for partial derivatives.

${\displaystyle {\frac {\partial }{\partial x}}f(x,y)}$ means the derivative of ${\displaystyle f(x,y)}$ in the ${\displaystyle x}$-axis direction, where we only view the ${\displaystyle x}$ as a variable while ${\displaystyle y}$ as a constant.

${\displaystyle {\frac {\partial }{\partial y}}f(x,y)}$ means the derivative of ${\displaystyle f(x,y)}$ in the ${\displaystyle y}$-axis direction, where we only view the ${\displaystyle y}$ as a variable while ${\displaystyle x}$ as a constant.

For simplicity, we will often use various standard abbreviations, so we can write most of the formulae on one line. This can make it easier to see the important details. We can abbreviate partial differentials with a subscript, e.g.,

${\displaystyle f_{x}(x,y)={\frac {\partial f}{\partial x}}\quad f_{y}(x,y)={\frac {\partial f}{\partial y}}\quad f_{xy}={\frac {\partial ^{2}f}{\partial x\partial y}}={\frac {\partial ^{2}f}{\partial y\partial x}}=f_{yx}}$

When we are using a subscript this way we will generally use the Heaviside D (which stands for "directional") rather than ∂,

${\displaystyle D_{x}h(x,y)={\frac {\partial h}{\partial x}}\quad D_{x}D_{y}h=D_{y}D_{x}h}$

${\displaystyle D_{\mathbf {\hat {u}} }f(x,y)}$ means the derivative of ${\displaystyle f}$ in the direction ${\displaystyle \mathbf {\hat {u}} =\langle a,b\rangle }$

If we are using subscripts to label the axes, x1, x2 …, then, rather than having two layers of subscripts, we will use the number as the subscript.

${\displaystyle h_{1}=D_{1}h=\partial _{1}h=\partial _{x_{1}}h={\frac {\partial h}{\partial x_{1}}}}$

We can also use subscripts for the components of a vector function, ${\displaystyle \mathbf {u} =\langle u_{x},u_{y},u_{z}\rangle {\text{ or }}\mathbf {u} =(u_{1},u_{2},...,u_{n})}$ If we are using subscripts for both the components of a vector and for partial derivatives we will separate them with a comma.

${\displaystyle u_{x,y}={\frac {\partial u_{x}}{\partial y}}}$

The most widely used notation is ${\displaystyle f_{x}}$.

We will use whichever notation best suits the equation we are working with.

Directional derivatives

Normally, a partial derivative of a function with respect to one of its variables, say, xj, takes the derivative of that "slice" of that function parallel to the xj'th axis.

More precisely, we can think of cutting a function f(x1,...,xn) in space along the xj'th axis, with keeping everything but the xj variable constant.

From the definition, we have the partial derivative at a point p of the function along this slice as

${\displaystyle {\partial \mathbf {f} \over \partial x_{j}}=\lim _{t\rightarrow 0}{\mathbf {f} (\mathbf {p} +t\mathbf {e} _{j})-\mathbf {f} (\mathbf {p} ) \over t}}$

provided this limit exists.

Instead of the basis vector, which corresponds to taking the derivative along that axis, we can pick a vector in any direction (which we usually take as being a unit vector), and we take the directional derivative of a function as

${\displaystyle {\partial \mathbf {f} \over \partial \mathbf {d} }=\lim _{t\rightarrow 0}{\mathbf {f} (\mathbf {p} +t\mathbf {d} )-\mathbf {f} (\mathbf {p} ) \over t}}$

where d is the direction vector.

If we want to calculate directional derivatives, calculating them from the limit definition is rather painful, but, we have the following: if f : RnR is differentiable at a point p, |p|=1,

${\displaystyle {\partial \mathbf {f} \over \partial \mathbf {d} }=D_{\mathbf {p} }\mathbf {f} (\mathbf {d} )}$

There is a closely related formulation which we'll look at in the next section.

The partial derivatives of a scalar tell us how much it changes if we move along one of the axes. What if we move in a different direction?

We'll call the scalar f, and consider what happens if we move an infintesimal direction dr=(dx,dy,dz), using the chain rule.

${\displaystyle \mathbf {df} =dx{\frac {\partial f}{\partial x}}+dy{\frac {\partial f}{\partial y}}+dz{\frac {\partial f}{\partial z}}}$

This is the dot product of dr with a vector whose components are the partial derivatives of f, called the gradient of f

${\displaystyle \operatorname {grad} \mathbf {f} =\nabla \mathbf {f} =\left({\frac {\partial \mathbf {f} (\mathbf {p} )}{\partial x_{1}}},\cdots ,{\frac {\partial \mathbf {f} (\mathbf {p} )}{\partial x_{n}}}\right)}$

We can form directional derivatives at a point p, in the direction d then by taking the dot product of the gradient with d

${\displaystyle {\partial \mathbf {f} (\mathbf {p} ) \over \partial \mathbf {d} }=\mathbf {d} \cdot \nabla \mathbf {f} (\mathbf {p} )}$.

Notice that grad f looks like a vector multiplied by a scalar. This particular combination of partial derivatives is commonplace, so we abbreviate it to

${\displaystyle \nabla =\left({\frac {\partial }{\partial x}},{\frac {\partial }{\partial y}},{\frac {\partial }{\partial z}}\right)}$

We can write the action of taking the gradient vector by writing this as an operator. Recall that in the one-variable case we can write d/dx for the action of taking the derivative with respect to x. This case is similar, but acts like a vector.

We can also write the action of taking the gradient vector as:

${\displaystyle \nabla =\left({\frac {\partial }{\partial x_{1}}},{\frac {\partial }{\partial x_{2}}},\cdots {\frac {\partial }{\partial x_{n}}}\right)}$

Geometry
• Grad f(p) is a vector pointing in the direction of steepest slope of f. |grad f(p)| is the rate of change of that slope at that point.

For example, if we consider h(x, y)=x2+y2. The level sets of h are concentric circles, centred on the origin, and

${\displaystyle \nabla h=(h_{x},h_{y})=2(x,y)=2\mathbf {r} }$

grad h points directly away from the origin, at right angles to the contours.

• Along a level set, (∇f)(p) is perpendicular to the level set {x|f(x)=f(p) at x=p}.

If dr points along the contours of f, where the function is constant, then df will be zero. Since df is a dot product, that means that the two vectors, df and grad f, must be at right angles, i.e. the gradient is at right angles to the contours.

Algebraic properties

Like d/dx, ∇ is linear. For any pair of constants, a and b, and any pair of scalar functions, f and g

${\displaystyle {\frac {d}{dx}}(af+bg)=a{\frac {d}{dx}}f+b{\frac {d}{dx}}g\quad \nabla (af+bg)=a\nabla f+b\nabla g}$

Since it's a vector, we can try taking its dot and cross product with other vectors, and with itself.

Product and chain rules

Just as with ordinary differentiation, there are product rules for grad, div and curl.

• If g is a scalar and v is a vector, then
the divergence of gv is
${\displaystyle \nabla \cdot (g\mathbf {v} )=g\nabla \cdot \mathbf {v} +(\mathbf {v} \cdot \nabla )g}$
the curl of gv is
${\displaystyle \nabla \times (g\mathbf {v} )=g(\nabla \times \mathbf {v} )+(\nabla g)\times \mathbf {v} }$
• If u and v are both vectors then
the gradient of their dot product is
${\displaystyle \nabla (\mathbf {u} \cdot \mathbf {v} )=\mathbf {u} \times (\nabla \times \mathbf {v} )+\mathbf {v} \times (\nabla \times \mathbf {u} )+(\mathbf {u} \cdot \nabla )\mathbf {v} +(\mathbf {v} \cdot \nabla )\mathbf {u} }$
the divergence of their cross product is
${\displaystyle \nabla \cdot (\mathbf {u} \times \mathbf {v} )=\mathbf {v} \cdot (\nabla \times \mathbf {u} )-\mathbf {u} \cdot (\nabla \times \mathbf {v} )}$
the curl of their cross product is
${\displaystyle \nabla \times (\mathbf {u} \times \mathbf {v} )=(\mathbf {v} \cdot \nabla )\mathbf {u} -(\mathbf {u} \cdot \nabla )\mathbf {v} +\mathbf {u} (\nabla \cdot \mathbf {v} )-\mathbf {v} (\nabla \cdot \mathbf {u} )}$

We can also write chain rules. In the general case, when both functions are vectors and the composition is defined, we can use the Jacobian defined earlier.

${\displaystyle \left.\nabla \mathbf {u} (\mathbf {v} )\right|_{\mathbf {r} }=\mathbf {J} _{\mathbf {v} }\left.\nabla \mathbf {v} \right|_{\mathbf {r} }}$

where Ju is the Jacobian of u at the point v.

Normally J is a matrix but if either the range or the domain of u is R1 then it becomes a vector. In these special cases we can compactly write the chain rule using only vector notation.

• If g is a scalar function of a vector and h is a scalar function of g then
${\displaystyle \nabla h(g)={\frac {dh}{dg}}\nabla g}$
• If g is a scalar function of a vector then
${\displaystyle \nabla =(\nabla g){\frac {d}{dg}}}$

This substitution can be made in any of the equations containing

Integration

We have already considered differentiation of functions of more than one variable, which leads us to consider how we can meaningfully look at integration.

In the single variable case, we interpret the definite integral of a function to mean the area under the function. There is a similar interpretation in the multiple variable case: for example, if we have a paraboloid in R3, we may want to look at the integral of that paraboloid over some region of the xy plane, which will be the volume under that curve and inside that region.

Riemann sums

When looking at these forms of integrals, we look at the Riemann sum. Recall in the one-variable case we divide the interval we are integrating over into rectangles and summing the areas of these rectangles as their widths get smaller and smaller. For the multiple-variable case, we need to do something similar, but the problem arises how to split up R2, or R3, for instance.

To do this, we extend the concept of the interval, and consider what we call a n-interval. An n-interval is a set of points in some rectangular region with sides of some fixed width in each dimension, that is, a set in the form {xRn|aixibi with i = 0,...,n}, and its area/size/volume (which we simply call its measure to avoid confusion) is the product of the lengths of all its sides.

So, an n-interval in R2 could be some rectangular partition of the plane, such as {(x,y) | x ∈ [0,1] and y ∈ [0, 2]|}. Its measure is 2.

If we are to consider the Riemann sum now in terms of sub-n-intervals of a region Ω, it is

${\displaystyle \sum _{i;S_{i}\subset \Omega }f(x_{i}^{*})m(S_{i})}$

where m(Si) is the measure of the division of Ω into k sub-n-intervals Si, and x*i is a point in Si. The index is important - we only perform the sum where Si falls completely within Ω - any Si that is not completely contained in Ω we ignore.

As we take the limit as k goes to infinity, that is, we divide up Ω into finer and finer sub-n-intervals, and this sum is the same no matter how we divide up Ω, we get the integral of f over Ω which we write

${\displaystyle \int _{\Omega }f}$

For two dimensions, we may write

${\displaystyle \int \int _{\Omega }f}$

and likewise for n dimensions.

Iterated integrals

Thankfully, we need not always work with Riemann sums every time we want to calculate an integral in more than one variable. There are some results that make life a bit easier for us.

For R2, if we have some region bounded between two functions of the other variable (so two functions in the form f(x) = y, or f(y) = x), between a constant boundary (so, between x = a and x =b or y = a and y = b), we have

${\displaystyle \int _{a}^{b}\,\int _{f(x)}^{g(x)}h(x,y)\,dydx}$

An important theorem (called Fubini's theorem) assures us that this integral is the same as

${\displaystyle \int \int _{\Omega }f}$,

if f is continuous on the domain of integration.