# Equation of a Line Passing Through Two Points

The **equation of a line passing through two distinct points** \( (x_1, y_1) \) and \( (x_2, y_2) \) on the plane can be found using the following formula: $$ \frac{y-y_1}{y_2-y_1}= \frac{x-x_1}{x_2-x_1} $$ Through any two distinct points on a plane, there is exactly one line that can be drawn.

This formula is also known as the "**collinearity condition**".

It allows you to derive the equation of the line.

$$ ax+by+c=0 $$

This is often presented in this equivalent form.

$$ \frac{y-y_1}{x-x_1}= \frac{y_2-y_1}{x_2-x_1} $$

Where \( m = \frac{y_2-y_1}{x_2-x_1} \) is the slope (m) of the line in the explicit form **y=mx+b**.

$$ \frac{y-y_1}{x-x_1}= m $$

## Example

I need to find the equation of the line passing through two distinct points A and B on the plane.

Point A is located at coordinates \( (x_1,y_1)=(1, 2) \) and point B at coordinates \( (x_2,y_2)= (4, 5) \)

I use the formula for the line passing through two points.

$$ \frac{y-y_1}{y_2-y_1}= \frac{x-x_1}{x_2-x_1} $$

In this case, the coordinates of the two points are \( x_1=1 \), \( y_1=2 \) and \( x_2=4 \), \( y_2=5 \).

$$ \frac{y-2}{5-2}= \frac{x-1}{4-1} $$

$$ \frac{y-2}{3}= \frac{x-1}{3} $$

By multiplying both sides by 3, we simplify the equation.

$$ \frac{y-2}{3} \cdot 3= \frac{x-1}{3} \cdot 3 $$

$$ y-2 = x-1 $$

Move all terms to one side of the equation.

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

$$ y - x -1 = 0 $$

Thus, we find the implicit form of the equation **y-x-1=0** for the line passing through the points (1,2) and (4,5).

To convert to explicit form, solve for y in terms of the other variables.

$$ y = x+1 $$

Next, substitute different values for the independent variable x to find the corresponding y values.

$$ \begin{array}{c|c} x & y=x+1 \\ \hline -1 & 0 \\ 0 & 1 \\ 1 & 2\\ 2 & 3 \end{array} $$

This gives us additional points on the line.

__Alternative Solution__

Alternatively, you can use the coordinates of the two points to calculate the slope (m) of the line, which is given by:

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

This formula indicates how much the line "rises" or "falls" as you move from left to right along the x-axis.

Given the coordinates \( x_1=1 \), \( y_1=2 \), and \( x_2=4 \), \( y_2=5 \).

$$ m = \frac{5 - 2}{4 - 1} $$

$$ m = \frac{3}{3} $$

$$ m = 1 $$

Once you have the slope, you can use the point-slope form of the line equation:

$$ y - y_1 = m \cdot (x - x_1) $$

Substituting \( m=1 \).

$$ y - y_1 = 1 \cdot (x - x_1) $$

$$ y - y_1 = x - x_1 $$

Given \( x_1=1 \), \( y_1=2 \)

$$ y - 2 = x - 1 $$

Solve for y to get the line equation

$$ y = x - 1 + 2 $$

$$ y = x + 1 $$

The final result is always the same.

The equation of the line passing through the points \( (1, 2) \) and \( (3, 8) \) is \( y = 3x - 1 \).

### Example 2

Let’s consider two distinct points on the plane: P_{1}(7,4) and P_{2}(4,2).

The equation of the line passing through points P_{1} and P_{2} is:

$$ \frac{x-x_1}{x_2-x_1} = \frac{y-y_1}{y_2-y_1} $$

Here, (x_{1}, y_{1}) = (7,4) and (x_{2}, y_{2}) = (4,2).

Substituting the values x_{1}=7, x_{2}=4, y_{1}=4, and y_{2}=2, we get:

$$ \frac{x-7}{4-7} = \frac{y-4}{2-4} $$

$$ \frac{x-7}{-3} = \frac{y-4}{-2} $$

Now, let’s solve for y:

$$ \frac{x}{-3} + \frac{-7}{-3} = \frac{y}{-2} + \frac{-4}{-2} $$

$$ \frac{y}{-2} = \frac{x}{-3} + \frac{-7}{-3} - 2 $$

$$ y = (-2) \cdot \left[ \frac{x}{-3} + \frac{7-6}{3} \right] $$

$$ y = (-2) \cdot \left[ \frac{x}{-3} + \frac{1}{3} \right] $$

$$ y = \frac{2}{3}x - \frac{2}{3} $$

