Multivariable Calculus Intro


Multivariable Calculus Intro

Michael
Alright Corey, you remember single variable calculus? We spent all that time on flatland — functions of one variable, slopes, areas under curves. Well, today we're leaving flatland behind and entering spaceland.

Corey
Spaceland? That sounds like a place where everything is three-dimensional. So we're talking about functions of two variables now, right? Like z = f(x,y)?

Michael
Exactly. And it's not just adding a variable — it's a whole new perspective. Instead of one slope, you have slopes in every direction. The big question becomes: which direction is the steepest uphill, and how steep is it?

Corey
So we need a compass. That's where the gradient comes in, right? It points in the direction of steepest ascent, and its magnitude tells you the slope.

Michael
Bingo. Let me give you an example. Say you're on a hill defined by h(x,y) = 100 - x² - 2y². At the point (1,1), your height is 97. The gradient is a vector of partial derivatives — treat one variable as constant and differentiate with respect to the other.

Corey
Right, partial derivatives. So ∂h/∂x = -2x, and ∂h/∂y = -4y. At (1,1), that gives us (-2, -4). That vector points steepest uphill, and its length is √(4+16) ≈ 4.47 — that's the slope. Awesome!

Michael
Now, what if your function has multiple inputs and multiple outputs? Like a robot arm where motor angles give hand coordinates. The derivative becomes a matrix called the Jacobian.

Corey
I've seen that in multivariable calculus. It's a matrix of all partial derivatives — each row corresponds to an output, each column to an input. It approximates how a small change in inputs changes the outputs.

Michael
Exactly. Here's a production example: inputs are steel (x) and plastic (y); outputs are cars (u) and toys (v). u = 2x + 0.5y, v = 0.1x + 3y. The Jacobian is [[2, 0.5], [0.1, 3]]. If you add 10 steel and 5 plastic, you get about 22.5 more cars and 16 more toys.

Corey
And that's the chain rule! If you then have profit P = 3000u + 500v, you multiply Jacobians to see how profit changes with inputs. That's actually backpropagation in neural networks — the algorithm that trains deep learning models.

Michael
You're spot on. Now, the first derivative gave us slopes, but to understand shape — concavity — we need the second derivative. In multiple dimensions, that's the Hessian matrix.

Corey
Right, the Hessian holds all second partials. It tells you if a critical point is a minimum, maximum, or saddle. For f(x,y)=x²+y², the Hessian at (0,0) is [[2,0],[0,2]] — both positive, so it's a valley.

Michael
And for f(x,y)=x²−y², the Hessian is [[2,0],[0,-2]] — opposite signs — that's a saddle point, like a Pringle chip. So the gradient finds flat spots, the Hessian classifies them.

Corey
So unconstrained optimization is straightforward: set gradient to zero, then use the second derivative test with the Hessian determinant. For example, profit function P = 1500 - (x-10)² - 3(y-25)² has critical point (10,25). Hessian diagonal: -2 and -6, determinant positive, and P_xx negative — that's a maximum.

Michael
But what if you have constraints? That's where Lagrange multipliers come in. You want to maximize area of a rectangular pen with a fixed perimeter of 24 meters. Objective f(x,y)=xy, constraint g(x,y)=x+y=12. The gradients must be parallel: ∇f = λ∇g.

Corey
So y = λ, x = λ, and x+y=12 gives x=y=6. Maximum area is 36 square meters. And λ=6 is the shadow price — how much extra area you get from one more meter of fence.

Michael
Now let's flip to integration. Single integrals give area under a curve; double integrals give volume under a surface. The idea is the same: slice into tiny pieces, multiply by height, sum up. For a square region with constant bounds, it's just iterated integrals.

Corey
For example, volume under z=4−x²−y² over [0,1]x[0,1]. Inner integral in x treats y constant: ∫(4−x²−y²)dx = 4x - x³/3 - y²x from 0 to 1 = 11/3 - y². Then integrate that in y: ∫₀¹(11/3 - y²)dy = 11/3 y - y³/3 from 0 to 1 = 10/3. That's the volume.

Michael
Variable bounds are trickier. Suppose a triangular plate with density ρ=xy, bounded by x from 0 to 2 and y from 0 to x/2. The mass is ∫₀² ∫₀^{x/2} xy dy dx. Inner gives x³/8, outer gives x⁴/32 from 0 to 2 = 1/2.

Corey
And for circular regions, Cartesian coordinates are a nightmare. That's when we switch to polar coordinates. The Jacobian gives a correction factor: dx dy = r dr dθ. For the volume under z=9−x²−y² over a circle of radius 3, the integral becomes ∫₀²π ∫₀³ (9−r²) r dr dθ.

Michael
Inner integral: ∫₀³ (9r−r³) dr = (9r²/2 - r⁴/4) from 0 to 3 = 81/2 - 81/4 = 81/4. Then outer: ∫₀²π (81/4) dθ = (81/4)·2π = 81π/2. No square roots, no trig substitution — that's the power of the right coordinate system.

Corey
So we've covered gradient, Jacobian, Hessian, optimization, Lagrange multipliers, double integrals, and change of variables. That's the entire multivariable calculus toolkit in one conversation. It all connects.

Michael
Exactly. And you can apply it everywhere — from physics to economics to machine learning. Multivariable calculus really does click when you see how each piece builds on what you already knew. You've got the tools now.

Ask anything
We've read this whole study set, so questions about it get the best answers.