BetaFree coursewareRewritten from MIT OpenCourseWareCC BY-NC-SA 4.0
Open CosmologyPhysics & cosmology, from high school to a graduate year

Functions of two variables and partial derivatives

A function of two variables, f(x, y), can be pictured by its graph, the surface z = f(x, y), found slice by slice, or by a contour plot: its level curves f(x, y) = c, the graph sliced by horizontal planes, like a topographic map. Close contours mean a steep graph. The partial derivative ∂f/∂x is the rate of change of f when only x changes: the slope of the slice y = constant. To compute it, treat y as a constant; for f = x³y + y², f_x = 3x²y and f_y = x³ + 2y.

You need this first

Full reading path (7 pages)
  1. Vectors (8.01)
  2. Vectors and the dot product (18.02)
  3. Determinants and the cross product (18.02)
  4. Planes through three points, and matrices (18.02)
  5. Equations of planes and square systems (18.02)
  6. Parametric equations of lines and the cycloid (18.02)
  7. Velocity, acceleration and Kepler's second law (18.02)
On this page · 6 sections
  1. Functions of two variables
  2. The graph
  3. Contour plots
  4. Reading changes from a contour plot
  5. Partial derivatives
  6. Summary

So far the course has done geometry in space: vectors, planes, motions. Calculus is about functions, and the next unit, about three weeks, studies functions of several variables and their derivatives (transcript, p. 1).

Functions of two variables#

A function of two variables gives a number f(x,y)f(x, y) for each pair of values xx, yy, for example f(x,y)=x2+y2f(x, y) = x^2 + y^2 (transcript, p. 1). Like functions of one variable, some are only defined on part of the plane: y\sqrt y needs y≥0y \ge 0, 1/(x+y)1/(x + y) needs x+y≠0x + y \ne 0 (p. 1). Real-world examples depend on more variables still: the temperature at a place depends on longitude and latitude, on elevation, and on time (p. 1). The course mostly uses two or three variables, because they can be pictured, but the tools (partial derivatives, the gradient) work the same in any number (p. 1).

The graph#

The graph of ff is the surface z=f(x,y)z = f(x, y): above each point (x,y)(x, y) of the plane, the point at height f(x,y)f(x, y) (transcript, p. 1; notes, p. 1). To draw it by hand, slice it with coordinate planes (p. 1; notes, p. 1).

  • f(x,y)=−yf(x, y) = -y: the graph z=−yz = -y is a plane. In the yzyz-plane it is a line going down with slope 1, and changing xx changes nothing, so the plane contains the xx-axis (p. 1).
  • f(x,y)=1−x2−y2f(x, y) = 1 - x^2 - y^2: the slice x=0x = 0 is the downward parabola z=1−y2z = 1 - y^2, the slice y=0y = 0 is z=1−x2z = 1 - x^2, and the graph meets the xyxy-plane where x2+y2=1x^2 + y^2 = 1, the unit circle. It is a surface of revolution about the zz-axis, a dome (pp. 1–2).

On a computer, z=x2+y2z = x^2 + y^2 is the same shape opening upwards, a bowl, and z=y2−x2z = y^2 - x^2 is a saddle: an upward parabola in the yzyz-plane and a downward one in the xzxz-plane (p. 2; notes, p. 1). But pictures of surfaces are hard to draw and to read (p. 2).

Contour plots#

A contour plot is a map instead: it draws in the xyxy-plane the level curves where ff takes fixed values, usually evenly spaced (transcript, p. 2; notes, p. 1):

Level curve
f(x,y)=cf(x, y) = c
In words

f(x, y) equals c

Source: 18.02 lecture summaries, Week 4 (Prof. Auroux), Lecture 8, p. 1, Lecture 8, p. 1

It is the graph sliced by the horizontal planes z=cz = c, with all slices pressed flat onto one map (p. 2). Walking along a level curve keeps your height constant, which is exactly what a topographic map shows; a coloured temperature map works the same way, with the boundaries between colours as level curves (p. 2; notes, p. 1). Reading the value of ff at a point from the nearby curves is much faster than from a graph (p. 2).

