Equation of a Line Through Two Points

By Robert O

We need at least two points to find the equation of a line if we don’t have any information about its gradient. Equation of any line takes the slope-intercept form, y = m x + c and we can always express any equation in this form if we have two sets of coordinates of any two points on the line.

What are the steps of finding the equation of a line which passes through two points?

The first step is to calculate the gradient or slope of the line using the two sets of coordinates.

Step two is to apply the point-slope formula to get the equation in y and x.

The third and last step is just simplification. You also need to express your equation of a line in the form of y = m x+c.

Example 1

Derive the equation of a line with these two points: (1, 2) and (4, 5).

Solution

We find the value of m (slope or gradient) using the formula:

    \[m=\frac{\text { change in } y}{\text { change in } x}=\frac{y 2-y 1}{x 2-x 1}\]

    \[m=\frac{5-2}{4-1}=1\]

You can also calculate m by

    \[m=\frac{\text { change in } y}{\text { change in } x}=\frac{y 1-y 2}{x 1-x 2}\]

The value of m is still 1.

We move to step two, which is the application of the point-slope formula. In this step, we pick the third point with arbitrary coordinates (x, y).

    \[m=1=\frac{5-y}{4-x}\]

We now simplify:

    \[5-y=4-x\]

    \[y=x+1\]

Example 2:

Derive the equation of a line with the following coordinates on it: A(2, -3) and B(-4, 1).

Solution

Follow the steps as in example 1.

    \[m=\frac{\text { change in } y}{\text { change in } x}=\frac{y 2-y 1}{x 2-x 1}=\frac{1-(-3)}{-4-2}=-\frac{2}{3}\]

    \[-\frac{2}{3}=\frac{y-1}{x-(-4)}\]

    \[-2(x+4)=3 y-3\]

    \[3 y-3=-2 x-8\]

    \[y=-\frac{2}{3} x-\frac{5}{3}\]

Example 3

A line passes through a point A (2, 2) and has a gradient of -4. What is the equation of this line?

Solution

Since m = -4, we skip step 1.

    \[m=-4=\frac{y-2}{x-2}\]

    \[y-2=-4 x+8\]

    \[y=-4 x+10\]

Remarks

Getting an equation of a line through 4 points is as easy as calculating its slope and equating it to the expression for slope formula using an arbitrary point. It is even easier when you already have the gradient of a line and the coordinates of one point. Simplify the resulting equation and express it in the form of y=m x+c.

About the Author

This lesson was prepared by Robert O. He holds a Bachelor of Engineering (B.Eng.) degree in Electrical and electronics engineering. He is a career teacher and headed the department of languages and assumed various leadership roles. He writes for Full Potential Learning Academy.