Ad Space

Two Points

Slope (m)

Slope-Intercept Form
Point-Slope Form

Both points share the same x-coordinate, so this is a vertical line. Slope is undefined — a vertical line has no "rise over run" ratio. The line's equation is simply x = the shared x-value.

Ad Space

How to Calculate Slope Between Two Points

Slope measures how steep a line is — how much y changes for every unit x changes. Given two points on a line, the slope formula is "rise over run": the change in y divided by the change in x.

m=y2y1x2x1m = \frac{y_2 - y_1}{x_2 - x_1}

m: the slope of the line.

(x1, y1): the first point.

(x2, y2): the second point.

For a worked example, take the points (1, 2) and (4, 8). The change in y is 8 minus 2, which is 6; the change in x is 4 minus 1, which is 3. Dividing gives a slope of 2. In plain terms, this line rises 2 units for every 1 unit it moves to the right — a fairly steep upward line. A slope of 0 would be perfectly flat, and a negative slope means the line falls as it moves rightward instead of rising.

Finding the Line Equation — Slope-Intercept and Point-Slope Form

Once you have the slope, you can write the full equation of the line two common ways. Slope-intercept form solves for the y-intercept (where the line crosses the y-axis) using either point:

y=mx+bwhereb=y1mx1y = mx + b \quad \text{where} \quad b = y_1 - m x_1

Point-slope form skips solving for the intercept entirely and just anchors the line to one known point:

yy1=m(xx1)y - y_1 = m(x - x_1)

Continuing the example above: with m = 2 and the point (1, 2), the y-intercept is b = 2 − 2(1) = 0, so the slope-intercept form is y = 2x + 0, or simply y = 2x. The point-slope form using the same point is y − 2 = 2(x − 1). Both describe the exact same line — they're just written from different starting information.

The Vertical Line Case — Why Slope Can Be Undefined

If both points share the same x-coordinate, the line is perfectly vertical, and the slope formula's denominator (the change in x) becomes zero. Division by zero has no defined value, so the slope of a vertical line is undefined — not infinite, not zero, simply undefined. A vertical line's equation is just x = (the shared x-value), since it doesn't fit the y = mx + b form at all (there's no way to write a vertical line as "y equals something in terms of x," since every y-value shares the same single x).

Common Slope Mistakes

Flipping the order of subtraction — computing x2 − x1 in the numerator and y2 − y1 in the denominator — silently inverts and negates the correct slope. Another frequent error is mixing which point is "point 1" and which is "point 2" between the numerator and denominator (using y2 − y1 but x1 − x2); as long as the same order is used consistently in both, the result is correct, but mixing the order changes the sign. Treating a horizontal line's zero slope the same as a vertical line's undefined slope is also a common mix-up — they are opposite cases, not the same thing.

Slope Terms You Should Know

Rise — the vertical change (change in y) between two points on a line.

Run — the horizontal change (change in x) between two points on a line.

Y-Intercept — the point where a line crosses the y-axis, where x equals 0.

Linear Equation — an equation describing a straight line, most commonly written as y = mx + b.

Frequently Asked Questions

What does it mean when the slope is undefined?

An undefined slope happens when the two points share the same x-coordinate, forming a vertical line. The slope formula would require dividing by zero (the change in x is zero), which has no defined value.

What is the difference between slope-intercept form and point-slope form?

Slope-intercept form (y = mx + b) is written in terms of the slope and the y-intercept. Point-slope form (y − y1 = m(x − x1)) is written in terms of the slope and one specific known point on the line. Both describe the exact same line.

What does a negative slope mean?

A negative slope means the line falls as you move from left to right — y decreases as x increases. A positive slope rises left to right, and a slope of zero is a perfectly flat horizontal line.

Ad Space