The two examples again (pp. 2–3; notes, p. 1):

  • f=−yf = -y: the level curve f=cf = c is the horizontal line y=−cy = -c. The lines are evenly spaced, because ff changes at a constant rate as yy changes, and nothing happens along xx (p. 2).
  • f=1−(x2+y2)f = 1 - (x^2 + y^2): the level 00 is the unit circle, the level 11 is the single point at the origin, the level −1-1 the circle of radius 2≈1.4\sqrt 2 \approx 1.4, the level −2-2 radius 3≈1.7\sqrt 3 \approx 1.7, the level −3-3 radius 2 (p. 3). Concentric circles show a surface of revolution, and circles getting closer together show it getting steeper: the top is flat, the sides steep (p. 3).
Contour plot of f(x,y)=1−x2−y2f(x, y) = 1 - x^2 - y^2, computed from the level curves x2+y2=1−cx^2 + y^2 = 1 - c: circles of radius 1, 2\sqrt{2}, 3\sqrt{3} and 2 for f=0,−1,−2,−3f = 0, -1, -2, -3. The value of ff drops by 1 from each circle to the next, and the circles crowd together as the dome gets steeper.

The contour plot of x2+y2x^2 + y^2 looks the same; only the labels show that it increases outwards (p. 3). For y2−x2y^2 - x^2 the level 00 is the two diagonal lines y=±xy = \pm x, crossing at the saddle point like the paths that stay level through a mountain pass (p. 3).

Reading changes from a contour plot#

Moving east–west on the map changes xx, moving north–south changes yy. A contour plot shows at once whether ff increases or decreases (transcript, p. 3; notes, p. 1). In the lecture's sketch, at a point (x0,y0)(x_0, y_0) on the level f=1f = 1 with the level 22 to the right and above, increasing xx (or yy) increases ff, and decreasing it decreases ff (p. 3). To say how fast ff changes, we need derivatives (p. 3).

Partial derivatives#

For a function of one variable, f′(x)=df/dxf'(x) = df/dx is the limit of Δf/Δx\Delta f/\Delta x, the slope of the tangent line to the graph, and it gives the approximation f(x)≈f(x0)+f′(x0)(x−x0)f(x) \approx f(x_0) + f'(x_0)(x - x_0) (transcript, p. 3). With two variables we can change xx, or yy, or both, and ff responds differently to each. So there is one derivative per variable, written with the curly ∂\partial ("partial"), not dd and not Δ\Delta (pp. 3–4; notes, p. 1):

Partial derivative in x
∂f∂x(x0,y0)=lim⁡Δx→0f(x0+Δx,y0)−f(x0,y0)Δx\frac{\partial f}{\partial x}(x_0, y_0) = \lim_{\Delta x \to 0} \frac{f(x_0 + \Delta x, y_0) - f(x_0, y_0)}{\Delta x}
In words

partial f over partial x, times ( x nought, y nought ) equals the limit as capital delta x goes to 0 of the quantity f of the quantity x nought plus capital delta x, y nought, minus f( x nought, y nought ), all over the quantity capital delta x

yy does not change at all; ∂f/∂y\partial f/\partial y is defined the same way with xx fixed and yy changing (p. 4). The function is differentiable when these exist, which is the case for most functions in the course (p. 4).

Geometrically, fixing y=y0y = y_0 slices the graph by a vertical plane parallel to the xzxz-plane. The slice is a curve, and ∂f/∂x\partial f/\partial x is the slope of its tangent line; ∂f/∂y\partial f/\partial y is the slope of the slice x=x0x = x_0 (p. 4; notes, p. 1).

The slice y=0.5y = 0.5 of the dome z=1−x2−y2z = 1 - x^2 - y^2 is z=0.75−x2z = 0.75 - x^2, computed from the formula. Its tangent line at x0x_0 has slope ∂f/∂x=−2x0\partial f/\partial x = -2x_0: zero at the top, and steeper further out.

To compute, treat yy as a constant and differentiate in xx; for fyf_y the other way round. The notations ∂f/∂x\partial f/\partial x and fxf_x mean the same (p. 4; notes, p. 1). The lecture's example (p. 4; notes, p. 1):

An example
f(x,y)=x3y+y2:fx=3x2y,fy=x3+2yf(x, y) = x^3 y + y^2: \qquad f_x = 3x^2 y, \qquad f_y = x^3 + 2y
In words

