Any straight line in Cartesian coordinates – the graphing system you're used to – can be represented by a basic algebraic equation. Although there are two standardized forms of writing out the equation for a line, slope-intercept form is usually the first method you learn; it reads y = mx + b, where m is the slope of the line and b is where it intercepts the y axis. Even if you aren't handed these two pieces of information, you can use other data – like the location of any two points on the line – to figure it out.
Solving for Slope-Intercept Form From Two Points
Imagine that you've been asked to write the slope-intercept equation for a line that passes through the points (-3, 5) and (2, -5).
Find the Slope of the Line
Calculate the slope of the line. This is often described as rise over run, or the change in the y coordinates of the two points over the change in x coordinates. If you prefer mathematical symbols, that's usually represented as ∆y/∆x. (You read "∆" out loud as "delta," but what it really means is "the change in.")
Sciencing Video Vault
So, given the two points in the example, you arbitrarily choose one of the points to be the first point in the line, leaving the other to be the second point. Then subtract the y values of the two points:
5 - (-5) = 5 + 5 = 10
This is the difference in y values between the two points, or ∆y, or simply the "rise" in your rise over run. No matter what you call it, this becomes the numerator or top number of the fraction that will represent your line's slope.
Next, subtract the x values of your two points. Make sure you keep the points in the same order you had them when you subtracted the y values:
-3 - 2 = -5
This value becomes the denominator, or the bottom number, of the fraction that represents the line's slope. So when you write the fraction out, you have:
Reducing this to lowest terms, you have -2/1, or simply -2. Although the slope starts as a fraction, it's okay for it to simplify to a whole number; you don't have to leave it in fraction form.
Substitute Slope Into the Formula
When you insert the slope of the line into your point-slope equation, you have y = -2_x_ + b. You're almost there, but you still need to find the y-_intercept that _b represents.
Solve for the Y-Intercept
Choose either of the points you were given and substitute those coordinates into the equation you have so far. If you chose the point (-3, 5), that would give you:
5 = -2(-3) + b
Now solve for b. Begin by simplifying like terms:
5 = 6 + b
Then subtract 6 from both sides, which gives you:
-1 = b or, as it would more commonly be written out, b = -1.
Substitute Y-Intercept Into the Formula
Insert the y-intercept into the formula. This leaves you with:
y = -2_x_ + (-1)
After simplifying, you'll have the equation of your line in point-slope form:
y = -2_x_ - 1