Calculus/Multivariable calculus
This chapter serves as an introduction to multivariable calculus. Multivariable calculus is more complicated than when we were dealing with singlevariable 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 singlevariable calculus as our basis.
Topology in [edit]
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
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:
and for the function that maps a vector in to a vector in .
Before we can do calculus in , we must familiarize ourselves with the structure of . We need to know which properties of can be extended to . This page assumes at least some familiarity with basic linear algebra.
Lengths and distances[edit]
If we have a vector in we can calculate its length using the Pythagorean theorem. For instance, the length of the vector is
We can generalize this to . We define a vector's length, written , as the square root of the sum of the squares of each of its components. That is, if we have a vector ,
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 , and it is
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[edit]
In , 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 is centered about the point 0, and includes points to the left and right of 0.
In and up, the idea is a little more difficult to carry on. For , we need to consider points to the left, right, above, and below a certain point. This may be fine, but for 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 , 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
 is a set in the form
 a closed ball
 is a set in the form
In , we have seen that the open ball is simply an open interval centered about the point . In this is a circle with no boundary, and in it is a sphere with no outer surface. (What would the closed ball be?)
Boundary points[edit]
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, , 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 .
Typically, when it exists the dimension of is one lower than the dimension of . 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 is bounded if there is some positive number such that we can encompass this set by a closed ball about . > if every point in it is within a finite distance of the origin, i.e there exists some such that is in S implies .
Limits[edit]
We will focus on the limits of twovariable functions while reviewing the limits of singlevariable functions. Multivariable limits are significantly harder than singlevariable limits because of different directions. Assume that there is a singlevariable function:
In order to ensure that exists, we need to test it from two directions: one approaching from the left side () and the other approaching from the right side (). Recall that
exists when .
For example, does not exist because and . Now, assume that there is a function with two variables:
If we want to take a limit, for example, , not only do we need to consider the limit from the direction of the axis, we also need to consider the limit from all directions, which includes the 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[edit]
When we expand our scope into the 3dimensional world, we have significantly more situations to consider. For example, derivatives. In previous chapters, derivatives only have one direction (the axis) because there is only one variable.
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 twovariable function. Since there are two variables, the domain will be the whole plane. We will graph the output on the axis. The equation for the function on the right is:
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[edit]
Notations are important for partial derivatives.
means the derivative of in the axis direction, where we only view the as a variable while as a constant.
means the derivative of in the axis direction, where we only view the as a variable while 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.,
When we are using a subscript this way we will generally use the Heaviside D (which stands for "directional") rather than ∂,
means the derivative of in the direction
If we are using subscripts to label the axes, x_{1}, x_{2} …, then, rather than having two layers of subscripts, we will use the number as the subscript.
We can also use subscripts for the components of a vector function, If we are using subscripts for both the components of a vector and for partial derivatives we will separate them with a comma.
The most widely used notation is .
We will use whichever notation best suits the equation we are working with.
Directional derivatives[edit]
Normally, a partial derivative of a function with respect to one of its variables, say, x_{j}, takes the derivative of that "slice" of that function parallel to the x_{j}'th axis.
More precisely, we can think of cutting a function f(x_{1},...,x_{n}) in space along the x_{j}'th axis, with keeping everything but the x_{j} variable constant.
From the definition, we have the partial derivative at a point p of the function along this slice as
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
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 : R^{n} → R is differentiable at a point p, p=1,
There is a closely related formulation which we'll look at in the next section.
Gradient vectors[edit]
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.
This is the dot product of dr with a vector whose components are the partial derivatives of f, called the gradient of f
We can form directional derivatives at a point p, in the direction d then by taking the dot product of the gradient with d
 .
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
We can write the action of taking the gradient vector by writing this as an operator. Recall that in the onevariable 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:
Properties of the gradient vector[edit]
Geometry[edit]
 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)=x^{2}+y^{2}. The level sets of h are concentric circles, centred on the origin, and
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 {xf(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[edit]
Like d/dx, ∇ is linear. For any pair of constants, a and b, and any pair of scalar functions, f and 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[edit]
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

 the curl of gv is
 If u and v are both vectors then
 the gradient of their dot product is

 the divergence of their cross product is

 the curl of their cross product is
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.
where J_{u} 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 R^{1} 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
 If g is a scalar function of a vector then
This substitution can be made in any of the equations containing ∇
Integration[edit]
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 R^{3}, 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[edit]
When looking at these forms of integrals, we look at the Riemann sum. Recall in the onevariable 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 multiplevariable case, we need to do something similar, but the problem arises how to split up R^{2}, or R^{3}, for instance.
To do this, we extend the concept of the interval, and consider what we call a ninterval. An ninterval 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 {x∈R^{n}a_{i} ≤ x_{i} ≤ b_{i} 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 ninterval in R^{2} 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 subnintervals of a region Ω, it is
where m(S_{i}) is the measure of the division of Ω into k subnintervals S_{i}, and x^{*}_{i} is a point in S_{i}. The index is important  we only perform the sum where S_{i} falls completely within Ω  any S_{i} 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 subnintervals, and this sum is the same no matter how we divide up Ω, we get the integral of f over Ω which we write
For two dimensions, we may write
and likewise for n dimensions.
Iterated integrals[edit]
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 R^{2}, 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
An important theorem (called Fubini's theorem) assures us that this integral is the same as
 ,
if f is continuous on the domain of integration.