f(x, y) equals x cubed y plus y squared : f sub x equals 3 x squared y, f sub y equals x cubed plus 2 y

In fxf_x, x3x^3 times the constant yy gives 3x2y3x^2 y, and y2y^2 is a constant with derivative 0; in fyf_y, x3x^3 is the constant factor (p. 4).

Worked example

Partial derivatives and a first estimate

Let f(x,y)=x2y+3y2f(x, y) = x^2 y + 3y^2. (a) Find fxf_x and fyf_y at (1,2)(1, 2). (b) Estimate f(1.1,2)f(1.1, 2) from fxf_x, and compare with the exact value. (c) Describe the level curve f=14f = 14 near (1,2)(1, 2): if xx increases a little, must yy increase or decrease to stay on it?

(a) Treat the other variable as a constant

fx=2xyf_x = 2xy, which is 2⋅1⋅2=42 \cdot 1 \cdot 2 = 4 at (1,2)(1, 2). fy=x2+6yf_y = x^2 + 6y, which is 1+12=131 + 12 = 13. And f(1,2)=2+12=14f(1, 2) = 2 + 12 = 14.

(b) Change only x

Moving Δx=0.1\Delta x = 0.1 with yy fixed, ff changes by about fx Δx=4×0.1=0.4f_x\,\Delta x = 4 \times 0.1 = 0.4: f(1.1,2)≈14.4f(1.1, 2) \approx 14.4. Exactly, f(1.1,2)=1.21×2+12=14.42f(1.1, 2) = 1.21 \times 2 + 12 = 14.42.

(c) Staying on the level curve

Both partial derivatives are positive, so increasing xx raises ff and increasing yy raises it too. To keep f=14f = 14 when xx increases, yy must decrease: the level curve slopes downwards through (1,2)(1, 2), as in the lecture's sketch.

Summary#

  • A function of two variables can be pictured by its graph z=f(x,y)z = f(x, y), drawn slice by slice, or by its contour plot.
  • Level curves f(x,y)=cf(x, y) = c are horizontal slices of the graph; evenly spaced levels that crowd together mean a steep graph.
  • The partial derivative ∂f/∂x=fx\partial f/\partial x = f_x is the rate of change of ff when only xx changes: the slope of the slice y=y0y = y_0. Likewise fyf_y.
  • To compute fxf_x, treat yy as a constant: for f=x3y+y2f = x^3 y + y^2, fx=3x2yf_x = 3x^2 y and fy=x3+2yf_y = x^3 + 2y.

Symbols on this page

Show the 21 symbols used here
Δ\Delta capital delta.
A change or difference in a quantity, e.g. Δx = x₂ − x₁. Say it: “capital delta”.
≈\approx approximately equal.
Is approximately equal to. Say it: “is approximately”.
≥\ge greater than or equal.
Is greater than or equal to. Say it: “is greater than or equal to”.
≠\neq not equal.
Is not equal to. Say it: “is not equal to”.
→\to arrow.
Goes to (tends to), or becomes. Say it: “goes to”.
±\pm plus or minus.
Plus or minus: both signs, or an uncertainty (67.3 ± 1.2). Say it: “plus or minus”.
×\times times.
Times (multiplication). Between two vectors: the cross product. Say it: “times”.
⋅\cdot dot.
Times (multiplication). Between two vectors: the dot product. Say it: “times”.
∂\partial partial.
Partial derivative: the rate of change with one variable, holding the others fixed. Say it: “partial”.
lim⁡\lim limit.
Limit: the value approached as the variable written below approaches its target. Say it: “the limit”.
zz z.
The height on the graph z = f(x, y). Say it: “z”.
cc c.
A constant value of f: the level of a level curve f(x, y) = c. Say it: “c”.
xx x.
The first variable of the function; on the graph, the x coordinate. Say it: “x”.
yy y.
The second variable of the function; on the graph, the y coordinate. Say it: “y”.
dd d.
The d of an ordinary derivative, df/dx. Say it: “d”.
ff f.
A function of two variables, f(x, y) (or, for comparison, of one variable). Say it: “f”.
f′f' f prime.
The derivative of a function of one variable, df/dx. Say it: “f prime”.
x0x_{0} x nought.
The x coordinate of the point where a derivative is taken. Say it: “x nought”.
y0y_{0} y nought.
The y coordinate of the point where a derivative is taken. Say it: “y nought”.
fxf_{x} f sub x.
The partial derivative ∂f/∂x: the rate of change of f when only x changes. Say it: “f sub x”.
fyf_{y} f sub y.
The partial derivative ∂f/∂y: the rate of change of f when only y changes. Say it: “f sub y”.

