# how do you do an equation on the straight line graph?how to show it the graph also.....sumtimes question cums like to do it using the graph

lfryerda | High School Teacher | (Level 2) Educator

Posted on

To find the equation of a staright line using a graph, we need any two points on the graph.  Then we can find the slope of the line.  Finally, using one of the points from the graph and the slope, you find the equation of the line.

For example, consider the graph

We can find any two points from this graph.  Let's pick the points `(-1,-3)` and `(2,3)`. It doesn't matter which two points we pick, since it will always get the same equation as long as your calculations are correct.

To find the slope of the line, use the formula `m={y_2-y_1}/{x_2-x_1}`.  In this case, that gives

`m={3-(-3)}/{2-(-1)}`

`={3+3}/{2+1}`

`=6/3`

`=2`

Now we substitute one of the points (it doesn't matter which one) into the equation of a line `y=mx+b` and solve for b.

In this case we have `3=2(2)+b` which we can solve

`b=3-4=-1`

Which means the equation of the line is `y=2x-1`.