One input, one output
A function of one variable takes a number and gives back a number: takes 3 and gives 9. Its graph pairs each input with its output, so each point of the graph, (3, 9) for instance, is fixed by a single number, the input 3. The inputs lie along a line, and the graph is a curve above it.
Two inputs
A function of two variables takes a pair of numbers and gives back one number, written f(x, y). Take . The input (3, 4) gives 9 + 16 = 25, and (2, 3) gives 4 + 9 = 13.
A pair of numbers is a point of a plane, so the inputs now fill a whole plane rather than a line. Different inputs can give the same output: (−3, 4) gives 9 + 16 = 25 too, because squaring removes the sign. In fact every point at distance 5 from the origin gives 25, since is the square of that distance.
Three inputs of , each labeled with its output: (3, 4) and (−3, 4) both give 25, and (2, 3) gives 13. Every input on the dashed circle of radius 5 gives 25.
The order of the inputs
gives the same output when the inputs swap, but most functions do not. Take g(x, y) = x − 2y: g(2, 3) = 2 − 6 = −4, while g(3, 2) = 3 − 4 = −1. The first number always goes in for x and the second for y.
Domain and range
The domain is the set of inputs the function accepts, now a region of the plane. accepts every point, so its domain is the whole plane. Its outputs are never negative, and every height from 0 up is reached, so its range is .
needs , that is : the points on or below the line y = x. It gives at (5, 1) and 0 at (3, 3), and nothing at (1, 5). Its range is again .
accepts every point except the origin, where it would divide by 0. Its outputs are all positive, and every positive number is reached, so its range is z > 0.
The domain of shaded: the points on or below the line y = x. The input (5, 1) gives 2 and (3, 3), on the line, gives 0; the hollow point (1, 5) lies outside, where x − y is negative.
The output is a height
To draw a function of two variables, stand each output up as a height above its input: above the point (x, y), mark the point at height z = f(x, y). That needs a third axis, z, at right angles to the plane of inputs.
One height above each point of a region joins up into a surface, not a curve. Take over the disc . Above the origin the height is 4; above (1, 1) it is 2; above every point of the circle of radius 2 it is 0. The surface is a hill, highest in the middle and falling to 0 at the edge of the disc.
above the disc of radius 2: the dashed oval is the disc of inputs on the floor, and the surface over it is highest, at 4, above the center. Each wire is the curve the surface makes above one line x = constant or y = constant.
Hold one input still
Fixing one input turns a function of two variables into a function of one, which is what each wire on the surface shows. Hold y = 1 in and what is left is , a parabola, the curve the surface makes above the line y = 1.
The applications below use this move. The cost of a crate depends on the side of its base and its height; once the height is fixed at 2 meters, the cost is a quadratic in the side alone, and setting it equal to a budget gives the side.
The usual mistakes
Combining the inputs the wrong way. For f(x, y) = x + y, f(2, 3) is 2 + 3 = 5, not 2 × 3 = 6 or 3 − 2 = 1.
Swapping the inputs. g(x, y) = x − 2y gives −4 at (2, 3) and −1 at (3, 2).
Reading the output as a point. f(3, 4) = 25 is a height above the point (3, 4); the point on the surface is (3, 4, 25).
Leaving the domain out. has no value at (1, 5), and none at the origin.
A crate, and a kicked ball
In the applications below, the cost of a crate is a function of the side of its base and its height, and two designs that hold the same volume cost different amounts. Then the range of a kicked ball depends on its speed and its angle together, so the faster kick need not go farther.
Worked example: A Shipping Crate Priced From Its Base and Its Height: Two Designs Compared, and the Base a Budget Allows
Question A crate has a square base of side x meters and a height of y meters. The plywood for the base and the lid costs $12 per square meter, and the plywood for the four sides costs $8 per square meter. (a) Write the cost C(x, y) of the plywood in dollars, and find the cost of each of two designs that both hold 4.5 cubic meters: design A, with a base of side 1.5 meters and a height of 2 meters, and design B, with a base of side 3 meters and a height of 0.5 meters. (b) The crates must be 2 meters high, and the budget for plywood is $224 a crate. Find the side of the base.
1.The base and the lid are two squares of area x2, so together they cost 12 × 2x2 = 24x2 dollars. The four sides are rectangles of area xy, so they cost 8 × 4xy = 32xy dollars. Hence C(x, y) = 24x2 + 32xy.
The base and the lid cost 24x2 dollars and the four sides 32xy, so the cost is a function of both dimensions. 2.Both designs hold what the question says: 1.5 × 1.5 × 2 = 4.5 and 3 × 3 × 0.5 = 4.5 cubic meters. (a) For design A, C(1.5, 2) = 24 × 2.25 + 32 × 3 = 54 + 96 = 150 dollars.
(a) Design A, a base of side 1.5 meters and a height of 2 meters, costs $150. Its curve joins every design that costs the same. 3.For design B, C(3, 0.5) = 24 × 9 + 32 × 1.5 = 216 + 48 = 264 dollars. The two designs hold the same amount, but B costs $114 more, because its large base and lid use the more expensive plywood.
Design B holds the same 4.5 cubic meters and costs $264: its wide base and lid use the more expensive plywood. 4.(b) With the height fixed at y = 2, the cost is a function of x alone: C(x, 2) = 24x2 + 64x. Setting it equal to the budget gives 24x2 + 64x = 224, and dividing by 8 gives 3x2 + 8x − 28 = 0.
(b) Fixing the height at 2 meters leaves the cost as a function of the side alone, along the line y = 2. 5.This factorizes as (3x + 14)(x − 2) = 0, so x = 2 or x = −143. A side cannot be negative, so the base is 2 meters square. Check: 24 × 4 + 32 × 2 × 2 = 96 + 128 = 224 dollars.
The curve of designs costing $224 meets the line y = 2 at x = 2: a base 2 meters square.
Answer: (a) C(x, y) = 24x2 + 32xy; design A costs $150 and design B costs $264; (b) a base 2 meters square
Common mistakes
- Pricing the base and the lid as one square, 12x2. The crate has a base and a lid, two squares of area x2 each, so their plywood costs 24x2 dollars.
- Keeping x = −143 as a second design. The quadratic has two roots, but a side must be positive, so only x = 2 describes a crate.
More functions of several variables problems, worked step by step →
Worked example: A Ball Kicked From Level Ground: The Range From the Speed and the Angle, and the Angles That Land a Pass
Question Ignoring air resistance and taking g = 10 meters per second squared, a ball kicked from level ground at a speed of v meters per second and an angle θ above the ground lands R(v, θ) = v2 sin 2θ10 meters away. (a) Which travels farther: a kick at 20 meters per second and 45°, or a kick at 25 meters per second and 15°? (b) A player kicks at 20 meters per second and wants the ball to land 20 meters away, at a teammate's feet. Find every angle that does this.
1.(a) For the first kick, sin 90° = 1, so R(20, 45°) = 400 × 110 = 40 meters.
(a) At 20 meters per second and 45° the ball travels 40 meters: the peak of the curve for v = 20. 2.For the second kick, sin 30° = 0.5, so R(25, 15°) = 625 × 0.510 = 31.25 meters. The first kick travels 8.75 meters farther: the second kick's greater speed does not make up for its low angle.
At 25 meters per second but only 15° it travels 31.25 meters, less than the slower kick. 3.(b) Hold the speed at v = 20. The range is then a function of the angle alone, R(20, θ) = 400 sin 2θ10 = 40sin 2θ, and it must equal 20, so sin 2θ = 0.5.
(b) Holding v = 20 leaves the range as a function of the angle alone; the line marks a range of 20 meters. 4.Because θ lies between 0° and 90°, 2θ lies between 0° and 180°, where the sine is 0.5 twice: 2θ = 30° or 2θ = 150°. So θ = 15° or θ = 75°.
The line meets the curve twice, where sin 2θ = 0.5: at θ = 15° and at θ = 75°. 5.Check: sin 30° = sin 150° = 0.5, so both angles give 40 × 0.5 = 20 meters. The low kick at 15° reaches the teammate sooner; the high kick at 75° spends longer in the air.
Both kicks land 20 meters away; the kick at 75° stays in the air longer.
Answer: (a) the kick at 20 meters per second and 45°, which travels 40 meters against 31.25 meters; (b) θ = 15° or θ = 75°
Common mistakes
- Stopping at 2θ = 30°. The sine is also 0.5 at 150°, and 2θ can be as large as 180°, so the high kick at 75° is a second answer.
- Deciding that the faster kick must travel farther. The range depends on both inputs at once: at 15° the factor sin 2θ is only 0.5, and that halves the range more than the extra speed adds to it.
More functions of several variables problems, worked step by step →