homechevron_rightStudychevron_rightMathchevron_rightAlgebrachevron_rightlinear algebra

# Line equation from two points

This online calculator finds the equation of a line given two points it passes through, in slope-intercept and parametric forms

These online calculators find the equation of a line from 2 points.
First calculator finds the line equation in slope-intercept form, that is, $y=ax+b$. It also outputs slope and intercept parameters and displays line on a graph.
Second calculator finds the line equation in parametric form, that is, $x=at+x_0\\y=bt+y_0$. It also outputs direction vector and displays line and direction vector on a graph.

A bit of theory can be found below the calculators.

### Slope-intercept line equation from 2 points

#### Second point

Line equation

Slope

Intercept

Digits after the decimal point: 2

### Parametric line equation from 2 points

#### Second point

Equation for x

Equation for y

Direction vector

Digits after the decimal point: 2

## Slope-intercept line equation

Let's find slope-intercept form of line equation from the two known points $(x_0, y_0)$ and $(x_1, y_1)$.
We need to find slope a and intercept b.
For two known points we have two equations in respect to a and b
$y_0=ax_0+b\\y_1=ax_1+b$

Let's subtract the first from the second
$y_1 - y_0=ax_1 - ax_0+b - b\\y_1 - y_0=ax_1 - ax_0\\y_1 - y_0=a(x_1 -x_0)$
And from there
$a=\frac{y_1 - y_0}{x_1 -x_0}$

Note that b can be expressed like this
$b=y-ax$
So, once we have a, it is easy to calculate b simply by plugging $x_0, y_0, a$ or $x_1, y_1, a$ to the expression above.

## Parametric line equations

Let's find out parametric form of line equation from the two known points $(x_0, y_0)$ and $(x_1, y_1)$.
We need to find components of the direction vector also known as displacement vector.
$D=\begin{vmatrix}d_1\\d_2\end{vmatrix}=\begin{vmatrix}x_1-x_0\\y_1-y_0\end{vmatrix}$
This vector quantifies the distance and direction of an imaginary motion along a straight line from the first point to the second point.

Once we have direction vector from $x_0, y_0$ to $x_1, y_1$, our parametric equations will be
$x=d_1t+x_0\\y=d_2t+y_0$
Note that if $t = 0$, then $x = x_0, y = y_0$ and if $t = 1$, then $x = x_1, y = y_1$