How to find a linear equation from a graph

An equation in the slope-intercept form is written as

$$y=mx+b$$

Where m is the slope of the line and b is the y-intercept. You can use this equation to write an equation if you know the slope and the y-intercept.


Example

Find the equation of the line

How to find a linear equation from a graph

Choose two points that are on the line

How to find a linear equation from a graph

Calculate the slope between the two points

$$m=\frac{y_{2}\, -y_{1}}{x_{2}\, -x_{1}}=\frac{\left (-1 \right )-3}{3-\left ( -3 \right )}=\frac{-4}{6}=\frac{-2}{3}$$

We can find the b-value, the y-intercept, by looking at the graph

How to find a linear equation from a graph

b = 1

We've got a value for m and a value for b. This gives us the linear function

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

In many cases the value of b is not as easily read. In those cases, or if you're uncertain whether the line actually crosses the y-axis in this particular point you can calculate b by solving the equation for b and then substituting x and y with one of your two points.

We can use the example above to illustrate this. We've got the two points (-3, 3) and (3, -1). From these two points we calculated the slope

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

This gives us the equation

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

From this we can solve the equation for b

$$b=y+\frac{2}{3}x$$

And if we put in the values from our first point (-3, 3) we get

$$b=3+\frac{2}{3}\cdot \left ( -3 \right )=3+\left ( -2 \right )=1$$

If we put in this value for b in the equation we get

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

which is the same equation as we got when we read the y-intercept from the graph.

To summarize how to write a linear equation using the slope-interception form you

  1. Identify the slope, m. This can be done by calculating the slope between two known points of the line using the slope formula.
  2. Find the y-intercept. This can be done by substituting the slope and the coordinates of a point (x, y) on the line in the slope-intercept formula and then solve for b.

Once you've got both m and b you can just put them in the equation at their respective position.


Video lesson

Find the equation to the graph

How to find a linear equation from a graph

The equation of a straight line is usually written this way:

(or "y = mx + c" in the UK see below)

What does it stand for?


y = how far up

x = how far along

m = Slope or Gradient (how steep the line is)

b = value of y when x=0

How do you find "m" and "b"?

  • b is easy: just see where the line crosses the Y axis.
  • m (the Slope) needs some calculation:

m =  Change in Y Change in X

How to find a linear equation from a graph

Knowing this we can work out the equation of a straight line:

Example 1

How to find a linear equation from a graph

m = 2 1 = 2

b = 1 (value of y when x=0)

Putting that into y = mx + b gets us:

y = 2x + 1

With that equation we can now ...

... choose any value for x and find the matching value for y

For example, when x is 1:

y = 2×1 + 1 = 3

Check for yourself that x=1 and y=3 is actually on the line.

Or we could choose another value for x, such as 7:

y = 2×7 + 1 = 15

And so when x=7 you will have y=15

Positive or Negative Slope?

Going from left-to-right, the cyclist has to Push on a Positive Slope:

   

Example 2

m = −3 1 = −3

b = 0

This gives us:

y = −3x + 0

We do not need the zero! So:

y = −3x

Example 3: Vertical Line

How to find a linear equation from a graph

What is the equation for a vertical line?
The slope is undefined ... and where does it cross the Y-Axis?

In fact, this is a special case, and we use a different equation, not "y=...", but instead we use "x=...".

Like this:

x = 1.5

Every point on the line has x coordinate 1.5,
that is why its equation is x = 1.5

Rise and Run

Sometimes the words "rise" and "run" are used.

  • Rise is how far up
  • Run is how far along

And so the slope "m" is:

m = rise run

You might find that easier to remember.

Other Forms

We have been looking at the "slope-intercept" form. The equation of a straight line can be written in many other ways.

Another popular form is the Point-Slope Equation of a Straight Line.

358,359,517,518, 1156, 1157, 3204, 3205, 3206, 3207

Footnote

Country Note:

Different Countries teach different "notation" (as sent to me by kind readers):

In the US, Australia, Canada, Eritrea, Iran, Mexico, Portugal, Philippines and Saudi Arabia the notation is: y = mx + b
In the UK, Australia (also), Bahamas, Bangladesh, Belgium, Brunei, Bulgaria, Cyprus, Egypt, Germany, Ghana, India, Indonesia, Ireland, Jamaica, Kenya, Kuwait, Malaysia, Malawi, Malta, Nepal, New Zealand, Nigeria, Oman, Pakistan, Peru, Singapore, Solomon Islands, South Africa, Sri Lanka, Turkey, UAE, Zambia and Zimbabwe y = mx + c
In Afghanistan, Albania, Algeria, Brazil, China, Czech Republic, Denmark, Ethiopia, France, Lebanon, Netherlands, Kosovo, Kyrgyzstan, Norway, Poland, Romania, South Korea, Surinam, Spain, Tunisia and Viet Nam: y = ax + b
In Azerbaijan, China, Finland, Russia and Ukraine: y = kx + b
In Greece: ψ = αχ + β
In Italy: y = mx + q
In Japan: y = mx + d
In Cuba and Israel: y = mx + n
In Romania: y = gA + C
In Latvia and Sweden: y = kx + m
In Serbia and Slovenia: y = kx + n
   
In your country: let us know!

... but it all means the same thing, just different letters.

How do you find the linear function from a graph?

Writing Linear Functions From a Graph.
Find the slope by measuring the rise and run of the linear function..
Find the y-intercept by identifying where the function crosses the y-intercept..
Substitute the slope and y-intercept into the function..

How do you find an equation from a graph?

Steps to find the equation of a line from two points:.
Find the slope using the slope formula. ... .
Use the slope and one of the points to solve for the y-intercept (b). ... .
Once you know the value for m and the value for b, you can plug these into the slope-intercept form of a line (y = mx + b) to get the equation for the line..

How do you find the equation of a linear relation on a graph?

The equation of a linear relationship is y = mx + b, where m is the rate of change, or slope, and b is the y-intercept (The value of y when x is 0).

How do you find linear equations?

The slope-intercept form of a linear equation is y = mx + b. In the equation, x and y are the variables. The numbers m and b give the slope of the line (m) and the value of y when x is 0 (b). The value of y when x is 0 is called the y-intercept because (0,y) is the point at which the line crosses the y-axis.