Plot any two points on a plane. There's exactly one line through both of them. With just one point, infinitely many lines could pass through it (like a clock hand that can point any direction around a single fixed center) — but the moment you have a second point, the direction locks in, and only one line remains.

To write this line as an equation, you first need its slope. The slope is a number that tells you "how much y changes when x increases by 1."

Slope m = (y₂ − y₁) / (x₂ − x₁)

For example, the slope of the line through A(−3, −2) and B(4, 3) is (3−(−2)) / (4−(−3)) = 5/7. Once you have the slope, you can use it together with one point (say, A) to build the full equation of the line.

y − y₁ = m(x − x₁)

This is called point-slope form. You can rearrange it into the more familiar y = mx + b form (slope-intercept form), or into ax + by + c = 0 form (general form). All three describe the exact same line, but one form or another is more convenient depending on the situation.

There's one thing to watch out for. If the two points share the same x-coordinate (say, (2, 1) and (2, 5)), the denominator in the slope formula becomes 0. A line like this shoots straight up and down — a vertical line — and its slope is said to be "undefined." In this case, the equation is written using just the x-coordinate, like x = 2.

Line AB Perpendicular
When two lines meet at a right angle, the product of their slopes is always −1

The slope also tells you how two lines relate to each other. If two lines are parallel, their slopes are equal (m₁ = m₂) — they run side by side and never meet. If two lines meet at a right angle (perpendicular), multiplying their slopes always gives −1 (m₁ × m₂ = −1). For example, a line perpendicular to one with slope 2 has slope −1/2.

This condition turns out to be an important tool you'll keep using later on — for tangent lines to circles, areas of shapes, checking whether vectors are perpendicular, and more. On our activity page, you can freely move points A and B with sliders and watch the slope and equation (point-slope form, general form) update in real time, and use the parallel and perpendicular buttons to check the relationship between slopes yourself.