Multivariable Calculus
Multivariable Calculus
Karthik Thiagarajan
Open ball
A concept that we will use in the rest of the document is that of an open ball. An
open ball centered at a point (a, b) with radius r is the following set:
(x, y) : (x - a) 2 + (y - b) 2 < r 2
In simple terms, it is the set of all points within the circle centered at (a, b) with
radius r. Note that the boundary is not a part of an open ball. Visually:
Definition
Consider a function f : D → R where D ⊂ R 2 . Let (a, b) ∈ D. The limit of f at
(a, b) exists if there exists a real number L such that:
(a n , b n ) → (a, b) ⟹ f(a n , b n ) → L
For simple functions, we can just substitute the value (a, b) into the function to get the
limit. For instance:
This method of substituting the value is not foolproof. There is a useful theorem that
can be used to show the non-existence of limits:
Theorem
The limit of a function f at (a, b) exists and is equal to L if for every curve C in the
domain D of f passing through (a, b), the limit of f along C is exists and is equal to
L.
x2 - y2
lim
(x,y) → (0,0) x2 + y2
The limit along the x-axis is 1 and the limit along the y-axis is -1. Since we have two
different limits along the two curves, the limit doesn't exist.
• lim (fg)(x, y) = FG
(x,y) → (a,b)
f(x, y) F
• lim = , provided G ≠ 0 and g is defined in a small interval
g(x, y)
(x,y) → (a,b) G
around (a, b).
2.3.2. Composition
Let f be a multivariable function and g be a single variable function such that g ∘ f is
defined. If lim f(x, y) = F and lim g(x) = L, then:
(x,y) → (a,b) x→F
lim (g ∘ f)(x, y) = L
(x,y) → (a,b)
2.4. Continuity
A function f is continuous at the point (a, b) in its domain if the limit at the point
exists and is equal to the value of the function at that point. That is:
3. Derivatives
f(a + h, b) - f(a, b)
f x (a, b) = lim
h→0 h
f(a, b + h) - f(a, b)
f y (a, b) = lim
h→0 h
( 1 + h) 2 + 2 2 - 1 2 + 2 2
f x (1, 2) = lim
h→0 h
( 1 + h) 2 - 1
= lim
h→0 h
h( 2 + h)
= lim
h→0 h
=2
f x (a, b) can be viewed as the instantaneous rate of change of f at (a, b) along the x-
axis. A similar idea holds for f y (a, b). The partial derivatives are themselves functions
of (x, y). We denote this as f x (x, y) and f y (x, y). To compute the partial derivative
with respect to x, we can view f as function of x while y remains constant, and
differentiate with respect to x. For example, if f(x, y) = x 2 + y 2 , f x (x, y) = 2x and
f y (x, y) = 2y.
3.2. Gradient
The partial derivatives can be clubbed together into a vector called the gradient:
f x (x, y)
∇f(x, y) =
f y (x, y)
2x
For example, if f(x, y) = x 2 + y 2 , ∇f(x, y) = .
2y
f(a + hu 1 , b + hu 2 ) - f(a, b)
f u (a, b) = lim
h→0 h
f(x + hu 1 , y + hu 2 ) - f(x, y)
f u (x, y) = lim
h→0 h
(x + hu 1 )(y + hu 2 ) - xy
= lim
h→0 h
xy + xhu 2 + yhu 1 + h 2 u 1 u 2 - xy
= lim
h→0 h
= yu 1 + xu 2
Theorem
If the partial derivatives are continuous in an open ball centered at (a, b), the
directional derivative at (a, b) is defined for all directions. For any direction given by
the unit vector u = (u 1 , u 2 ), the directional derivative is given by:
f u (a, b) = ∇f(a, b) T u
u1
f u (x, y) = ∇f(x, y) T
u2
u1
= y x
u2
= yu 1 + xu 2
f u (a, b) = ∇f(a, b) T u
The maximum and minimum values of f u (a, b) occur when 𝜃 = 0 and 𝜃 = 180 ∘
respectively. If 𝜃 = 90 ∘ , then the directional derivative is zero. Therefore:
∇f(a, b)
• The direction of steepest ascent of the function at (a, b) is .
||∇f(a, b)||
-∇f(a, b)
• The direction of steepest descent of the function at (a, b) is .
||∇f(a, b)||
• The direction in which the function's value doesn't change at (a, b) is orthogonal
to ∇f(a, b).
Note that all these are local phenomenon. When we talk about the direction of steepest
ascent at a point (a, b), we are only concerned about the function's behavior in the
immediate vicinity of (a, b).
∂ ∂f ∂2f
f x x = (f x ) x = =
∂x ∂x ∂x 2
∂ ∂f ∂2f
f yy = (f y ) y = =
∂y ∂y ∂y 2
∂ ∂f ∂2f
f xy = (f x ) y = =
∂y ∂x ∂y∂x
∂ ∂f ∂2f
f yx = (f y ) x = =
∂x ∂y ∂x∂y
Theorem
Let f be a function defined on a domain D with a point (a, b) and an open ball
around it contained in D. If the second order partial derivatives are continuous in an
open ball around (a, b), then f xy (a, b) = f yx (a, b).
All the second order partial derivatives can be collected in a matrix termed the Hessian
matrix:
f xx f xy
H=
f yx f yy
If the theorem above holds, H is a symmetric matrix. For a function of three variables,
the Hessian will be a square matrix of order three:
f xx f xy f xz
H = f yx f yy f yz
f zx f zy f zz
Question
Find all partial derivatives up to order 2 at (0, 0).
xy x 2 - y 2
f(x, y) = 2 2
, (x, y) ≠ (0, 0)
x +y
0, (x, y) = (0, 0)
f(h, 0) - f(0, 0)
f x (0, 0) = lim =0
h→0 h
f(0, h) - f(0, 0)
f y (0, 0) = lim =0
h→0 h
x2 + y2 3x 2 y - y 3 - 2x 2 y x 2 - y 2
f x (x, y) = 2
x2 + y2
x 4 y + 4x 2 y 3 - y 5
= 2
2 2
x2 + y2
Therefore:
y x 4 + 4x 2 y 2 - y 4
, (x, y) ≠ (0, 0)
f x (x, y) = 2
x2 + y2
0, (x, y) = (0, 0)
f x (h, 0) - f x (0, 0)
f xx (0, 0) = lim =0
h→0 h
f x (0, h) - f x (0, 0) -h 5
f xy (0, 0) = lim = lim 5
= -1
h→0 h h→0 h
x x 4 - 4x 2 y 2 - y 4
, (x, y) ≠ (0, 0)
f y (x, y) = 2 2
x2 + y
0, (x, y) = (0, 0)
During the live session, there was a mistake in the expression for f y (x, y). This is
what was being attempted. One way to quickly compute f y (x, y) is to note the
following relationship:
f(x, y) = -f(y, x)
⟹ f y (x, y) = -f y (y, x)
f y (y, x) is the partial derivative of f with respect to the first variable. Therefore,
this is the same as partial derivative of f(x, y) with respect to x, and then
swapping the variables x and y. Therefore, we have f y (y, x) = f x (y, x). This
gives us:
f y (x, y) = - f x (y, x)
f y ( , y) f x (y, )
4. Tangents
For all subsections, consider a function f defined on a domain D ⊂ R 2 that has
continuous partial derivatives in an open ball centered at the point (a, b) ∈ D. The
existence of continuous partial derivatives implies that the directional derivative exists in
all directions and is given by:
f u (a, b) = ∇f(a, b) T u
Form-1
(a, b, f(a, b)) + t(u 1 , u 2 , f u (a, b))
Form-2
x = a + tu 1
y = b + tu 2
z = f(a, b) + tf u (a, b)
Form-3
x-a y-b z - f(a, b)
= =
u1 u2 f u (a, b)
1 1
(1, 3, f(1, 3)) + t , , f u (1, 3)
2 2
1/ 2 4
f u (1, 3) = 3 1 =
1/ 2 2
1 1
The tangent line at the point (1, 3) to f in the direction , is given by:
2 2
1 1 4
(1, 3, 3) + t , ,
2 2 2
Alternatively:
t
x = 1+
2
t
y = 3+
2
4t
z = 3+
2
Alternatively:
Form-1
z = f(a, b) + f x (a, b)(x - a) + f y (a, b)(y - b)
Form-2
Form-3
x-a
z = f(a, b) + ∇f(a, b) T
y-b
(-2x) -x -1 -1
fx = = = =
2 9 - x2 - y2 9 - x2 - y2 2 2
(-2y) -y -2
fy = = = = -1
2 9 - x2 - y2 9 - x2 - y2 2
-1
z-2 = (x - 1 ) - (y - 2 )
2
x + 2y + 2z = 9
x-a
L f (x, y)| (a,b) = f(a, b) + ∇f(a, b) T
y-b
Expanding it, we get:
x-a
L f (x, y)| (0,0) = f(a, b) + ∇f(a, b) T
y-b
f(0, 0) = 0
e x (sin y + x + 1) 1
∇f(x, y) = =
e x cos y 1
5. Differentiability
Consider a function f defined on a domain D ⊂ R 2 . Let f x and f y be defined at
(a, b) ∈ D. Then, f is differentiable at (a, b) ∈ D if:
Intuitively, this means that very close to the point (a, b) f looks like a plane (behaves
like a linear function).
Theorem
If the partial derivatives exist in an open ball at (a, b) and are continuous, then f is
differentiable at (a, b).
6. Optimization
Consider a function defined over D ⊂ R 2 and a point (a, b) ∈ D with an open ball
centered at (a, b) that is contained in D.
• A point (a, b) is called a local minimum of f if f(x, y) ⩾ f(a, b) for all (x, y) in
an open ball centered at (a, b).
• A point (a, b) is called a local maximum of f if f(x, y) ⩽ f(a, b) for all (x, y) in
an open ball centered at (a, b).
• A point (a, b) is called a absolute minimum of f if f(x, y) ⩾ f(a, b) for all (x, y)
in the domain of f.
• A point (a, b) is called a absolute maximum of f if f(x, y) ⩽ f(a, b) for all
(x, y) in the domain of f.
f x (x, y) = 2x + 6y + 2 = 0
⟹ (x, y) = (2, -1)
f y (x, y) = 8y + 6x - 4 = 0
(2, -1) is a critical point of f.
Theorem
If a point (a, b) is a local extremum, then ∇f(a, b) = 0.
To see why this is true, consider what happens if ∇f(a, b) ≠ 0. The function's value
would increase along the direction ∇f(a, b) and decrease along -∇f(a, b) suggesting
that (a, b) is not an extremum. This is a loose argument. For a more concrete
argument, consider the slice of the function along y = b and note that for the
corresponding single variable function in terms of x, x = a is an extremum, which
implies that f x (a, b) = 0.
Every local extremum is a critical point. All critical points are not local extrema. A
point which is a critical point but not a local extremum is called a saddle point. An
example is the function f(x, y) = xy. This function has a critical point at (0, 0), but
this is neither a local maximum nor a local minimum. The function has a minimum
along y = x and a maximum along y = -x.
{(x, y) : 0 ⩽ x ⩽ 2, 0 ⩽ y ⩽ 2 }
An example of a domain that is bounded but not closed is a square that doesn't contain
its boundary:
Visually:
Open, Bounded Closed, Bounded
Theorem
Consider a continuous function f on a domain D that is closed and bounded. Then f
has a global maximum and global minimum on D.
Question
Find the global maximum and minimum of the function f(x, y) = x 2 + y 2 on the
closed triangular plate bounded by the lines x = 0, y = 0, y = 2x + 2 in the second
quadrant.
(0, 0) is the only critical point and is one of the candidates for global
maximum/minimum.
1
-2 -1 0 1 2 3 4
Boundary-1: x = 0
h(y) = f(0, y) = y 2
Boundary-2: y = 0
h(x) = f(x, 0) = x 2
Boundary-3: y = 2x + 2
Note that h is defined in the interval [-1, 0]. In this interval, the global maximum of
h can be a critical point or one of the boundary points.
-4
h′ (x) = 0 ⟹ 10x + 8 = 0 ⟹ x =
5
(a, b) f(a, b)
(0, 0) 0
(0, 2) 4
( )
(-1, 0) 1
(-4 / 5, 2 / 5) 4
5
Aside
f:D→R
f(x, y) = x 2 + y 2
-2 -1 0 1 2 3 4
f(0 + h, 0) - f(0, 0) h2 - 0
f x (0, 0) = lim = lim- =0
-
h→0 h h→0 h
f(0, 0 + h) - f(0, 0) h2 - 0
f y (0, 0) = lim = lim+ =0
+
h→0 h h→0 h
6.4. Hessian Test
The Hessian test can be used to determine the nature of the critical point. The test
may fail to be conclusive in certain situations.
2
• If |H| > 0, f xx > 0 and f xx f yy - f xy > 0, then (a, b, c) is a local minimum.
2
• If |H| < 0, f xx < 0 and f xx f yy - f xy > 0, then (a, b, c) is a local maximum.
• If |H| ≠ 0 and the above two cases do not occur, then (a, b, c) is a saddle point.
• If |H| = 0, the test is inconclusive.
Here |H| denotes the determinant of H. Visually, this test involves the determinants of
three matrices:
f xx f xy f xz f xx f xy f xz f xx f xy f xz
f yx f yy f yz , f yx f yy f yz , f yx f yy f yz
f zx f zy f zz f zx f zy f zz f zx f zy f zz
f xx 2 |H|
f xx f yy - f xy Outcome
+ + + Local minimum
- + - Local maximum
f x (x, y) = 3x 2 - 3 = 0
2
⟹ x = ± 1, y = 0, 2
f y (x, y) = 3y - 6y = 0
f xx = 6x f xy = 0
f yx = 0 f yy = 6y - 6
6x 0
H=
0 6y - 6