Multivariate Calculus Primer

Vector Arithmetic

Basic Vector Arithmetic

Vectors in both the plane and space can be added, subtracted, and scaled.  This is done coordinate by coordinate:

({{({{<2,3>+<-7,1> = <-5,4>}, {<1,4,-3>+<2,9,7> = <3,13,4>}, {<1,2>-<5,-3> = <-4,5>}, {<5,1,-6>-<3,2,-1> = <2,-1,-5>}, {4<4,-3> = <16,-12>}, {-3<1,2,-8> = <-3,-6,24>}})}})

Vectors in the plane and space also have a length/norm which is found from the coordinates using a version of the Pythagorean theorem (squaring all the coordinates, adding them, and then taking a square root):

({{({{||<3,4>||=(Sqrt[(3^2)+(4^2)])=(Sqrt[25])=5}, {||<1,1,-3>||=(Sqrt[(1^2)+(1^2)+(((-3))^2)])=(Sqrt[11])}})}})

A vector is called a unit vector if has length 1.  If (OverVector[u]) is a nonzero vector then ((OverVector[u])/(||(OverVector[u])||))is a unit vector in the same direction as (OverVector[u])  (called the normalization of (OverVector[u])).

Advanced Vector Arithmetic

Vectors in the plane and space also have a “dot product” (written (OverVector[u])· (OverVector[v])) which is a number that you get by multiplying corresponding coordinates and then adding the results:

({{({{<2,3>·<5,8> = 2 5+3 8=}})34}, {<2,1,-3>·<3,2,1> = 2 3 + 1 2 + -3 1=5}})

The dot product is used to measure the angle θ between two vectors using the formula

({{({{(OverVector[u])}})·(OverVector[v])=||(OverVector[u])|| ||(OverVector[v])|| cos(θ), or cos(θ)=((({{(OverVector[u])}})·(OverVector[v]))/(||(OverVector[u])|| ||(OverVector[v])||))}})

In particular, two non-zero vectors are perpendicular/orthogonal if and only if their dot product is 0.  Also note that as the angle of a vector with itself is 0° we have  (OverVector[u])·(OverVector[u])=||(OverVector[u])((||)^2).

Vectors in space also have a “cross product”  (written (OverVector[u])×(OverVector[v]))  which is a vector you get by evaluating a 3 by 3 determinant.  If (OverVector[i])=<1,0,0>, (OverVector[j])=<0,1,0>, and (OverVector[k])=<0,0,1> are the standard basis for (ℝ^3), then the cross product of  (OverVector[u])=<a,b,c> and (OverVector[v])=<d,e,f> is given by

({{({{ (OverVector[u])×(OverVector[v])=|({{(OverVector[i]), (OverVector[j]), k}, {a, b, c}, {d, e, f}})|=(OverVector[i]) (b f-c e)-(OverVector[j]) (a f-c d)+(OverVector[k])}})(a e-b d)}})

(note that like all 3x3 determinants this can be evaluated by adding and subtracting products along particular wrap-around diagonals).  (OverVector[u])×(OverVector[v]) is a vector which is perpendicular to both (OverVector[u]) and (OverVector[v]) and has a length ||(OverVector[u])×(OverVector[v]) || = ||(OverVector[u])|| ||(OverVector[v])|| sin(θ)  where θ is the angle between the vectors.  This length is also the area of the parallelogram whose sides are (OverVector[u]) and (OverVector[v]) (so half of the length of the cross product is the area of the triangle spanned by the two vectors).   The cross product is anti-symmetric (meaning (OverVector[u])×(OverVector[v]) =-((OverVector[v])×(OverVector[u]) )).  As the cross product creates a vector perpendicular to both of its inputs it often shows up when working with planes in space (as a key component in defining a plane is finding a vector which is perpendicular to it).

There is also a “triple scalar product”/”box product” of 3 vectors in space.  The result of this product is a number, and if  (OverVector[u])=<a,b,c>, (OverVector[v])=<d,e,f>, and (OverVector[w])=<s,t,u>, then the box product of (OverVector[u]),(OverVector[v]), and (OverVector[w]) is (OverVector[u])·((OverVector[v])×(OverVector[w])) and can be computed directly (without needing to do the cross product) by the 3x3 determinant