This is the explicit equation of the line passing through the points P_{1}(7,4) and P_{2}(4,2).

By varying x, you can find all the points on this line.

## Proof

To prove the formula for the line passing through two points, consider three points on the plane \( (x_1;y_1) \), \( (x_2;y_2) \), \( (x;y) \).

Assume that the same line passes through each point.

Thus, we construct a system of equations.

$$ \begin{cases} ax_1+by_1+c=0 \\ ax_2+by_2+c=0 \\ ax+by+c=0 \end{cases} $$

Using the reduction method, subtract the first equation from the second and third equations.

$$ \begin{cases} a(x_2-x_1)+b(y_2-y_1)=0 \\ a(x-x_1)+b(y-y_1)=0 \end{cases} $$

$$ \begin{cases} a(x_2-x_1) = - b(y_2-y_1) \\ a(x-x_1) = - b(y-y_1) \end{cases} $$

$$ \begin{cases} \frac{x_2-x_1}{y_2-y_1}= - \frac{b}{a} \\ \frac{x-x_1}{y-y_1}= - \frac{b}{a} \end{cases} $$

By comparing the two equations, it is evident that both are equal to -b/a.

Therefore, we can write the equality as follows:

$$ \frac{x_2-x_1}{y_2-y_1}= \frac{x-x_1}{y-y_1} $$

Finally, with a simple algebraic step, we obtain the **collinearity condition**

$$ \frac{y-y_1}{y_2-y_1}= \frac{x-x_1}{x_2-x_1} $$

This proves the formula for the equation of a line passing through two distinct points \( (x_1;y_1) \) and \( (x_2;y_2) \) on the plane.

### Alternative Approach

Let's consider two distinct points in the plane: P_{1}(x_{1}, y_{1}) and P_{2}(x_{2}, y_{2}).

We'll use the concept of a line bundle to derive the equation of lines that pass through point P_{1}.

$$ y - y_1 = m(x - x_1) $$

Here, m is the slope of the line, which can take on infinitely many values—one for each possible inclination of the line, except for the line parallel to the y-axis.

The slope of the line passing through the points P_{1} and P_{2} is given by:

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

Substituting this slope into the equation of the line bundle passing through point P_{1}, we have:

$$ y - y_1 = m(x - x_1) $$

$$ y - y_1 = \frac{y_2 - y_1}{x_2 - x_1}(x - x_1) $$

Now, let's separate the variables y and x on both sides of the equation:

$$ \frac{y - y_1}{y_2 - y_1} = \frac{x - x_1}{x_2 - x_1} $$

This gives us the equation of the line passing through the two points.

## The Line Passing Through Two Points in Linear Algebra

We can also demonstrate the equation of the line passing through two points using the framework of linear algebra.

This approach requires some familiarity with vector and matrix operations.

### Proof

Given two points in the plane:

$$ P_1 \begin{pmatrix} x_1 \\ y_1 \end{pmatrix} $$ $$ P_2 \begin{pmatrix} x_2 \\ y_2 \end{pmatrix} $$

The line passing through P_{1} and P_{2} can be represented by the following **direction vector** P_{1}P_{2}:

$$ v_r \equiv \begin{pmatrix} x_2 - x_1 \\ y_2 - y_1 \end{pmatrix} $$

Using this direction vector, we can write the **vector equation** of the line as:

$$ \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} x_1 \\ y_1 \end{pmatrix} + t \cdot \begin{pmatrix} x_2 - x_1 \\ y_2 - y_1 \end{pmatrix} $$

From this, we can derive the system of **parametric equations** for the line, starting from P_{1}:

$$ \begin{cases} x = x_1 + t \cdot (x_2 - x_1) \\ y = y_1 + t \cdot (y_2 - y_1) \end{cases} $$

**Note**: Starting from P_{2} would yield a different set of parametric equations, but the final result remains the same. Therefore, for this demonstration, we can choose either set of parametric equations. $$ \begin{cases} x = x_2 + t \cdot (x_2 - x_1) \\ y = y_2 + t \cdot (y_2 - y_1) \end{cases} $$

For a generic point P on the line, this forms a vector relative to point P_{1}:

$$ \overrightarrow{P_1P} = P - P_1 = \begin{pmatrix} x - x_1 \\ y - y_1 \end{pmatrix} $$

This vector P_{1}P must be parallel and proportional to the direction vector P_{1}P_{2} because it lies on the same line r, which is defined by the direction vector v_{r}.

Therefore, the two vectors P_{1}P and P_{1}P_{2} must be linearly dependent.

Placing the two vectors as columns in a matrix, the determinant must be zero.

