TL;DR
A multivariable function takes several numbers as input and returns a single number as output. Give it a position on a map and it can return the height of the ground there. Give it how many apples and pears you buy and it returns the total bill. The rule is still one rule; it just reads more than one input.
Where you'll see it: in cost and profit formulas with several choices, in height maps and temperature maps, and in the loss a neural network is trained to make small.
Intuition
One rule, several slots
A function of one variable is a machine with one slot. You feed in a number and it gives one back. A multivariable function is the same kind of machine with several slots, and it still gives back one number.
Take a shopping bill. Apples cost 2 each and pears cost 3 each. If you buy apples and pears, the total is . Two slots, one output.
flowchart LR A[apples a] --> F[rule] B[pears p] --> F F --> C[total bill]
Why it exists
Real quantities depend on several things at once. The temperature in a room depends on where you stand and when you measure. The height of a hill depends on how far east and how far north you are. A function of one variable cannot describe a map. A multivariable function can, and it lets you ask useful questions, such as which combination of purchases gives the lowest bill.
Freeze all but one
The most useful trick is to hold every input fixed except one. What is left is an ordinary function of one variable, which you can graph as a curve.
Take the height of a bowl, , where and are positions on the floor. Freeze at 0, then at 1, then at 2. You get three ordinary curves: , and . Each one is a slice through the bowl. The same freezing idea is the seed of partial derivatives, which measure how fast a function changes when only one input moves.
- y = 0
- y = 1
- y = 2
The math
Definition
A function of variables is a rule that assigns to each input in a set , called the domain, exactly one real number , called the output. Writing gives the short form .
Here means the set of all lists of real numbers. is the number line, is the flat plane, and is ordinary space. A function of two variables is written and takes a point of the plane as input. A function of three variables is written .
Graph and level sets
The graph of is the set of points in three-dimensional space. It is a surface that sits over the plane, the way a hill sits over its base.
A level set collects all inputs that give the same output :
On a topographic map, each contour line is a level set of the height function: every point on the line is at the same altitude.
Linear functions
The simplest multivariable function is , where and are fixed numbers. Write and . Then , a dot product.
Domains
A formula may not make sense for every input. The set of inputs where it does make sense is the domain. For , the domain is every pair with , because division by zero is not allowed. For , the domain is the set of points with , a filled disc of radius 1.
Worked examples
Let . Find and .
- Substitute and : .
- Evaluate each term: .
- Simplify: .
- Substitute and : .
The rule never changed. Only the numbers plugged into the slots did.
Apples cost 2 each and pears cost 3 each, so the bill is .
- Buy 4 apples and 2 pears: .
- Simplify: .
- Now buy one more pear: .
- The extra pear raised the bill by , which is the price of one pear. The coefficient of is the pear price because changing alone shifts the total by exactly that amount.
Which points lie on the level set ?
- Check : . So is on the level set.
- Check : . So is on it too.
- Check : . So is not on it, and it lies inside the circle.
- Interpretation: the level set is the circle of radius 5 around the origin. Every point on that circle has output 25, like a contour line at one height.
Let . A square root needs a number that is zero or positive, so the domain requires .
- Rearrange: .
- The points with are the points within distance 1 of the origin.
- Check : , so it is in the domain. Check : , so it is not.
- Interpretation: the domain is a filled disc of radius 1. Outside it, has no value.
Tradeoffs and failure modes
| Situation | What goes wrong | Better choice |
|---|---|---|
| Plugging in values without checking the domain | You divide by zero or take a root of a negative number | Solve the domain condition first, then evaluate |
| Reading exact values off a 3D picture of a surface | Pictures are imprecise, and perspective hides detail | Use slices, level sets, or a table of values |
| Looking at one input and forgetting the others | Behaviour changes when another input changes | Freeze one input, vary another, and compare slices |
| Going past three inputs | No picture fits, and intuition from space stops working | Rely on the algebra, level sets, and tables |
Two practical warnings:
- Units matter. If is metres and is seconds, the output of mixes units and means nothing. Check that every term in a formula has the same units.
- Not every multivariable function is a formula. A temperature map may be a table of measurements. The definition still applies, but you cannot always simplify it by hand.
History
René Descartes, in La Géométrie (1637), tied pairs of numbers to points in a plane. That idea let an equation in two unknowns describe a curve, and it made a shape you can see. Functions of several variables followed from that picture. In the 18th century, Leonhard Euler and others worked out how to differentiate them one variable at a time, which later became the theory of partial derivatives.
Contour lines on maps, which are level sets of height, were in common use by the nineteenth century. The same idea spread to physics, where a function giving one number at each point of space is called a scalar field. In 1928, Charles Cobb and Paul Douglas used a two-input production function to model how labour and capital combine to produce output. Economists still use the form today.
It caught on because one function can describe a whole landscape of possibilities, and a level set or a slice turns that landscape into something you can read.
Check yourself
QuestionWhat is the difference between a function of one variable and a function of two variables?Show answer
A function of one variable takes one number and returns one number, so its graph is a curve in the plane. A function of two variables takes a pair of numbers and returns one number, so its graph is a surface in three-dimensional space.
QuestionLet . Compute .Show answer
Substitute: . So .
QuestionWhy does the level set of at value 25 form a circle, and what happens if you change 25 to 9?Show answer
The condition says the distance from the origin is . Every point at distance 5 is on the set, which is a circle of radius 5. With value 9 the distance is 3, so the circle has radius 3. A larger output value gives a larger circle.
QuestionA bakery's profit is , where is cakes sold and is loaves of bread sold. Compute the profit when 10 cakes and 5 loaves are sold. Which product adds more profit per unit?Show answer
. Each loaf adds 6 to the profit and each cake adds 4, so a loaf adds more profit per unit sold.
Sources
- Multivariable calculus (Wikipedia): https://en.wikipedia.org/wiki/Multivariable_calculus
- Function of several real variables (Wikipedia): https://en.wikipedia.org/wiki/Function_of_several_real_variables
- Scalar field (Wikipedia): https://en.wikipedia.org/wiki/Scalar_field