# Equation of a line through points

Last updated: September 30, 2021

## How to calculate an equation of a line through points

A straight line is an infinite one-dimensional shape and does not contain any amplitude. A straight line can be a combination of endless points connected to each side to some extent. A straight line doesn't have any curve in it. These lines are usually horizontal, vertical, or inclined. If we draw an angle between any two points on the straight line, and the angle of a straight line is always equal to $$180^{\circ}$$.

## E3.4: Interpret and obtain the equation of a straight-line graph.

When expressed algebraically as an equation in terms of $$x$$ and $$y$$, the relationship is the straight-line equation. A line segment can be defined as a connection between these two points.

The equation of the line through the two points can be written in the form:

$$y-y_{1}=m \left( x-x_{1} \right )$$

Where $$m$$ is the slope of the line having the value $$m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}$$, $$x_{1}$$ is the coordinate of the $$x$$ axis, $$y_{1}$$ is the coordinate of the $$y$$ axis. ### Worked examples of calculating an equation of a line through points

Example 1: Calculate the equation of the straight line passing through the points$$A\left ( 1,2 \right )$$ and $$B\left ( -1,3 \right )$$ in the form $$ax+by+c=0$$.

Step 1: Identify the $$x$$ coordinates and $$y$$ coordinates of the given points.

$$A\left ( 1,2 \right ) = \left ( x_{1},x_{2} \right )$$

$$B\left ( -1,3 \right ) = \left ( y_{1},y_{2} \right )$$

Step 2: Recall the formula for the equation of the straight line.

$$y-y_{1}=m\left ( x-x_{1} \right )$$

Where $$m$$ is the gradient of the line having the value $$m=\frac{y_{2}-y_{1}}{x_{2}-x_{1}}$$

Step 3: Calculate the value of the gradient of the line.

$$m=\frac{3-2}{-1-1}$$

That gives, $$m=\frac{1}{-2}$$

Step 4: Now substitute the values in the formula.

$$y-2=\frac{1}{-2} \left ( x-1 \right )$$

Step 5: Simplify the equation to get the equation in the required form.

$$y-2=\frac{1}{-2}\left ( x-1 \right )$$

Step 6: Multiplying both the sides by $$-2$$.

$$-2\left ( y-2 \right )=x-1$$

Step 7: Solve further.

$$-2y+4&=x-1$$

$$x+2y-5=0$$

Therefore, the equation of the line in the required form is $$x+2y-5=0$$

Step 8: Use the $$x$$ coordinates and the $$y$$ coordinates to graph the equation. 