Graphing a line from a table of values
A rule turns each input into an output. How do you see the whole rule at once, as a picture?
Where you are 11 in Linear relationships
When you reach for it
An equation such as y = 2x - 3 is a rule: give it an input x and it gives back an output y. Each input with its output is an ordered pair, and each pair is a point on the coordinate plane. The graph of the equation is the set of all the pairs (x, y) that make it true. There are infinitely many, so you work out a few, set them out in a table of values, plot them, and look.
Reach for it with an equation or a rule in words. The table also shows, before anything is drawn, whether the graph is a straight line, and it needs only evaluating an expression.
The procedure
The running example is y = 2x - 3.
Choosing the inputs
Every value of x is allowed, so choose inputs that make the work easy. Small integers keep the arithmetic quick and put the points on grid corners. The input 0 gives the point where the graph crosses the y-axis, and a negative input or two shows the left of that axis too. Here take x = -1, 0, 1, 2, 3.
Computing the outputs
Substitute each input and multiply before subtracting. Brackets round a negative input keep its sign attached:
The other inputs go the same way:
| x | y = 2x - 3 |
|---|---|
| -1 | -5 |
| 0 | -3 |
| 1 | -1 |
| 2 | 1 |
| 3 | 3 |
Each row is one point: (-1, -5), (0, -3), (1, -1), (2, 1) and (3, 3).
Reading the steps in the table
The inputs go up by 1 each time, and the outputs go up by 2 each time. Equal steps in the input give equal steps in the output. This is not luck. Raise any input by 1 and the output becomes
the old output plus 2, whatever x was. Raise it by h and the output rises by 2h.
That is why the points fall on a straight line. Each point to the next is the same move, 1 right and 2 up: the slanted side of a right triangle with legs 1 and 2. The triangles all have the same shape, so their slanted sides point the same way and join into one straight path. The change in output per unit of input, here 2, is the line’s slope; for any y = mx + b a step of 1 in x changes y by m.
Plotting and joining
Plot each pair: across to the x-value, then up or down to the y-value. Lay a ruler along the points and draw the line to the edges of the grid; arrowheads at the ends say it keeps going, because every x is allowed. The line stands for every pair, not only the five in the table: x = 1.5 gives y = 2(1.5) - 3 = 0, and (1.5, 0) sits on the line halfway between (1, -1) and (2, 1).
Why three points
Through two different points there is exactly one straight line, so two points fix the line. A third point, computed from the rule on its own, must land on that line. If it does, the three points confirm one another; if it does not, at least one of the three outputs does not satisfy the equation, and that shows before the line is drawn. Two points give no such check, since any two points have a line through them. Example 3 uses the check.
Choosing a scale
A scale says how many units each grid square stands for, read off the table: here the values run from -5 to 3, so one unit per square fits. For larger values a square stands for 2, 5, 10 or 20 units. The two axes may use different scales, each labeled with what it counts.
Join the points or not
For a bare equation every real number is an allowed input, so the whole line is drawn. A situation may allow less, and the inputs it allows are its reasonable domain. When the input counts whole things, the graph is separate dots (Example 5). When the input passes through every value in between, such as time, the graph is a line or a piece of one (Examples 4 and 6). What decides is the input, not the shape of the rule, and the graph stops where the domain stops.
Worked examples
A falling line
Make a table of values for y = -3x + 3 and graph the equation.
SolutionTake x = -1, 0, 1, 2. Bracket the negative input so its sign is multiplied too; a negative times a negative is positive:
| x | y |
|---|---|
| -1 | 6 |
| 0 | 3 |
| 1 | 0 |
| 2 | -3 |
Each time x goes up by 1, y goes down by 3. Equal steps, so the points lie on a line, and it falls from left to right. Plot (-1, 6), (0, 3), (1, 0) and (2, -3) and draw the line through them. It crosses the y-axis at (0, 3), from the input 0, and the x-axis at (1, 0), where the output is 0.
A fraction in the rule
Graph \displaystyle y = \frac{2}{3}x + 2.
SolutionThe input x = 1 gives \displaystyle y = \frac{2}{3} + 2 = \frac{8}{3}, two thirds of a square above 2 and hard to place exactly. The fraction disappears when the input is a multiple of 3, because then \displaystyle \frac{2}{3} of it is an integer. So choose x = -3, 0, 3, 6:
| x | y |
|---|---|
| -3 | 0 |
| 0 | 2 |
| 3 | 4 |
| 6 | 6 |
The inputs step by 3 and the outputs by 2: equal steps. The four points land on grid corners, and the line through them rises 2 for every 3 across. The point \displaystyle \left(1, \frac{8}{3}\right) is on it too; good inputs only spared you placing it by hand.
A third point as a check
(a) Graph y = 5 - 2x from the inputs x = -1, 0, 2, using the third point as a check.
(b) Figure 2 shows the points (-1, 7), (0, 5) and (2, 3). Which of them is not on the line y = 5 - 2x?
(a) Substitute each input:
The first two points, (-1, 7) and (0, 5), fix the line: one step right, 2 down. Two more steps right, from x = 0 to x = 2, must take it 4 further down, to 5 - 4 = 1. The third computed point, (2, 1), lands exactly there, so the three points agree and the line through them is the graph.
(b) A point is on the graph exactly when its coordinates make the equation true. The first two pass, as (a) showed. For (2, 3) the equation would need 3 = 5 - 2(2) = 1, which is false, so (2, 3) is not on the line; the line passes 2 units below it, through (2, 1). The figure shows only that the three are not on one line; substitution says which point is off. The pair (0, 5) and (2, 3) alone would fit a line, y = 5 - x, with nothing to show it is not the graph.
A parachute coming down
Ottoline opens her parachute at a height of 120 meters. Suppose she then comes down at a steady 8 meters per second, so t seconds later her height is H = 120 - 8t meters. Make a table, choose a scale, and graph H against t. When is she halfway down?
SolutionFive seconds of falling is 5 \times 8 = 40 meters, a round number, so take multiples of 5:
| t (seconds) | H (meters) |
|---|---|
| 0 | 120 |
| 5 | 80 |
| 10 | 40 |
| 15 | 0 |
Each 5 seconds takes away 40 meters, so the points are in a line, and at t = 15 she is on the ground. One second per square across and 10 meters per square up gives a grid 15 squares wide and 12 high.
She passes through every height on the way down, so join the points. But draw only from t = 0 to t = 15, with no arrows: before t = 0 the parachute was closed and this rule did not apply, and after t = 15 the rule would give 120 - 8(16) = -8 meters at t = 16, below the ground.
Halfway down is 60 meters. Across from 60, the segment is above t = 7.5, halfway between the points for 5 and 10 seconds. Check: 120 - 8(7.5) = 120 - 60 = 60. She is halfway down after 7.5 seconds.
Go-kart races
Ezinne is booking go-kart races. Each race costs 15 dollars, helmet hire adds 5 dollars once per visit, and a visit allows from 1 to 6 races. Graph the cost of a visit against the number of races.
SolutionWith n races the cost is C = 15n + 5 dollars: 15 for each race, and the helmet once. The reasonable domain is the whole numbers 1 to 6, so list them all; for example 15(4) + 5 = 60 + 5 = 65.
| n (races) | C (dollars) |
|---|---|
| 1 | 20 |
| 2 | 35 |
| 3 | 50 |
| 4 | 65 |
| 5 | 80 |
| 6 | 95 |
Each extra race adds 15 dollars, so the points line up. The costs reach 95, so 10 dollars per square up fits.
Do not join the dots. The point (2.5, 42.5) satisfies the equation, but nobody rides half a race, so the graph is exactly the six dots. Nor is there a dot at n = 0: the equation gives 5 there, but 0 is outside the domain, since a visit has at least one race.
A bike rental, from a rule in words
Cassius hires a bike. The shop charges a fixed fee of 8 dollars plus 3 dollars for each hour, worked out to the minute, so half an hour adds 1.50 dollars. A hire lasts at most 6 hours. Graph the cost against the time, and use the graph to find how long 20 dollars pays for.
SolutionFor h hours the hourly part is 3h dollars, and the fee is added once, so
| h (hours) | C (dollars) |
|---|---|
| 0 | 8 |
| 2 | 14 |
| 4 | 20 |
| 6 | 26 |
Each 2 hours adds 6 dollars, so the points line up. Before any riding the cost is already the fee, so the graph starts at (0, 8), not at the origin. Costs run to 26, so 2 dollars per square up fits.
Every time has a cost, for example 3(1.5) + 8 = 12.50 dollars for 1.5 hours, so join the points with a segment from h = 0 to h = 6. For 20 dollars, go across from 20 to the segment, then down: 4 hours. Check: 3(4) + 8 = 12 + 8 = 20. The rule has the same shape as the go-karts’, a rate plus a fixed charge, but time does not come whole.
Boundaries
A ruler is justified only for a linear rule. A table works for any equation, but joining the points with a straight line is right only when equal input steps give equal output steps, which is exactly the rules y = mx + b. For \displaystyle y = \frac{24}{x} the outputs at x = 1, 2, 3, 4 are 24, 12, 8, 6, and the points lie on the curve of an inverse proportion; a squared input bends the graph into a parabola.
Steps are compared per unit of input. With unevenly spaced inputs, as in Example 3, an input step of 2 must give twice the output step of an input step of 1.
Three points check the outputs, not the equation. Points worked out from y = 5 - 3x line up perfectly, on the graph of y = 5 - 3x, whatever equation was meant.
A value read off a graph is an estimate, good to a fraction of a grid square; substituting confirms it.
The situation decides which inputs count, and the equation alone does not know it. A rule from a situation is also a model: “a steady 8 meters per second” is an assumption.
Where this goes next
The input 0 always gives (0, b), and the equal step in every table is the slope m, so for y = mx + b you can plot (0, b) and step by the slope with no table: that is graphing a line from its equation, and slope-intercept form names the two numbers. The step read in a situation, meters per second or dollars per hour, is a rate of change. With no fixed part the line passes through the origin: direct variation and proportional relationships. For rules that are not linear, graphing a function from a table uses the same move and joins the points smoothly.
Exercises
Table and graph
Make a table of values with the inputs given, and graph the equation.
- y = x + 4, with x = -2, -1, 0, 1, 2
- y = -2x - 1, with x = -2, -1, 0, 1, 2
- y = 3x - 4, with x = -1, 0, 1, 2
- y = 4 - x, with x = -1, 0, 1, 2, 3
Choosing the inputs
Choose at least three inputs that give integer outputs, including 0 and a negative, then make the table and graph the equation.
- \displaystyle y = \frac{1}{2}x - 2
- \displaystyle y = -\frac{3}{5}x + 2
- \displaystyle y = \frac{3}{4}x + 1
- Explain why x = 1 is an awkward input for \displaystyle y = \frac{2}{7}x - 3, and find the outputs for x = -7, 0, 7.
Checking with the steps
- A table for y = 4x + 3 has inputs -1, 0, 1, 2 and outputs -1, 3, 7, 12. Which point of the table is not on the line y = 4x + 3, and what output belongs there?
- Could the points (0, 10), (2, 7), (4, 4), (6, 1) lie on one straight line? If so, what is y on that line when x = 8?
- Could the points (1, 1), (2, 4), (3, 9), (4, 16) lie on one straight line?
- Could the points (0, 2), (1, 5), (3, 11), (4, 14) lie on one straight line? The inputs are not evenly spaced. If so, what is y on that line when x = 8?
Scale and situation
- A snowplow starts with 150 kilograms of salt and spreads a steady 10 kilograms per minute, so S = 150 - 10t. Make a table for t = 0, 5, 10, 15, choose a scale, and say whether to join the points and where the graph stops.
- Pedal-boat rides cost 12 dollars each, with no fixed charge and at most 5 rides on one pass, so C = 12n. Make a table for every allowed n and say how the graph is drawn.
- A bike shop charges a fixed 5 dollars plus 2 dollars an hour, worked out to the minute, for hires of up to 4 hours. Write the equation, make a table for h = 0, 1, 2, 3, 4, and find the cost of 2.5 hours.
- Say whether each graph should be separate dots or a line, and why. (a) The cost of go-kart races against the number of races. (b) A parachutist’s height against time. (c) The number of empty seats on a bus against the number of passengers aboard.
- The rule y = 25x - 100 is to be graphed for x = 0, 2, 4, 6, 8. Make the table, and choose a scale for the y-axis so that the outputs fit exactly on a grid 10 squares tall.
Reasoning
- Two points are enough to draw a line. Explain what working out a third point adds, and what it cannot catch.
- Show that for y = mx + b, raising the input by 1 always changes the output by m, and raising it by h changes it by mh. Explain why this makes the graph a straight line.
- Make a table for \displaystyle y = \frac{30}{x} with x = 1, 2, 3, 5, 6, and explain from the table why its graph is not a straight line.
Answers
- (-2, 2), (-1, 3), (0, 4), (1, 5), (2, 6): each step raises y by 1.
- (-2, 3), (-1, 1), (0, -1), (1, -3), (2, -5), since -2(-2) - 1 = 3 and so on: each step lowers y by 2.
- (-1, -7), (0, -4), (1, -1), (2, 2): each step raises y by 3.
- (-1, 5), (0, 4), (1, 3), (2, 2), (3, 1), since 4 - (-1) = 5 and so on: each step lowers y by 1.
- Even inputs clear the half: x = -2, 0, 2, 4 give (-2, -3), (0, -2), (2, -1), (4, 0), every 2 across, 1 up.
- Multiples of 5 clear the fifths: x = -5, 0, 5 give (-5, 5), (0, 2), (5, -1), since \displaystyle -\frac{3}{5}(-5) = 3. Every 5 across, 3 down.
- Multiples of 4 clear the quarters: x = -4, 0, 4 give (-4, -2), (0, 1), (4, 4), since \displaystyle \frac{3}{4}(-4) = -3. Every 4 across, 3 up.
- x = 1 gives \displaystyle y = \frac{2}{7} - 3 = -\frac{19}{7}, which can only be placed by estimating sevenths of a square. Multiples of 7 clear the fraction: (-7, -5), (0, -3), (7, -1).
- (2, 12): 4(2) + 3 = 11, not 12. The first three outputs rise by 4 each time, so the fourth should be 7 + 4 = 11.
- Yes. Each step of 2 in x lowers y by 3, equal steps. Continuing, x = 8 gives y = 1 - 3 = -2.
- No. The inputs step by 1, but the outputs rise by 3, then 5, then 7, so the points lie on a curve (they are points of y = x^2).
- Yes. The output rises by 3 per unit of input every time: 3 over a step of 1, 6 over a step of 2, 3 over a step of 1. At x = 8, four units past x = 4, y = 14 + 3(4) = 26.
- (0, 150), (5, 100), (10, 50), (15, 0). One minute and 10 kilograms per square fits, 15 squares each way. Join the points, since the salt runs out continuously, but only from t = 0 to t = 15, when it is all spread.
- (1, 12), (2, 24), (3, 36), (4, 48), (5, 60). Plot five dots and do not join them: rides come whole. They lie along a line through the origin, but n = 0 is not a pass, so there is no dot there.
- C = 2h + 5, with points (0, 5), (1, 7), (2, 9), (3, 11), (4, 13), joined by a segment from h = 0 to h = 4. Halfway between (2, 9) and (3, 11) the segment is at 10: 2(2.5) + 5 = 10 dollars.
- (a) Dots: races come whole. (b) A line: time passes through every value, and the height with it. (c) Dots: passengers and empty seats are both whole numbers.
- (0, -100), (2, -50), (4, 0), (6, 50), (8, 100). The outputs span 100 - (-100) = 200, and 200 \div 10 = 20, so 20 per square, from -100 at the bottom to 100 at the top.
- Any two points have a line through them, so a wrong output in either still gives a line, and nothing shows it. A third point worked out on its own lands on the line through the other two when all three are right (two wrong outputs could line up by chance, but rarely), so it checks the arithmetic. It cannot check the equation: points worked from a different equation line up on that equation’s line.
- m(x + 1) + b = (mx + b) + m, and likewise m(x + h) + b = (mx + b) + mh. So every move of 1 to the right comes with the same vertical move m: the moves between neighboring points are the slanted sides of identical right triangles, all pointing the same way, and they join into one straight line.
- (1, 30), (2, 15), (3, 10), (5, 6), (6, 5). From x = 1 to 2 the output drops by 15, from 2 to 3 by 5: equal input steps, unequal output steps. A line would have equal output steps, so the points lie on a curve that flattens as x grows.