Tap or click a symbol in a formula to see the same explanation. All symbols: symbols and notation.

Words on this page

Show the 25 words used here

New here

partial derivative.
The rate of change of a function of several variables with respect to one of them, while all the others are held fixed.
saddle point.
A point where a surface rises in some directions and falls in others, like the middle of a horse's saddle or a mountain pass.
level curve.
A curve along which a function of two variables keeps the same value, like a line of equal height on a map.

Also used

vector.
A quantity with both a size and a direction, such as a velocity or a force, drawn as an arrow. Explained in Vectors.
derivative.
The rate at which a function changes as its input changes: the slope of its graph at a point. Explained in Position and velocity in one dimension.
p..
Page, in a reference to a source; pp. means pages, as in pp. 3–5.
gradient.
The vector of a function's partial derivatives; it points the way the function increases fastest, and its length is that fastest rate. Explained in Graphs, straight lines and slope.
graph.
The picture of a function: the curve y = f(x) for one variable, or the surface z = f(x, y) for two. Explained in Graphs, straight lines and slope.
parabola.
The U-shaped curve of y = ax² + bx + c, also the path of a thrown ball when air resistance is ignored. Explained in Quadratics and power laws.
unit circle.
The circle of radius 1 centred at the origin; the point at angle θ on it is (cos θ, sin θ). Explained in Angles, radians and trigonometry.
contour map.
A flat map of a function of two variables, drawing the curves along which it keeps one value, like height lines on a hiking map. Explained in Fields: scalar, vector, gravitational and electric.
limit.
The value a quantity gets closer and closer to, as near as we like, as its input approaches some value, without having to reach it. Explained in Rates of change and area under a graph.
tangent.
A straight line that touches a curve at a point and runs in the same direction as the curve there. Explained in Angles, radians and trigonometry.
differentiable.
Having a derivative: at that point the graph has a single, definite, non-vertical tangent line, with no corner or break. Explained in The mean value theorem and inequalities.
differentiation.
Finding a derivative: working out how fast a function changes. Explained in The derivative: slope of the tangent line and rate of change.
cosmic microwave background.
The faint glow of microwaves filling the universe, left over from when it was hot and dense, now at 2.7 kelvin. Explained in Towards the universe: light-travel time and looking back in time.
horizon problem.
The puzzle of why the cosmic microwave background has the same temperature in all directions, though those regions were never in contact. Explained in Inflation.
spectrum.
The spread of light or other radiation over its wavelengths, or the full set of values a quantity such as energy can take. Explained in Light and the electromagnetic spectrum.
CMB.
Short for cosmic microwave background, the leftover radiation from the hot early universe. Explained in The spectrum of the cosmic microwave background.
rate of change.
How fast one quantity changes compared with another, often time: the change in the first divided by the change in the second. Explained in Rates of change and area under a graph.

Academic

transcript.
A written record of exactly what was said in a recorded lecture, word for word.
by hand.
Worked out with pen and paper, without a computer; or put in deliberately rather than following from the theory.
approximation.
Close to, but not exactly, the true value; an approximation is such a value or formula, chosen because it is simpler.
notation.
A system of symbols used to write ideas down briefly, such as dy/dx for a derivative.
likewise.
In the same way; similarly.

Tap or click a word, here or in the text, for its meaning in this lesson. All words: the glossary. How many words are marked in the text: Reading options (the “Aa” button).

Where this leads

In cosmology

35 more cosmology pages that build on this

Pages that build on this

Practise

Check your understanding

  1. For f(x,y)=x2y+5yf(x, y) = x^2 y + 5y, ∂f/∂x=\partial f/\partial x =
  2. For the same ff, ∂f/∂y=\partial f/\partial y =
  3. On a contour plot, level curves that crowd together mean…
  4. The level curves of f(x,y)=x2+y2f(x, y) = x^2 + y^2 are…
0 of 4 answered

Flashcards

1 / 3