Equation of Line Calculator

Find the equation of a line passing through two points A(x₁, y₁) and B(x₂, y₂).

Point A (x₁, y₁)

Point B (x₂, y₂)

Result

How to Find the Equation of a Line

You can determine the equation of any straight line if you know two points on that line.

Step-by-Step Method

  1. Find the Slope (m): Use the formula $m = \frac{y_2 - y_1}{x_2 - x_1}$.
  2. Use Point-Slope Form: Substitute the slope and one point $(x_1, y_1)$ into $y - y_1 = m(x - x_1)$.
  3. Simplify: Rearrange into Slope-Intercept form ($y = mx + b$) or Standard form ($Ax + By = C$).

Formulas

Slope: $$ m = \frac{y_2 - y_1}{x_2 - x_1} $$

Point-Slope Form: $$ y - y_1 = m(x - x_1) $$

Slope-Intercept Form: $$ y = mx + b $$

Example Problem

Question: Find the equation of the line passing through A(1, 2) and B(3, 6).

Step 1: Find Slope (m).
$$ m = \frac{6 - 2}{3 - 1} = \frac{4}{2} = 2 $$

Step 2: Use Point-Slope Form with (1, 2).
$y - 2 = 2(x - 1)$

Step 3: Convert to Slope-Intercept Form.
$y - 2 = 2x - 2$
$y = 2x - 2 + 2$
$y = 2x$

Answer: The equation is y = 2x (or $2x - y = 0$).

Frequently Asked Questions

What is the "b" in y = mx + b?

It represents the y-intercept, which is the point where the line crosses the vertical y-axis.

How do I handle vertical lines?

If $x_1 = x_2$, the slope is undefined. The equation is simply $x = x_1$.

How do I handle horizontal lines?

If $y_1 = y_2$, the slope is 0. The equation is simply $y = y_1$.

Related Tools