Sub topic 5
Solving by Graphing
Prerequisites
This chapter assumes you can do the following:
- Plot points and draw a line on a coordinate plane.
- Read slope and y-intercept from an equation written as y = mx + b.
- Rearrange a linear equation to isolate y.
- Substitute values into an expression and do integer and fraction arithmetic.
If rewriting equations in slope-intercept form feels shaky, review that chapter first. Every graph in this chapter depends on it.
The core idea
A linear equation in two variables has infinitely many solutions. Each solution is an ordered pair (x, y), and together these pairs form a straight line when plotted. A system of two linear equations asks for the pairs that satisfy both equations at once. Geometrically, that means a point that lies on both lines.
Two straight lines can meet in only three ways, so the graph tells you how many solutions to expect:
- They cross at exactly one point. The system has one solution.
- They never meet. The system has no solution.
- They lie on top of each other. The system has infinitely many solutions.
Solving by graphing means drawing both lines accurately and reading the coordinates of the crossing point. The method is visual and needs little algebra. Its weakness is precision, which is covered below.
The procedure
- Rewrite each equation in slope-intercept form, y = mx + b.
- Plot the y-intercept (0, b) of the first line.
- Use the slope m, as rise over run, to plot at least one more point, then draw the line.
- Repeat for the second line on the same axes.
- Find where the lines cross and read the point (x, y).
- Substitute the point into both original equations.
Step 6 is part of the method, not an optional extra.
Worked example 1: equations already in slope-intercept form
Solve this system by graphing:
- y = x + 1
- y = -2x + 7
For the first line, the intercept is (0, 1) and the slope is 1. From (0, 1), go right 1 and up 1 to reach (1, 2). Continue to (2, 3).
For the second line, the intercept is (0, 7) and the slope is -2. From (0, 7), go right 1 and down 2 to reach (1, 5). Continue to (2, 3).
Both lines pass through (2, 3), so that is the intersection.
Check it in both equations:
- First equation: 3 = 2 + 1, which is true.
- Second equation: 3 = -2(2) + 7 = 3, which is true.
The solution is (2, 3).
Worked example 2: starting from standard form
Equations are often given in standard form, Ax + By = C. You must rewrite them before plotting by the slope method. Take this system:
- 2x + y = 7
- x - y = 2
Rewrite the first equation by subtracting 2x from both sides: y = -2x + 7.
Rewrite the second equation by subtracting x from both sides, which gives -y = -x + 2. Then multiply every term by -1: y = x - 2.
A table of points is a good cross-check on your slope-and-intercept work:
| x | y = -2x + 7 | y = x - 2 |
|---|---|---|
| 1 | 5 | -1 |
| 2 | 3 | 0 |
| 3 | 1 | 1 |
| 4 | -1 | 2 |
At x = 3 both columns give y = 1, so the lines meet at (3, 1). The gap between the two y-values shrinks from 6 to 3 to 0, which shows the lines closing in on the crossing point.
Check in the original equations: 2(3) + 1 = 7 and 3 - 1 = 2. Both are true. The solution is (3, 1).
The table method also works when you cannot picture the lines. Find the x-value where the two columns agree.
Systems with no solution or infinitely many solutions
Slope tells you the outcome before you draw anything. Compare the slopes and intercepts after rewriting both equations.
| Slopes | Intercepts | Picture | Number of solutions |
|---|---|---|---|
| Different | Any | Lines cross once | Exactly one |
| Equal | Different | Parallel lines | None |
| Equal | Equal | One line drawn twice | Infinitely many |
Two examples:
- No solution. The system y = 2x + 1 and y = 2x - 3 has two lines with slope 2. They cross the y-axis at 1 and at -3, so they are parallel and never meet.
- Infinitely many solutions. For x + y = 3 and 2x + 2y = 6, rewrite both. The first becomes y = -x + 3. Divide the second by 2 to get x + y = 3, which also gives y = -x + 3. These are the same equation, so every point on the line is a solution.
For the second example, you may find it easier to notice the match before rewriting. The second equation is exactly 2 times the first. Whenever one equation is a nonzero multiple of the other, you have the same line.
Reading the intersection: precision and its limits
Graphing works well when the crossing point sits exactly on grid lines, because you can read integer coordinates with confidence. It becomes unreliable when the crossing point has fractional coordinates.
Consider y = 2x and y = -x + 1. Setting 2x = -x + 1 gives 3x = 1, so x = 1/3 and y = 2/3. On a hand-drawn graph, the lines cross between grid lines. You might read the point as (0.3, 0.7).
Test that reading in the first equation: 2(0.3) = 0.6, but you read y = 0.7. The equation fails, so the reading is only an approximation. The exact answer is (1/3, 2/3).
The pencil-width of your lines also limits accuracy. A line drawn with a pencil covers a strip of the grid, so two lines with nearly equal slopes can look as if they touch over a long stretch. Graphing cannot tell you reliably whether lines such as y = x and y = 1.01x - 0.01 meet at one point or are the same line. Use algebra when slopes are close.
Checking your result with code
You can check hand-worked graphs with a short program. It uses exact fractions, so it reports 1/3 rather than 0.333... and it also detects when a graph reading could be exact.
from fractions import Fraction
def intersect(m1, b1, m2, b2):
"""Intersection of y = m1*x + b1 and y = m2*x + b2.
Returns (x, y) as Fractions, or a string for the two special cases.
"""
if m1 == m2:
return "same line" if b1 == b2 else "parallel"
x = Fraction(b2 - b1) / (m1 - m2)
y = m1 * x + b1
return x, y
def readable_on_grid(point):
"""True when both coordinates are integers, so a graph can show them exactly."""
x, y = point
return x.denominator == 1 and y.denominator == 1
print(intersect(1, 1, -2, 7)) # (Fraction(2, 1), Fraction(3, 1))
print(intersect(1, -2, -2, 7)) # (Fraction(3, 1), Fraction(1, 1))
print(intersect(2, 0, -1, 1)) # (Fraction(1, 3), Fraction(2, 3))
print(intersect(2, 1, 2, -3)) # parallel
print(intersect(-1, 3, -1, 3)) # same line
print(readable_on_grid(intersect(2, 0, -1, 1))) # FalseThe function takes slopes and intercepts, so you must rewrite each equation as y = mx + b first. The second call corresponds to Worked example 2, where the lines are y = x - 2 (slope 1, intercept -2) and y = -2x + 7. The fractional case in the third call is the one a graph cannot read precisely.
Common errors
- Sign mistakes when rewriting. In x - y = 2, isolating y gives y = x - 2, not y = x + 2. Always multiply or divide every term when you change the sign of y.
- Slope direction. A slope of -2 means down 2 for each 1 to the right. Going up 2 and right 1 plots a different line.
- Plotting the intercept on the wrong axis. In y = mx + b, the intercept b is on the y-axis at (0, b), not at (b, 0).
- Swapping coordinates. The solution is written (x, y). Reading the vertical value first reverses the pair.
- Skipping the check. An unchecked reading from a graph can be wrong by a small amount without looking wrong.
- Intersection off the page. If the lines seem not to cross inside your window, they may still cross outside it. Compare slopes before deciding that a system has no solution. Lines with different slopes always meet somewhere.
- Calling nearly parallel lines parallel. Equal slopes means exactly equal. Compare the numbers, not the picture.
When to use graphing
Graphing is a good choice in these situations:
- Both equations are already in slope-intercept form and have small integer slopes and intercepts.
- You want a picture of how the two relationships compare, for instance to see which is larger on either side of the crossing point.
- You need a quick sanity check on an answer found with another method.
It is a poor choice when the answer is likely fractional or when precision matters. Substitution and elimination, covered in the next chapters, give exact answers. The choosing-a-method chapter compares all three.
Exercise
Solve the system y = -x + 5 and y = 2x - 1 by graphing. Give the intersection point and show the check.
Show answer
The first line has intercept (0, 5) and slope -1, through (1, 4), (2, 3) and (3, 2). The second line has intercept (0, -1) and slope 2, through (1, 1), (2, 3) and (3, 5). Both pass through (2, 3). Check: 3 = -2 + 5 is true, and 3 = 2(2) - 1 is true. The solution is (2, 3).
Exercise
Without drawing, say how many solutions the system 3x - y = 4 and y = 3x + 2 has, and explain why.
Show answer
Rewrite the first equation as y = 3x - 4. Both lines have slope 3, but their intercepts are -4 and 2. The lines are parallel and distinct, so the system has no solution.
Exercise
The lines y = 2x and y = -x + 1 cross between grid lines. A student reads the point as (0.3, 0.7). Show that this reading is not a solution, then give the exact solution.
Show answer
Substituting into y = 2x gives 2(0.3) = 0.6, not 0.7, so the reading fails. Setting 2x = -x + 1 gives 3x = 1, so x = 1/3 and y = 2/3. Check: 2(1/3) = 2/3, and -1/3 + 1 = 2/3. The exact solution is (1/3, 2/3).