Teaching Notes · Math for Social Sciences

Math for Social Sciences

Functions of Two Variables and Partial Derivatives

Almost nothing a real business actually tracks depends on just one variable. Cost depends on how many units of two different products get made; revenue depends on two separate prices set for two separate goods. This set of notes extends everything built so far, the derivative, the rules for finding it, the method for optimizing it, to functions of two variables at once, starting with how to differentiate one and ending with how to find its maximum, minimum, or something in between.

A function of two variables

A function of two variables assigns a single output to every pair of inputs (x, y), written z = f(x, y). For f(x, y) = x² − 3xy, evaluating at (2, 1) gives f(2, 1) = 2² − 3(2)(1) = 4 − 6 = −2, and at (5, 3) gives f(5, 3) = 5² − 3(5)(3) = 25 − 45 = −20, each pair of inputs producing exactly one output, the same rule a function of one variable follows, just with an extra input to track.

Partial derivatives: holding one variable still

The core trick for differentiating a function of two variables is to treat one variable as a constant while differentiating with respect to the other. The partial derivative of z = f(x, y) with respect to x, written ∂z/∂x or fx, holds y fixed and measures the rate of change in the x direction alone; the partial derivative with respect to y, ∂z/∂y or fy, does the reverse. For f(x, y) = 4x² − xy² + 2y² + 8, holding y constant and differentiating with respect to x gives fx = 8x − y²; holding x constant and differentiating with respect to y gives fy = −2xy + 4y.

A business example shows the two partial derivatives acting as two separate marginal costs at once. A company produces x mountain bikes and y racing bikes at a joint cost of C = 10√(xy) + 149x + 189y + 657. The two partial derivatives are ∂C/∂x = 5√(y/x) + 149 and ∂C/∂y = 5√(x/y) + 189, each one the marginal cost of one product while the output of the other stays fixed. At a production level of 120 mountain bikes and 180 racing bikes, these work out to roughly 155.1 for ∂C/∂x and roughly 193.1 for ∂C/∂y, two different marginal costs read off the same joint cost function, one for each product line.

Higher order partial derivatives

Just as with a function of one variable, a partial derivative can itself be differentiated again, and with two variables there are four second order partials to consider: fxx (differentiate with respect to x twice), fyy (with respect to y twice), and the two mixed partials fxy and fyx (differentiate with respect to one variable, then the other). For f(x, y) = 3xy² − 2y + 5x²y², the first partials are fx = 3y² + 10xy² and fy = 6xy − 2 + 10x²y. Differentiating each again gives fxx = 10y², fyy = 6x + 10x², and both mixed partials come out identical, fxy = fyx = 6y + 20xy, a pattern that holds for essentially every function encountered in a course at this level: the order in which the two variables are differentiated does not change the result.

Relative extrema in two dimensions

With one variable, a relative maximum or minimum was found by locating where the derivative was zero or undefined, then checking its sign on either side. With two variables, the idea is the same in spirit but needs both partial derivatives to agree. A point (x₀, y₀) is a critical point of f if fx or fy is undefined there, or if both fx(x₀, y₀) = 0 and fy(x₀, y₀) = 0 at once, meaning the function is momentarily flat in both directions.

Classifying a critical point once it is found uses what is called the second partials test. Compute the quantity

D = fxx(a, b)·fyy(a, b) − [fxy(a, b)]²

at the critical point (a, b). If D > 0 and fxx(a, b) > 0, the point is a relative minimum. If D > 0 and fxx(a, b) < 0, it is a relative maximum. If D < 0, the point is neither a maximum nor a minimum but a saddle point, where the function rises in one direction and falls in another, the two dimensional equivalent of a mountain pass. If D = 0, the test cannot decide either way.

D > 0, f_xx > 0 relative minimum D > 0, f_xx < 0 relative maximum D < 0 saddle point
Figure. The three outcomes of the second partials test, read as cross sections through a critical point: curving up in every direction is a relative minimum, curving down in every direction is a relative maximum, and curving up one way while curving down another is a saddle point.

For f(x, y) = 2x² + y² + 8x − 6y + 20, the first partials are fx = 4x + 8 and fy = 2y − 6, which are both zero exactly at (−2, 3), the only critical point. The second partials are fxx = 4, fyy = 2, and fxy = 0, giving D = (4)(2) − 0 = 8, which is positive, and since fxx = 4 is also positive, the point (−2, 3) is a relative minimum.

A business application: pricing two competing products

A company manufactures two competing products priced at p1 and p2, and models its total revenue as

R = 500p1 + 800p2 + 1.5p1p2 − 1.5p1² − p2²

The two partial derivatives are Rp1 = 500 + 1.5p2 − 3p1 and Rp2 = 800 + 1.5p1 − 2p2. Setting both to zero and solving the two equations together gives a single critical point at p1 = 586.67 and p2 = 840. The second partials are Rp1p1 = −3, Rp2p2 = −2, and Rp1p2 = 1.5, giving D = (−3)(−2) − (1.5)² = 6 − 2.25 = 3.75, which is positive, and since Rp1p1 = −3 is negative, this critical point is a relative maximum. Revenue is maximized, in other words, at a price of about 586.67 for the first product and 840 for the second, a pricing decision across two products reached the same way a single price would be reached with one variable, just with two partial derivatives doing the work instead of one ordinary derivative.

The second partials test is the natural stopping point for this introduction to functions of two variables, but the underlying idea reaches much further than this course goes: almost every serious optimization problem in business, from staffing across multiple shifts to pricing across multiple markets, is really this same test applied to a function of many more than two variables at once.

Source: lecture notes for an introductory calculus course for the social sciences, covering functions of two variables, partial differentiation, higher order partial derivatives, relative extrema, critical points, and the second partials test.

Keywords: functions of two variables partial derivatives second partials test relative extrema critical points saddle point calculus higher order partial derivatives