({{({{ (OverVector[u])·((OverVector[v])×(OverVector[w]))=}})|({{a, b, c}, {d, e, f}, {s, t, u}})|=a( e u -f t)-b(d u-f s)+c(d t-e s)}})

The box product does depend on the order in which the vectors are listed (changing the order either keeps the result the same or changes its sign).  Up to sign, the box product measures the volume of the 3D box whose sides are the 3 vectors.

Lines and Planes

Lines

To find vector/parametric form of a line in the plane or space you need a point in the line and a vector in the line’s direction (if you have two points on the line, the direction vector can be chosen to be the vector from one point to the other).  If the line is in space, the point on the line is ((Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])), and the direction vector is <a,b,c>, the line can be given as <x,y,z> = <(Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])>+t<a,b,c>, where t∈ℝ.  If the line is in the plane the computation is the same just without the third coordinates.

Planes

To find the equation of a plane in space typically you need a point P=((Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])) in the plane and a vector (OverVector[N]) which is perpendicular to the plane.  Then an equation of the plane is given by (OverVector[N])·(<x,y,z>-<(Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])>)=0 (this states that the vector from P to the general point (x,y,z) in the plane is perpendicular to (OverVector[N])).  A common example is to find the plane through 3 non-collinear points P, Q, and R.  To do this find the vector (OverVector[u]) from P to Q and the vector (OverVector[v]) from P to R; then you can choose the normal vector to be (OverVector[N])=(OverVector[u])×(OverVector[v]).  Another common example is to find the tangent plane to a surface at a given point  P=((Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])); in this case the normal vector is usually found by taking partial derivatives.

Note that if you multiply out the equation of the plane given above and move the constant to the right-hand side, the equation of a plane in space will always look like a x+b y +c z=d, where not all of the numbers a,b, and c are 0.  In this case the vector <a,b,c> is normal to the plane (so for the plane 2x-3y+z=5, a normal vector for the plane could be <2,-3,1>).

Partial Derivatives, Directional Derivatives, and the Gradient

Partial Derivatives

If a function depends on more than one independent variable then it has a different derivative with respect to each independent variable - these are called partial derivatives. If z=f(x,y), then the notation for the derivative with respect to x is written as ((∂z)/(∂x))=((∂f)/(∂x))=(∂/(∂x))f(x,y)=(Subscript[f, x])=(Subscript[f, 1]) and the partial derivative with respect to y is written as ((∂z)/(∂y))=((∂f)/(∂y))=(∂/(∂y))f(x,y)=(Subscript[f, y])=(Subscript[f, 2]).  To take a partial derivative with respect to a variable the idea is you treat all of the other variables as if they were just constants and then use the regular derivative rules.  For example:

({{({{(∂/(∂x))((x^2)y+sin(2x +3y))=(∂/(∂x))((x^2)y)+(∂/(∂x))sin(2x+}})3y)=}, {y(∂/(∂x))(x^2)+cos(2x+3y)×(∂/(∂x))(2x+3y)=y(2x)+cos(2x+3y)×(2+0)=}, {2x y+2cos(2x+3y)}, { }, {({{(∂/(∂y))((x^2)y+sin(2x +3y))=(∂/(∂y))((x^2)y)+(∂/(∂y))sin(2x+3y)=}, {(x^2)(∂/(∂y))y+cos(2x+3y)(∂/(∂y))(2x+3y)=(x^2)×1+cos(2x+3y)(0+3)=}, {(x^2)+3cos(2x+3y)}, { }, {(∂/(∂z))(x (z^2)+3(x^5)-(y^3)+(z^y)+(y^z))=(∂/(∂z))x (z^2)+(∂/(∂z))(3(x^5))-(∂/(∂z))((y^3))+(∂/(∂z))((z^y))+(∂/(∂z))((y^z))=}, {x(∂/(∂z))(z^2)+0-0+y (z^(y-1))+(y^z)ln(y)=x(2z)+y (z^(y-1))+(y^z)ln(y)=2x z+y (z^(y-1))+(y^z)ln(y)}})}})

