Linear and nonlinear functions
Some rules draw a straight line and some draw a curve. Can you tell which from the equation, the graph or the story alone, before plotting a single point?
Where you are 5 in Linear functions
Why this exists
Constant rate of change gave a test for a table: a function is linear exactly when equal steps in the input always give equal steps in the output, and then its rule is y = mx + b. Graphing a function from a table showed that many rules, such as y = x^2, draw curves instead.
But a function rarely arrives as a table. It arrives as an equation, such as 5x + 2y = 12, or as a picture, or as a sentence about a garden or a jar of coins. Making a table and plotting it every time would work, slowly. This lesson is about telling linear from nonlinear straight from the form the function comes in, and knowing why the quick look gives the right answer.
The lesson has two parts. Part 1 reads equations. Part 2 reads graphs and situations, and builds a nonlinear function from a story.
Definition
A function is linear when its rule can be written
for two fixed numbers m and b. The number m may be negative, a fraction or 0, and b may be 0. A function whose rule cannot be written this way, for any choice of m and b, is nonlinear.
Three descriptions of a linear function say the same thing, and each is the one to use for a different form of the function:
- the rule can be written y = mx + b;
- the steps: equal steps in the input always give equal steps in the output, the constant rate of change m;
- the graph is a straight line that is not vertical.
Intuition
A linear function adds the same amount every time the input moves up by one. A nonlinear function changes how much it adds.
In Figure 1 both graphs start at 1 and both take steps of 1 across. On the left, y = 3x + 1 adds 3 at every step, so the steps are copies of one another and the dots line up. On the right, y = 2^x doubles at every step, so it adds 1, then 2, then 4. The rises grow, each step leaves at a steeper angle than the one before, and the dots bend upwards into a curve.
That is the whole difference, seen from every side. In an equation, look for anything that makes the amount added depend on where you are. On a graph, look for a bend. In a story, ask whether each step adds a fixed amount or does something else, such as doubling.
Results
Part 1: reading the equation
The equation test. Solve the equation for y and simplify. The function is linear exactly when the result has the form
Moving terms across the equals sign, multiplying out brackets with the distributive property, and dividing every term by a number are all allowed on the way.
Signs of a nonlinear rule. After simplifying, the rule is nonlinear if x is
- multiplied by itself, as in y = x^2 or y = x(x + 3);
- in a denominator, as in \displaystyle y = \frac{1}{x};
- in an exponent, as in y = 2^x.
These are the three met in this lesson; others, such as x under a square root, come later.
The step test. To show that a rule is nonlinear, choose equally spaced inputs and work out the outputs. If the output steps are not all equal, the function is not linear.
Part 2: reading a graph or a situation
The graph test. A function is linear exactly when its graph is one straight line that is not vertical, or, when only some inputs are allowed, dots that all lie on one such line. A curve, or straight pieces meeting at a corner, means nonlinear.
The situation test. A quantity is a linear function of another when each equal increase in the input adds (or takes away) the same amount. It is nonlinear when the amount added changes, for instance when each step multiplies the amount (doubling), when a fixed total is shared among the input (cutting into equal pieces), or when the input is multiplied by itself (the area of a square).
Why it is true
Every rule y = mx + b gives equal steps. Move the input from x to x + h. The output changes by
The x and the b cancel, so the change depends only on the size of the step h, not on where it starts. Equal steps in, equal steps out. That a constant rate also gives a straight line, and that equal steps force a rule y = mx + b, are shown in constant rate of change and slope triangles.
The nonlinear rules give unequal steps. Take a step of 1 from x, a whole number in the second line:
In the first, x^2 + 2x + 1 - x^2 leaves 2x + 1. In the second, 2^{x+1} is 2 \times 2^x, and taking one 2^x away leaves one. Each answer still contains x, so the step changes as x changes, and no single number m can describe it. The steps of \displaystyle \frac{1}{x} shrink in the same way (Example 3). A function whose steps are not constant is not linear.
Why simplify first. The function is the same whichever way its rule is written, so the simplest way is the one to judge (Example 4).
Worked examples
Examples 1 to 4 belong to Part 1, and Examples 5 to 7 to Part 2.
Rules close to the form
Show that each function is linear by writing it as y = mx + b, and name m and b.
(a) y = 7 - 2x \qquad (b) \displaystyle y = \frac{x}{4} + 1 \qquad (c) y = 3(x - 2) + 1 \qquad (d) y = 4
Solution(a) 7 - 2x is 7 + (-2x), and addition can be done in either order (the commutative property):
(b) Dividing x by 4 is multiplying it by \displaystyle \frac{1}{4}:
(c) Multiply out the bracket with the distributive property, then combine the numbers: 3(x - 2) + 1 = 3x - 6 + 1, so
(d) The output is 4 whatever the input. That is y = 0x + 4, with m = 0 and b = 4. A rate of 0 is still a constant rate: every step adds nothing. The graph is a horizontal line.
Both letters on one side
Is 5x + 2y = 12 the equation of a linear function of x?
SolutionThe equation does not say “y = \ldots”, so solve it for y. Subtract 5x from both sides, which keeps them equal:
Divide both sides by 2, which divides every term on the right by 2:
Reordered, that is \displaystyle y = -\frac{5}{2}x + 6. It has the form, so the function is linear, with \displaystyle m = -\frac{5}{2} and b = 6. An equation written this way, with the x and y terms on one side, is in standard form.
Check with steps of 2: the inputs 0, 2, 4 give y = 6, 1, -4, each 5 less than the one before, which is \displaystyle 2 \times \left(-\frac{5}{2}\right). Each pair fits the original equation: 5(4) + 2(-4) = 20 - 8 = 12.
Four rules that are not linear
Show that none of y = x^2, \displaystyle y = \frac{1}{x}, y = 2^x and y = x(x + 3) is linear.
SolutionNone of them can be rearranged into y = mx + b: the first and last multiply x by itself, the second puts x in a denominator, and the third puts x in an exponent. To prove each fails, use the step test with the equally spaced inputs 1, 2, 3, 4 (0 is left out because \displaystyle \frac{1}{0} has no value).
| rule | outputs at x = 1, 2, 3, 4 | output steps |
|---|---|---|
| y = x^2 | 1, 4, 9, 16 | 3, 5, 7 |
| \displaystyle y = \frac{1}{x} | \displaystyle 1, \frac{1}{2}, \frac{1}{3}, \frac{1}{4} | \displaystyle -\frac{1}{2}, -\frac{1}{6}, -\frac{1}{12} |
| y = 2^x | 2, 4, 8, 16 | 2, 4, 8 |
| y = x(x + 3) | 4, 10, 18, 28 | 6, 8, 10 |
No row has equal output steps, so none of the four is linear. Each row fails in its own way: the steps of x^2 grow by 2, those of \displaystyle \frac{1}{x} shrink, and those of 2^x double. And x(x + 3) hides a square: by the distributive property it is x^2 + 3x, which is why its steps grow like those of x^2.
When looks mislead
Decide whether each function is linear.
(a) y = (x + 1)^2 - x^2 \qquad (b) \displaystyle y = \frac{x + 6}{3} \qquad (c) xy = 18
Solution(a) There is a square, but simplify before judging. (x + 1)^2 = (x + 1)(x + 1) = x^2 + 2x + 1, so
The squares cancel. The function is linear, y = 2x + 1.
(b) There is a fraction, but the x is on top, not underneath. Dividing a sum by 3 divides each part by 3:
Linear, with \displaystyle m = \frac{1}{3} and b = 2.
(c) Solving for y means dividing both sides by x, which is allowed for every x except 0:
Now x is in a denominator. Equally spaced inputs 1, 2, 3 give 18, 9, 6, steps of -9 and then -3. Nonlinear. Compare it with Example 2: there the division was by the number 2, and the result stayed linear; here it is by x, and the result does not.
Four graphs
Which of the graphs in Figure 2 show linear functions? For each that does, write its rule.
A is one straight line, not vertical, so it is linear. It crosses the y-axis at (0, 1) and rises 1 for every 2 across, through (2, 2) and (4, 3), so \displaystyle m = \frac{1}{2} and the rule is \displaystyle y = \frac{1}{2}x + 1.
B bends. Reading points at equal input steps: (0, 0), (2, 1), (4, 4). The first step of 2 rises 1 and the second rises 3, so the rate is not constant. Nonlinear.
C is made of two straight pieces, and each piece on its own has a constant rate. But from (0, 0) to (2, 4) the rate is \displaystyle \frac{4}{2} = 2, and from (2, 4) to (4, 5) it is \displaystyle \frac{1}{2}. One function cannot have two rates and be linear, so C is nonlinear. The corner is where the rate changes.
D is flat at height 3: every step adds 0. It is linear, y = 3, with m = 0.
So A and D are linear. The test is not whether the graph is made of straight lines, but whether it is one straight line.
Three situations
Decide whether each is a linear function, and say why.
(a) Effie is planning a square garden. Its area A square meters against its side s meters.
(b) Barnaby cuts a 30 m rope into n equal pieces. The length L meters of each piece against n.
(c) Cosima stacks paper cups inside one another. One cup is 11 cm tall, and each cup added raises the stack by 1.5 cm. The height h cm against the number of cups n.
Solution(a) A = s^2: the side is multiplied by itself. Sides of 2, 4, 6, 8 m give areas of 4, 16, 36, 64 square meters, steps of 12, 20, 28. Each extra 2 m of side adds a wider strip than the last, because the strip runs along a longer edge. Nonlinear. (The perimeter, P = 4s, is linear: it grows by 8 m for every 2 m of side.)
(b) A fixed total is shared among the pieces, so \displaystyle L = \frac{30}{n}. For n = 1, 2, 3, 4 the lengths are 30, 15, 10, 7.5 m, steps of -15, -5, -2.5. Nonlinear: going from 1 piece to 2 takes 15 m off each piece, but going from 3 to 4 takes only 2.5 m.
(c) Each added cup adds the same 1.5 cm, so the function is linear. With n cups there are n - 1 added cups on top of the first:
For n = 1, 2, 3, 4 that gives 11, 12.5, 14, 15.5 cm, steps of 1.5. The number of cups is a whole number, so the graph is separate dots rather than a joined line, but the dots lie on one straight line. Joining the points is a question about the inputs (graphing a function from a table); linear or not is a question about the rule.
Building a nonlinear story
Anwen keeps a made-up savings jar that starts with 5 dollars. Write two rules for the jar’s contents after w weeks: one linear, one nonlinear.
SolutionA linear story. Each Sunday her grandmother adds 5 dollars. Every week adds the same amount, so the amount is A = 5 + 5w, which is A = 5w + 5.
A nonlinear story. Each Sunday her grandmother adds as much as is already in the jar, so the amount doubles every week: 5, 10, 20, 40, 80 dollars for w = 0 to 4. The rule is
with w in the exponent. The weekly additions are 5, 10, 20, 40: not equal, so the function is nonlinear.
| week w | 0 | 1 | 2 | 3 | 4 |
|---|---|---|---|---|---|
| adds 5 a week | 5 | 10 | 15 | 20 | 25 |
| doubles each week | 5 | 10 | 20 | 40 | 80 |
The two jars agree at weeks 0 and 1, and then part company. At week 4 the doubling jar holds 80 dollars against 25, and at week 6 it would hold 5 \times 64 = 320 against 35. Two matching rows say nothing about whether a function is linear.
Doubling is only one way to break the pattern. As soon as the amount added depends on where you are, the function is not linear.
Boundaries
Judge the simplified rule. y = (x + 1)^2 - x^2 is linear and y = x(x + 3) is not, though the first shows a square and the second does not. Only after multiplying out and collecting terms does the form tell the truth.
Dividing by a number is not dividing by x. Solving 5x + 2y = 12 divides by 2 and the rule stays linear. Solving xy = 18 divides by x, which also rules out the input 0, and the result \displaystyle y = \frac{18}{x} is nonlinear.
A vertical line is not a linear function. The graph of x = 3 is a straight line, but it gives the one input 3 every output at once, so it is not a function at all (testing graphs for functions). A horizontal line, y = 3, is a linear function with rate 0.
Linear is not the same as proportional. y = 1.5n + 9.5 is linear but not proportional: its graph does not pass through the origin. A proportional rule is the special linear rule with b = 0.
A few points can prove nonlinear, never linear. Unequal steps at equally spaced inputs settle the question. Equal steps only show that those points lie on a line; that the function is linear everywhere comes from its rule or from the situation.
A situation is linear only where its story holds. The cup stack adds 1.5 cm per cup only while the cups nest neatly; a stack that topples follows no rule at all.
Where this goes next
Knowing a function is linear is the license to use everything built on y = mx + b: slope-intercept form, comparing linear functions given in different ways, and linear functions in context, which says what m and b mean in a story. Nonlinear graphs still carry information, read in words in graphs that tell a story.
Each nonlinear rule met here is the first member of a family with its own lesson. The squares lead to quadratic expressions and the parabola; \displaystyle \frac{1}{x} and \displaystyle \frac{18}{x} to inverse proportion; 2^x and the doubling jar to exponential growth, whose contest with linear growth is linear, polynomial and exponential growth compared. And faced with real data, choosing a function family asks the question of this lesson first: equal steps, or something else?
Exercises
Part 1: linear or not
Decide whether each equation describes a linear function of x. If it does, write it as y = mx + b; if not, show unequal steps.
- y = 9 - 4x
- \displaystyle y = \frac{x}{5} - 2
- y = x^2 - 5
- \displaystyle y = \frac{10}{x}
- y = 2(x + 4) - 3
- y = 3^x
- y = -6
Part 1: rearrange or simplify first
- 8x + 4y = 12
- x + 4y = 2
- xy = 20
- y = x(x - 2)
- y = (x + 2)^2 - x^2
- \displaystyle y = \frac{10 - 4x}{2}
Part 1: show that it fails
- Use the inputs x = 0, 1, 2, 3 to show that y = 2^x + 5 is not linear.
- Use the inputs x = 1, 2, 3 to show that \displaystyle y = \frac{60}{x} + 1 is not linear.
Part 2: graphs
- For each graph in Figure 3, say whether it shows a linear function, and why. Give the rule of each linear one.
- A graph is made of two straight pieces: from (0, 2) to (3, 8), and from (3, 8) to (6, 11). Is it the graph of a linear function?
Part 2: situations
- A cube-shaped box has edges e cm long. Is each of these a linear function of e? (a) The total length of its 12 edges. (b) Its volume.
- Barnaby has a 36 m ribbon and cuts 3 m pieces off it, one at a time. Is the length left a linear function of the number of pieces n cut off? Write the rule, and say how this differs from the rope in Example 6.
- Effie keeps a made-up savings jar that starts with 2 dollars, and each week the amount in it triples. Make a table for weeks 0 to 3, decide whether the amount is linear in the week number, and find the amount at week 5.
Part 2: build one
- Write a short story of your own for a nonlinear function. Give a table of four equally spaced inputs and show that the output steps are not equal.
Reasoning
- Explain why y = 3 is a linear function but the vertical line x = 3 is not the graph of any function.
- The points (0, 0) and (2, 4) lie on the graphs of both y = 2x and y = x^2. Explain why two points can never show that a function is linear, and how a third input settles which rule is which.
- Explain why, for a linear function, the output at x = 2 is always the average of the outputs at x = 1 and x = 3. Use this to show that y = 2^x is not linear.
Answers
- Linear: y = -4x + 9, with m = -4 and b = 9.
- Linear: \displaystyle y = \frac{1}{5}x - 2, since dividing by 5 is multiplying by \displaystyle \frac{1}{5}.
- Nonlinear. The inputs 0, 1, 2 give -5, -4, -1, steps of 1 and 3.
- Nonlinear. The inputs 1, 2, 3 give \displaystyle 10, 5, \frac{10}{3}, steps of -5 and \displaystyle -\frac{5}{3}.
- Linear: 2(x + 4) - 3 = 2x + 8 - 3, so y = 2x + 5.
- Nonlinear. The inputs 0, 1, 2 give 1, 3, 9, steps of 2 and 6.
- Linear: y = 0x - 6, with m = 0 and b = -6. Its graph is a horizontal line.
- Linear: 4y = 12 - 8x, so y = -2x + 3.
- Linear: 4y = 2 - x, so \displaystyle y = -\frac{1}{4}x + \frac{1}{2}.
- Nonlinear: \displaystyle y = \frac{20}{x}, with x in a denominator. The inputs 1, 2, 3 give 20, 10, \displaystyle \frac{20}{3}, steps of -10 and \displaystyle -\frac{10}{3}.
- Nonlinear: x(x - 2) = x^2 - 2x. The inputs 0, 1, 2, 3 give 0, -1, 0, 3, steps of -1, 1 and 3.
- Linear: (x + 2)^2 = x^2 + 4x + 4, so y = x^2 + 4x + 4 - x^2 = 4x + 4.
- Linear: dividing each term by 2 gives 5 - 2x, so y = -2x + 5.
- The outputs are 6, 7, 9, 13, with steps 1, 2, 4. Equally spaced inputs, unequal steps: not linear.
- The outputs are 61, 31, 21, with steps -30 and -10. Not equal, so not linear.
- P is linear: one straight line from (0, 4) to (4, 0), falling 1 for each 1 across, so y = -x + 4. Q is nonlinear: it curves, falling 2 from (1, 4) to (2, 2) in one step across but only 1 from (2, 2) to (4, 1) in two. R is linear: the dots are not joined, but each step of 1 across rises 1, so they lie on the line y = x + 1. S is nonlinear: from (1, 1) to (2, 2) it rises 1, and from (2, 2) to (3, 4) it rises 2.
- No. The first piece has rate \displaystyle \frac{8 - 2}{3 - 0} = 2 and the second \displaystyle \frac{11 - 8}{6 - 3} = 1. A linear function has one rate, so its graph has no corner.
- (a) Linear: the total is 12e, and each extra centimeter of edge adds 12 cm. (b) Nonlinear: the volume is e^3, and edges of 1, 2, 3 cm give 1, 8, 27 cubic centimeters, steps of 7 and 19.
- Linear: L = 36 - 3n, for n from 0 to 12, since each cut takes away the same 3 m. In Example 6 the total was shared among the pieces, giving \displaystyle \frac{30}{n}; here the piece length is fixed and only the count changes.
- Weeks 0 to 3: 2, 6, 18, 54 dollars. The steps 4, 12, 36 are not equal, so it is nonlinear; the rule is A = 2 \times 3^w. At week 5: 2 \times 3^5 = 486 dollars.
- One possible answer: Delroy folds a sheet of paper in half again and again, and counts the layers. After 0, 1, 2, 3 folds there are 1, 2, 4, 8 layers, steps of 1, 2, 4. Each fold doubles the layers rather than adding a fixed number, so the function is nonlinear.
- y = 3 is y = 0x + 3: one output, 3, for every input, with constant rate 0. The line x = 3 contains (3, 0), (3, 1), (3, 2) and so on, giving the single input 3 many outputs, so it is not a function and cannot be a linear one.
- Any two points lie on some straight line, so two points never show the steps are constant. Take the input 1, halfway between: y = 2x gives 2, the midpoint of 0 and 4, while y = x^2 gives 1. So the inputs 0, 1, 2 give steps 2, 2 for the first rule and 1, 3 for the second.
- For a linear function the steps from x = 1 to 2 and from 2 to 3 are both m, so the output at 2 sits exactly halfway between the outputs at 1 and 3: it is their average. For y = 2^x the outputs at 1 and 3 are 2 and 8, whose average is \displaystyle \frac{2 + 8}{2} = 5, but the output at 2 is 4. So y = 2^x is not linear.