# Writing slope-intercept equations

CCSS Math: HSF.LE.A.2
Learn how to find the slope-intercept equation of a line from two points on that line.
If you haven't read it yet, you might want to start with our introduction to slope-intercept form.

## Writing equations from $y$-intercept and another point

Let's write the equation of the line that passes through the points $(0,3)$ and $(2,7)$ in slope-intercept form.
Recall that in the general slope-intercept equation $y=\maroonC{m}x+\greenE{b}$, the slope is given by $\maroonC{m}$ and the $y$-intercept is given by $\greenE{b}$.

### Finding $\greenE b$

The $y$-intercept of the line is $(0,\greenE{3})$, so we know that $\greenE{b}=\greenE{3}$.

### Finding $\maroonC m$

Recall that the slope of a line is the ratio of the change in $y$ over the change in $x$ between any two points on the line:
$\text{Slope}=\dfrac{\text{Change in }y}{\text{Change in }x}$
Therefore, this is the slope between the points $(0,3)$ and $(2,7)$:
\begin{aligned}\maroonC{m}&=\dfrac{\text{Change in }y}{\text{Change in }x} \\\\ &=\dfrac{7-3}{2-0} \\\\ &=\dfrac{4}{2} \\\\ &=\maroonC{2}\end{aligned}
In conclusion, the equation of the line is $y=\maroonC{2}x\greenE{+3}$.

Problem 1
Write the equation of the line.
Problem 2
Write the equation of the line.

## Writing equations from any two points

Let's write the equation of the line that passes through $(2,5)$ and $(4,9)$ in slope-intercept form.
Note that we are not given the $y$-intercept of the line. This makes things a little bit more difficult, but we are not afraid of a challenge!

### Finding $\maroonC m$

\begin{aligned} \maroonC{m}&=\dfrac{\text{Change in }y}{\text{Change in }x} \\\\ &=\dfrac{9-5}{4-2} \\\\ &=\dfrac{4}{2} \\\\ &=\maroonC{2} \end{aligned}

### Finding $\greenE b$

We know that the line is of the form $y=\maroonC{2}x+\greenE{b}$, but we still need to find $\greenE{b}$. To do that, we substitute the point $(2,5)$ into the equation.
Because any point on a line must satisfy that line’s equation, we get an equation that we can solve to find $\greenE{b}$.
Substituting $(2,5)$ into the equation is the same as substituting $x=2$ and $y=5$ into the equation.
Remember that every point on the graph of a two-variable equation is a solution of that equation. In other words, if we substitute the point into the equation we get a true statement.
To use a different equation as an example, the point $(3,1)$ is on the line $y=x-2$. This means that substituting the point into the equation will result in a true statement:
\begin{aligned}y&=x-2 \\\\ 1&=3-2&\small\gray{x=3\text{ and }y=1} \\\\ 1&=1 \end{aligned}
In our solution, we do the same thing, only we don't know the complete equation of the line. Substituting a point that we know is on the line will help us find the missing $\greenE{b}$.
\begin{aligned}y&=\maroonC{2}\cdot x+\greenE{b}\\\\ 5&=\maroonC{2}\cdot 2+\greenE{b}&\gray{x=2\text{ and }y=5}\\\\ 5&=4+\greenE{b}\\\\ \greenE{1}&=\greenE{b} \end{aligned}
In conclusion, the equation of the line is $y=\maroonC{2}x\greenE{+1}$.

A line passes through the points $(5,35)$ and $(9,55)$.