Higher partial derivatives are found just by taking repeated partial derivatives.  As there is more than one variable you can take the derivative of there are many different higher derivatives for each function.  For example for f(x,y) the second partials would be (Subscript[f, x x]), (Subscript[f, x y]), (Subscript[f, y x]), and (Subscript[f, y y]).  In the subscript notation you start with the rightmost subscript and work your way left; so in (Subscript[f, x x y z y]) you take the derivative with respect to y, then z, then y, then x, and then x again.  In most cases “mixed” partial derivatives will be the same (so frequently (Subscript[f, x y])=(Subscript[f, y x]) even though the order in which you take derivatives is different) - this will be the case whenever all of the results are continuous.

There is a “chain rule” for partial derivatives.  If z=f(x,y) but x and y depend on/are defined by formulas in other variables u and v, then ((∂f)/(∂u))=((∂f)/(∂x))((∂x)/(∂u))+((∂f)/(∂y))((∂y)/(∂u)) and ((∂f)/(∂v))=((∂f)/(∂x))((∂x)/(∂v))+((∂f)/(∂y))((∂y)/(∂v)).  Note that these formulas are easier to remember than they may look at first glance as they are simply adding up “fractions that look like they would cancel”.

The (first) partial derivatives represent the rate of change of the function in the direction of the variable only - so (Subscript[f, x])(x,y) is the rate of change of f(x,y) as x changes but y does not (and (Subscript[f, y])(x,y) is the rate of change for f(x,y) as y changes but x is held constant).  You can find the rates of change for f(x,y) in other directions as well, but that requires the idea of the gradient.

Gradients

If f is a multivariate function, the gradient of f (written ∇f) is the vector of first partial derivatives of f (with the derivatives in the same order in the vector as the variables appear in the function).  So if the function has the form f(x,y), the gradient of f is ∇f=<(Subscript[f, x]),(Subscript[f, y])>.  If the function has the form f(x,y,z), then the gradient has the form ∇f=<(Subscript[f, x]),(Subscript[f, y]),(Subscript[f, z])>. In essence the gradient measures how fast f is changing in all of the "main" directions.

Directional Derivatives

To find how fast f is changing in any direction (not just the main ones) you use the "directional derivative" of f.  If (OverVector[u]) is a unit vector (i.e. length 1), then the derivative of f in the direction of (OverVector[u]) (written as (Subscript[D, (OverVector[u])])f) is simply the dot product (∇f)·(OverVector[u]).   This is handy as when you need to find how fast is changing in several different directions, the gradient ∇f is only has to be computed one time (and then dotted against the different unit direction vectors).  Note that as a consequence of the dot product formula using the angle between two vectors the direction of greatest increase for a function f is the direction of  ∇f itself.

Applications of Partial Derivatives

Normal Lines and Tangent Planes

Suppose you have a surface in the space which is defined by the equation f(x,y,z)=0.  Then at any point ((Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])) on the surface, a vector which is perpendicular to the surface at that point (a “normal vector” at that point) is given by the gradient ∇f evaluated at the point ((Subscript[x, 0]),(Subscript[y, 0]),(Subscript[z, 0])).  Such a normal vector can be used as the direction vector for the “normal line” to the surface at that point (a line which passes through the point and is perpendicular to the surface there) and the normal vector for the tangent plane at that point.  For example consider the surface z=(x^2)y-(y^3) at the point (3,1,8).    If we rewrite the equation as f(x,y,z)=(x^2)y-(y^3)-z=0,  the gradient at any point is given by ∇f=<(Subscript[f, x]),(Subscript[f, y,])(Subscript[f, z])> = <2x y,(x^2)-3(y^2),-1>.  At the point (3,1,8) this gives us a normal vector to the surface as (OverVector[N])=<2 3 1, (3^2)-3 (1^2),-1> = <6,6,-1>.  So the normal line to the surface at (3,1,8) is given by <x,y,z> =<3,1,8>+t<6,6,-1> (or parametrically as x=3+6t, y=1+6t, z=8-t).  And the tangent plane to the surface is given by

({{({{<6,6,-1>·(<x,y,z>-<3,1,8>)=0 }, {<6,6,-1>·<x-3,y-1,z-8> = 0}, {6(x-3)+6(y-1)-1(z-8)=0}, {6x+6y-z-16=0}, {z=6x+6y-16}})}})

