# How do I use the graph of a linear function to find its equation?

Jan 4, 2015

If you have two points on the graph, you can calculate the equation.

Select any two point on the graph. It may make life easier to have two points that are on gridlines in your graph. If one of the points is the $y$-intercept, it makes life a lot easier.
(the $y$-intercept is the point where your graph crosses the vertical, or $y$-axis)

You want to find the equation $y = m \cdot x + b$
where $m$ is called the slope, and $b$ the $y$-value at the $y$-intercept.

To calculate the slope $m$
Let's call the two points you selected $\left({x}_{1} , {y}_{1}\right)$ and $\left({x}_{2} , {y}_{2}\right)$
Then the slope is how fast $y$ changes relative to a change in $x$
Or in formula (in formulae, $\Delta$ means "change in..."):
$m = \frac{\Delta y}{\Delta x} = \frac{{y}_{2} - {y}_{1}}{{x}_{2} - {x}_{1}}$

To calculate the intercept $b$
If one of the points you selected is on the $y$-axis, then this $y$-value is equal to $b$.
Otherwise you fill in the equation $y = m x + b$ with the values for one of the points:
${y}_{1} = m {x}_{1} + b \to b = {y}_{1} - m {x}_{1} = {y}_{1} - \frac{{y}_{2} - {y}_{1}}{{x}_{2} - {x}_{1}} {x}_{1}$
(substituting the $m$ you already calculated in the previous step)

One example
Step 1: finding $m$
Your points are $\left(- 4 , - 2\right)$ and $\left(4 , 0\right)$

$m = \frac{{y}_{2} - {y}_{1}}{{x}_{2} - {x}_{1}} = \frac{0 - - 2}{4 - - 4} = \frac{2}{8} = \frac{1}{4}$

Step 2 : finding $b$
Substitute $x$ and $y$ for the right point (because it's easier)
$y = m x + b \to 0 = \frac{1}{4} \cdot 4 + b \to 0 = 1 + b \to b = - 1$
The complete equation will be: $y = \frac{1}{4} x - 1$
Fill in the $x$ of you other point (you should get the proper $y$)
$\frac{1}{4} \cdot \left(- 4\right) - 1 = - 1 - 1 = - 2$