$$ det \begin{pmatrix} x - x_1 & x_2 - x_1 \\ y - y_1 & y_2 - y_1 \end{pmatrix} = 0 $$

Calculating the determinant, we get:

$$ (x - x_1) \cdot (y_2 - y_1) - (x_2 - x_1) \cdot (y - y_1) = 0 $$

With a few more algebraic steps, this leads to the **Cartesian equation of the line**:

$$ (x - x_1) \cdot (y_2 - y_1) = (x_2 - x_1) \cdot (y - y_1) $$

$$ \frac{x - x_1}{x_2 - x_1} = \frac{y - y_1}{y_2 - y_1} $$

This gives us the general formula for the equation of the line passing through two points.

And that concludes the demonstration.

### A Practical Example

Let's consider two points in the plane: P_{1} and P_{2}.

$$ P_1 \begin{pmatrix} x_1 \\ y_1 \end{pmatrix} = P_1 \begin{pmatrix} 7 \\ 4 \end{pmatrix} $$

$$ P_2 \begin{pmatrix} x_2 \\ y_2 \end{pmatrix} = P_2 \begin{pmatrix} 4 \\ 2 \end{pmatrix} $$

Their graphical representation is as follows:

If we fix a direction from P_{1} to P_{2}, we obtain the vector P_{1}P_{2}:

$$ \overrightarrow{P_1P_2} = P_2 - P_1 = \begin{pmatrix} 4 \\ 2 \end{pmatrix} - \begin{pmatrix} 7 \\ 4 \end{pmatrix} = \begin{pmatrix} 4 - 7 \\ 2 - 4 \end{pmatrix} = \begin{pmatrix} -3 \\ -2 \end{pmatrix} $$

The **vector equation** of the line is:

$$ \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} x_1 \\ y_1 \end{pmatrix} + t \cdot \begin{pmatrix} x_2 - x_1 \\ y_2 - y_1 \end{pmatrix} $$

$$ \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 7 \\ 4 \end{pmatrix} + t \cdot \begin{pmatrix} 4 - 7 \\ 2 - 4 \end{pmatrix} $$

$$ \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 7 \\ 4 \end{pmatrix} + t \cdot \begin{pmatrix} -3 \\ -2 \end{pmatrix} $$

From this, we can derive the ** parametric equation** of the line:

$$ \begin{cases} x = 7 - 3t \\ y = 4 - 2t \end{cases} $$

Using the parametric equation, we can plot all the points on the line by varying the value of the parameter t.

Therefore, a generic **point on the line** can be expressed as:

$$ P \begin{pmatrix} 7 - 3t \\ 4 - 2t \end{pmatrix} \quad \text{where} \quad t \in \mathbb{R} $$

When t = 0, we get the point P_{1}, which is the starting point of the vector P_{1}P_{2}.

As t increases, the point moves toward P_{2}.

When t = 1, we reach P_{2}, the endpoint of the vector P_{1}P_{2}.

Now let's find the Cartesian equations.

A line r also passes through points P_{1} and P_{2}.

For a generic point P on line r:

$$ P \begin{pmatrix} x \\ y \end{pmatrix} $$

The point P and the starting point P_{1} form another vector, P_{1}P:

$$ \overrightarrow{P_1P} = \begin{pmatrix} x \\ y \end{pmatrix} - \begin{pmatrix} 7 \\ 4 \end{pmatrix} $$

$$ \overrightarrow{P_1P} = \begin{pmatrix} x - 7 \\ y - 4 \end{pmatrix} $$

The vector P_{1}P, which lies on line r, is proportional to the geometric vector P_{2}P_{1} we calculated earlier (i.e., v_{r}), because line r passes through the same points P_{1} and P_{2}.

$$ \overrightarrow{P_1P} = \begin{pmatrix} x - 7 \\ y - 4 \end{pmatrix} $$

$$ \overrightarrow{P_1P_2} = \begin{pmatrix} -3 \\ -2 \end{pmatrix} $$

The two vectors are proportional vectors if they are linearly dependent.

In this case, the determinant of the matrix formed by the two vectors as columns must be zero.

$$ det \begin{pmatrix} x - 7 & -3 \\ y - 4 & -2 \end{pmatrix} = 0 $$

Calculating the determinant gives us the **Cartesian equation** of the line:

$$ (x - 7)(-2) - (-3)(y - 4) = 0 $$

$$ -2x + 14 + 3y - 12 = 0 $$

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

We can now express one of the coordinates, x or y, in terms of the other.

$$ y = \frac{2x - 2}{3} $$

**Why is knowing the Cartesian equation useful?** It allows us to determine whether a point in the plane with coordinates (x, y) lies on the line.

And so on.