Multivariate Max-Min problems

Suppose that z=f(x,y) is twice differentiable (so all the second order partial derivatives (Subscript[f, x x]), (Subscript[f, y y]), (Subscript[f, x y]), and (Subscript[f, y x]) exist and are continuous).  If ((Subscript[x, 0]),(Subscript[y, 0])) is a local max or local min, then (Subscript[f, x])((Subscript[x, 0]),(Subscript[y, 0]))=0 and (Subscript[f, y])((Subscript[x, 0]),(Subscript[y, 0]))=0. So to locate potential local maxima and minima you solve the system (Subscript[f, x])=0 and (Subscript[f, y])=0 (this is two equations in two unknowns and so hopefully has a finite set of answers).  Just because (Subscript[f, x])=0 and (Subscript[f, y])=0 at ((Subscript[x, 0]),(Subscript[y, 0])) does not mean the point is a max or min however.  To check you apply the following test:

Let Δ be defined by the following 2 by 2 determinant:

({{({{Δ=|({{(Subscript[f, x x])((Subscript[x, 0]),(Subscript[y, 0])), (Subscript[f, x y])((Subscript[x, 0]),(Subscript[y, 0]))}, {(Subscript[f, x y])((Subscript[x, 0]),(Subscript[y, 0])), (Subscript[f, y y])((Subscript[x, 0]),(Subscript[y, 0]))}})|}})=(Subscript[f, x x])((Subscript[x, 0]),(Subscript[y, 0]))(Subscript[f, y y])((Subscript[x, 0]),(Subscript[y, 0]))-(((Subscript[f, x y])((Subscript[x, 0]),(Subscript[y, 0])))^2)}})

If Δ>0 and (Subscript[f, x x])((Subscript[x, 0]),(Subscript[y, 0]))>0, then the point is a local min.
If Δ>0 and (Subscript[f, x x])((Subscript[x, 0]),(Subscript[y, 0]))<0, then the point is a local max.
If Δ<0 then ((Subscript[x, 0]),(Subscript[y, 0])) is a “saddle point”.  This is neither a max nor min for the surface (but represents a max in one cross-section and a min in another cross-section, so the graph looks like a saddle there).
If Δ=0, this max-min test does not given any information.

In practice you tend to find Δ using the derivatives without the actual numbers (Subscript[x, 0]) ad (Subscript[y, 0]) plugged in - this way if there are multiple points to check you can find the general Δ formula just one time and then plug the different points into it.

Note that other potential maxima/minima can occur when the partial derivatives do not exist, but this is unlikely to show up on a timed exam.

As an example consider the surface z=f(x,y)=6 x y+(y^2)-(x^3).  We have (Subscript[f, x])=6y-3(x^2), (Subscript[f, y])=6x+2y, (Subscript[f, x x])=-6x, (Subscript[f, y y])=2, and (Subscript[f, x y])=6.  As these all exist the potential maxima and minima can happen when (Subscript[f, x])=6y-3(x^2)=0 and (Subscript[f, y])=6x+2y=0.  The second equation can be written as y=-3x; using that in the first equation yields -18x-3(x^2)=0, or -3x(x+6)=0.  So x=0,-6, and with y=-3x this becomes the points (0,0) and (-6,18).  Δ=(Subscript[f, x x])(Subscript[f, y y])-((Subscript[f, x y])^2)=(-6x)(2)-(((6))^2)=-12x-36.  At the point (0,0) we have Δ=-36, so (0,0) is a saddle point and is not a max or a min.  At the point (-6,18) we get Δ=36>0, and as at (-6,18) (Subscript[f, x x])=36>0 there must be a local min at (-6,18).

Double Integrals

If z=f(x,y) is a surface defined over a region R, then (Underscript[∫∫, R])f(x,y) dA is the net/signed volume under the surface over the region.  In many cases the idea is to compute the double integral as a nested integral ∫∫ f(x,y) dx dy (which means you integrate with respect to x first and then y) or  ∫∫ f(x,y) dy dx (where you integrate with respect to y first and then x).  To process the integral this way you need to break down the region R in one of two ways:

