Equation of Line from 2 Points

Try it below:

Enter any two distinct points to calculate and view the equation of the line in the form ax+by+c=0ax + by + c = 0.

Enter any two distinct points that in the inputs below to see which equation they form.

Point 1

Point 2

Method:

Given two distinct points, say (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2), we can compute the slope:

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

Then use point-slope form:

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

Simplify and rearrange to get the equation in standard form:

ax+by+c=0ax + by + c = 0

If slope is zero because y1=y2y_1 = y_2, then the equation is simply;

yy1=0y - y_1 = 0

But if slope is infinite or undefined because x1=x2x_1 = x_2, then the equation is simply;

xx1=0x - x_1 = 0

Theory:

An equation for a line describes all the coordinates for which a given equation is satisfied.

x+y=5 x + y = 5

This equation has two variables and describes an infinite number of points on a single straight line where the two variables x and y interact to satisfy the equation.

We are considering a simpler case where we assume the graphing area to be the Cartesian plane, meaning there are only two axes. In a 2 axes system, a linear equation with one or two variables describes a line. However, the same equation describes a plane if we had a 3 axes system.

For a 3 axes system, an equation would need three variables to make a line instead of the two here.

There are multiple ways to define a line in the 2D Cartesian plane. Each method uses a different combination of values:

  • Two distinct points on the line
  • One point and the slope
  • The slope and y-intercept
  • The slope and x-intercept

All of these can define the same line, just with different types of information, this line can always be written as.

ax+by+c=0ax + by + c = 0

← Back to Calculators