Sub topic 4
Rewriting equations in slope-intercept form
This chapter covers one skill: converting a linear equation into the form y = mx + b, so you can read its slope and y-intercept without graphing it. The next chapters use that skill to graph lines and to compare them. Here you will practice the rewriting itself, learn where it fails, and see how it predicts the outcome of a system.
Prerequisites
You should already be comfortable with these:
- Solving one-variable linear equations, including equations with fractions.
- Plotting points and lines on a coordinate plane.
- Integer and fraction arithmetic with negative numbers.
- The idea that a linear equation in x and y has many (x, y) pairs that satisfy it.
The two forms of a line
Two forms of a linear equation show up constantly in this tutorial.
- Standard form is Ax + By = C, where A, B, and C are numbers. Systems are usually written this way because it lines up the x terms, the y terms, and the constants in columns, which is what elimination needs.
- Slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept. The slope is how much y changes when x increases by 1. The y-intercept is the value of y where the line crosses the y-axis, at the point (0, b).
To avoid confusion, this chapter writes the intercept as k when it could be mistaken for the coefficient b in standard form. So slope-intercept form is y = mx + k here. Everywhere else in this chapter, B means the y coefficient in standard form.
Slope-intercept form is useful because both numbers describe the picture directly. The line y = -2x + 7 crosses the y-axis at 7 and falls 2 units for every 1 unit you move right. Standard form hides both facts.
The rewriting procedure
To convert Ax + By = C to slope-intercept form, you isolate y. Two steps do it:
- Move the x term to the right side by adding or subtracting it on both sides. This gives By = -Ax + C.
- Divide every term on both sides by B. This gives y = (-A/B)x + C/B.
So the slope is m = -A/B and the intercept is k = C/B. You can memorize those formulas, but working through the steps each time is safer because it catches sign slips.
Worked example 1: a positive y coefficient
Rewrite 2x + 3y = 12.
- Subtract 2x from both sides: 3y = -2x + 12.
- Divide every term by 3: y = (-2/3)x + 4.
The slope is -2/3 and the y-intercept is 4. To graph it, start at (0, 4). The slope -2/3 means "down 2, right 3," so the next point is (3, 2). Check it in the original equation: 2(3) + 3(2) = 6 + 6 = 12. It works.
Worked example 2: a negative y coefficient
Rewrite 4x - 2y = 6.
- Subtract 4x from both sides: -2y = -4x + 6.
- Divide every term by -2: y = 2x - 3.
Dividing by a negative number flips the sign of every term. This is the most common place for mistakes, and the next section lists the typical ones.
Worked example 3: a system
Take the system from earlier in this tutorial.
- 2x + y = 7 becomes y = -2x + 7.
- x - y = 2 becomes -y = -x + 2, then y = x - 2.
The slopes are -2 and 1, which differ, so the lines cross exactly once. You can find where by setting the right sides equal: -2x + 7 = x - 2 gives 9 = 3x, so x = 3. Then y = 3 - 2 = 1. The solution is (3, 1), the same answer elimination gave earlier. Slope-intercept form made the conclusion visible before any solving: different slopes mean one intersection.
Shortcut: using the intercepts
For an equation in standard form where C is not zero, you can also find the two axis crossings directly.
- Set x = 0 and solve for y. This gives the y-intercept.
- Set y = 0 and solve for x. This gives the x-intercept.
For 2x + 3y = 12, setting x = 0 gives y = 4, and setting y = 0 gives x = 6. The line passes through (0, 4) and (6, 0). The slope is the change in y over the change in x: (0 - 4)/(6 - 0) = -2/3, matching example 1.
This is often the quickest way to graph a line from standard form. Slope-intercept form is still the better choice when you want to compare slopes.
Special cases
Horizontal lines
If A = 0, the equation is By = C, so y = C/B. The slope is 0. For example, 0x + 2y = 6 is y = 3. In slope-intercept form, this is y = 0x + 3.
Vertical lines
If B = 0, the equation is Ax = C, so x = C/A. Every point on the line has the same x value, so there is no way to isolate y. A vertical line has an undefined slope and no slope-intercept form.
Equations that are not lines
If A and B are both 0, the equation reads 0 = C. If C is also 0, every point satisfies it. If C is not 0, no point does. Neither case is a line, so this chapter ignores them.
Common errors
| Mistake | Example | Fix |
|---|---|---|
| Dividing only some terms by B | 2x + 3y = 12 becomes y = -2x + 4 | Divide every term by 3, so the x term becomes -2/3 x |
| Forgetting to change sign when moving the x term | 2x + 3y = 12 becomes 3y = 2x + 12 | Subtracting 2x gives 3y = -2x + 12 |
| Mishandling a negative y coefficient | -2y = -4x + 6 becomes y = -2x + 3 | Divide by -2 each time: y = 2x - 3 |
| Leaving a negative y | -y = -x + 2 stopped there | Multiply or divide by -1 to get y = x - 2 |
| Reading the slope from standard form | Taking 2 as the slope of 2x + 3y = 12 | Rewrite first. The slope is -2/3 |
A reliable habit is to test your result with one point. Pick any x, compute y from your slope-intercept equation, and check that the pair satisfies the original equation. This is the same check-in-the-original idea you used for verifying system solutions.
Reading a system from slopes and intercepts
Once both equations are in slope-intercept form, you can classify the system by comparing numbers.
| Slopes | Intercepts | What the lines do | Number of solutions |
|---|---|---|---|
| Different | Any | Cross once | Exactly one |
| Same | Different | Parallel, never meet | None |
| Same | Same | Identical line | Infinitely many |
Here are the two non-crossing cases from the earlier examples.
- y = 2x + 1 and y = 2x - 3 both have slope 2, but the intercepts are 1 and -3. They are parallel, so there is no solution.
- x + y = 3 becomes y = -x + 3. The equation 2x + 2y = 6 becomes 2y = -2x + 6, then y = -x + 3. These are the same line, so every point on it is a solution.
If one line is vertical, it has no slope, so compare differently. A vertical line and any non-vertical line always cross once. Two vertical lines are parallel if their x values differ and identical if they match.
The next chapters build on this table. For now, notice that rewriting costs two short steps and gives you the answer to "how many solutions?" before you start solving.
Checking your work with code
The function below applies the procedure with exact fractions, so you can compare it to your hand work. It also handles the vertical-line case by returning None, and it classifies a system using the table above.
from fractions import Fraction
def to_slope_intercept(a, b, c):
"""Rewrite a*x + b*y = c as y = m*x + k.
Returns (m, k) as Fractions, or None when b == 0 (vertical line).
Assumes a and b are not both zero.
"""
if b == 0:
return None
return Fraction(-a, b), Fraction(c, b)
def classify(line1, line2):
"""Classify a system of two lines, each given as (a, b, c)."""
s1 = to_slope_intercept(*line1)
s2 = to_slope_intercept(*line2)
if s1 is None and s2 is None:
# Both vertical: compare x = c/a
same_x = Fraction(line1[2], line1[0]) == Fraction(line2[2], line2[0])
return "same line" if same_x else "parallel"
if s1 is None or s2 is None:
return "one intersection"
(m1, k1), (m2, k2) = s1, s2
if m1 != m2:
return "one intersection"
return "same line" if k1 == k2 else "parallel"
print(to_slope_intercept(2, 3, 12)) # (Fraction(-2, 3), Fraction(4, 1))
print(to_slope_intercept(4, -2, 6)) # (Fraction(2, 1), Fraction(-3, 1))
print(to_slope_intercept(1, 0, 5)) # None (the vertical line x = 5)
print(classify((2, 1, 7), (1, -1, 2))) # one intersection
print(classify((-2, 1, 1), (-2, 1, -3))) # parallel
print(classify((1, 1, 3), (2, 2, 6))) # same lineThe first call returns slope -2/3 and intercept 4, matching worked example 1. The second returns slope 2 and intercept -3, matching worked example 2. Fractions are used instead of floats because comparing slopes with == is only reliable when the arithmetic is exact. With floats, a slope such as 1/3 can differ slightly between two computations of the same line.
When slope-intercept form is not the best choice
Rewriting is not always worth it. Fractions appear whenever B does not divide A and C evenly. For 3x + 7y = 5, the form y = (-3/7)x + 5/7 is accurate but awkward to graph and to substitute. In that case, the intercept shortcut or elimination in standard form may be cleaner. Slope-intercept form is strongest when one equation already has y alone, or when you need to compare slopes quickly.
Exercise
Rewrite 3x - 4y = 8 in slope-intercept form. State the slope and the y-intercept.
Show answer
Subtract 3x from both sides: -4y = -3x + 8. Divide every term by -4: y = (3/4)x - 2. The slope is 3/4 and the y-intercept is -2. Check with x = 4: y = 3 - 2 = 1, and 3(4) - 4(1) = 8.
Exercise
Without graphing or solving, decide how many solutions the system 6x - 3y = 9 and y = 2x + 5 has.
Show answer
Rewrite the first equation: -3y = -6x + 9, so y = 2x - 3. Both lines have slope 2, but the intercepts are -3 and 5. The lines are parallel and distinct, so the system has no solution.
Exercise
A student rewrites 2x + 5y = 10 as y = -2x + 2. Find the error and give the correct form.
Show answer
The student divided only the constant by 5 and left the x coefficient unchanged. After subtracting 2x, the equation is 5y = -2x + 10. Dividing every term by 5 gives y = (-2/5)x + 2. The slope is -2/5, not -2.