1) The points in the region have a leftmost/lowest/starting x-value a and a rightmost/highest/finishing x-value b; for each x-value c in between a and b the cross-section of the region always goes from one boundary curve y=g(x) to another boundary curve y=h(x).  In this case you process the double integral as

({{({{(∫_(x=a)^(x=b))(∫_(y=g(x))^(y=h(x)))f(x,y)dydx}})}})

doing the inside integral with respect to y first.

2) The points in the region have a lowest/bottom/starting y-value a and a highest/top/finishing y-value b; for each y-value c in between a and b the cross-section of the region always goes from one boundary curve x=g(y) to another boundary curve x=h(y).  In this case you process the double integral as

({{({{(∫_(y=a)^(y=b))(∫_(x=g(y))^(x=h(y)))f(x,y)dxdy}})}})

doing the inside integral with respect to x first.

As an example consider the double integral (Underscript[∫∫, R])6(x^2)y+12(y^2) dA , where R is the region bounded by the curves y=2x and y=(x^2):

Show[ RegionPlot[ {x^2≤y≤ 2x}, {x,-1,2.5}, {y,-1,4.5}, PlotPoints-> 100, BoundaryStyle->None, PlotStyle-> Opacity[.2]],Plot[ {x^2,2x}, {x,0,2}, PlotLegends->(Style[ #,"Text"]&/@{"y=(x^2) or x=(Sqrt[y])", "y=2x or x=(y/2)"}), PlotStyle-> {Black, Dashed}], Axes->True, Frame-> False, AxesLabel-> {x,y}, PlotRange-> {{-1,2.5}, {-1,4.5}}]

This region has corners (0,0) and (2,4) and is bounded above by y=2x and below by y=(x^2).

If we think of the cross-sections across the region as being vertical, the leftmost section is at x=0, the rightmost section is at x=2, and the cross-sections always extend from y=(x^2) upward to y=2x. So the integral would become

({{({{(∫_(x=0)^(x=2))(∫_(y=(x^2))^(y=2x))6(x^2)y+24ydydx}})=}, {(∫_(x=0)^(x=2))(3(x^2)(y^2)+12(y^2))|({{y=2x}, {y=(x^2)}})dx=}, {(∫_(x=0)^(x=2))((12(x^4)+48(x^2))-(3(x^6)+12(x^4)))dx=}, {(∫_(x=0)^(x=2)) 48(x^2)-3(x^6)dx=}, {16(x^3)-(3/7)(x^7)|({{x=2}, {x=0}})=(512/7)-0=(512/7)}})

If we think of the cross-sections across the region as being horizontal, the lowest cross-section is for y=0 and the highest is for y=4.  Each cross-section always extends rightward from x=(y/2) to x=(Sqrt[y]).  So the integral would become

({{({{(∫_(y=0)^(y=4))(∫_(x=y/2)^(x=(Sqrt[y])))6(x^2)y+24ydxdy}})=}, {(∫_(y=0)^(y=4))(2(x^3)y+24 x y)|({{x=(Sqrt[y])}, {x=y/2}})dy=}, {(∫_(y=0)^(y=4))( (2(y^(5/2))+24(y^(3/2)))-(((y^4)/4)+12(y^2)))dy=}, {(4/7)(y^(7/2))+(48/5)(y^(5/2))-((y^5)/20)-4(y^3)|({{y=4}, {y=0}})=(512/7)-0=(512/7)}})

The answer has to be the same no matter which way it is done.  In some cases the “order of integration” won’t matter much, and in some it will (either because cross-sections in one direction are nicer than in the other, the integral is easier to do in one order than the other, or the arithmetic is nicer in one order than the other).  A simple case is were the region R is a rectangle - in the case both the x- and y-limits will just go from one number to another which will simplify the integrals a lot.

Line Integrals and Green’s Theorem

Another type of multivariate integral is when you are integrating a function along a curve C (called a line integral).  The function being integrated in this kind of problem has both an x-component and a y-component, so the integral looks like

({{({{(∫_C)p(x,y)dx+q(x,y)dy}})}})

One common case is that the curve C is defined parametrically by x=f(t) and y=g(t), where t goes from a to b.  In this case you simply “plug in and use the chain rule” to get

({{({{({{(∫_C)p(x,y)dx+q(x,y)dy=}, {(∫_( a)^b) p(f(t),g(t))f'(t)+q(f(t),g(t))g'(t)dt}})}})}})

On a timed exam the curve C would have to be fairly simple, such as a line (where f(t) and g(t) are both linear and their derivatives are numbers) or a circle (in which case f(t) and g(t) involve a sine and a cosine). For example, suppose your curve C is the top half of the unit circle oriented counterclockwise:

ParametricPlot[ {Cos[t], Sin[t]}, {t,0,Pi}]/.Line[rest_]:>{Arrowheads[Table[0.05,{i,0,1,.1}]],Arrow[BSplineCurve@rest]}

This can be parameterized as x=cos(t), y=sin(t) as t goes from 0 to 2π.  To find (∫_C)(2x+y)dx+(5x+y)dy, we substitute in cosine for x, sine for y, (d/(dt))cos(t)=-sin(t) for dx, and (d/(dt))sin(t)=cos(t) for dy.  This gives us that:

({{(∫_C)(2x+y)dx+(5x+y)dy=}, {(∫_( 0)^( π))(2cos(t)+sin(t))(-sin(t))+(5cos(t)+sin(t))cos(t)dt=}, {(∫_( 0)^( π))5(cos^2)(t)-(sin^2)(t)-sin(t)cos(t)dt=}, {(∫_( 0)^( π))(5/2)(1+cos(2t))-(1/2)(1-cos(2t))-(1/2)sin(2t)dt=}, {(∫_( 0)^( π))2+3cos(2t)-(1/2)sin(2t)dt=}, {(2t+(3/2)sin(2t)+(1/4)cos(2t))|({{π}, {0}})=}, {(2π+0+(1/4))-(0+0+(1/4))=2π}})

A common simple case where the curve C is piecewise smooth, forms a simple loop, this loop encloses a region R counter-clockwise, and the loop is sketched out just once  at t goes from a to b.  In this case Green's Theorem lets you convert the line integral to a double integral as

({{(∫_C)p(x,y)dx+q(x,y)dy=}, {(Underscript[∫∫, R])((∂q)/(∂x))-((∂p)/(∂y))dA}})

The double integral is often significantly easier to do than the line integral as the curve C may be made up of several separately-defined pieces (which means the line integral has to be broken up into several pieces) or C might be hard to parameterize.  For example suppose the curve C goes around a rectangle of height 1 and width 2 with a corner at the origin:

Show[ Graphics[ {Thick,Arrowheads[Large],Arrow[ {{0,0}, {2,0}}], Arrow[ {{2,0}, {2,1}}], Arrow[ {{2,1}, {0,1}}], Arrow[ {{0,1}, {0,0}}]}], Axes->True, PlotRange-> {{0,2}, {0,1}}, AxesLabel-> {x,y}]

We can look at the line integral ({{(∫_C)(x+(y^2))dx+((x^3)-2y)dy}}).  To do this as a line integral would require us to break up the curve into its 4 pieces, parameterize each piece, and then add up the results.  However as the curve is piecewise smooth and encloses a region R (the rectangle) just once in a counterclockwise fashion, we can convert this to a single double integral using Green’s theorem.  As p(x,y)=x+(y^2) and q(x,y)=(x^3)-2y, we have ((∂q)/(∂x))=3(x^2) and ((∂p)/(∂y))=2y. So if R is the rectangle [0,2]×[0,1], we have

({{({{(∫_C)(x+(y^2))dx+((x^3)-2y)dy=}, {(Underscript[∫∫, R])((∂q)/(∂x))-((∂p)/(∂y))dA=(Underscript[∫∫, R])(3(x^2)-2y)dA=}, {(∫_(x=0)^(x=2))(∫_(y=0)^(y=1)) 3(x^2)-2y dy dx =}, {(∫_(x=0)^(x=2))(3(x^2)y-(y^2))|({{y=1}, {y=0}})dx =}, {(∫_(x=0)^(x=2))(3(x^2)-1)-(0-0)dx=}, {(∫_(x=0)^(x=2))  3(x^2)-1dx=}, {(x^3)-x|({{x=2}, {x=0}})=((2^3)-2)-(0-0)=6}})}})