Writing & Graphing Linear Functions

Instructor: Deborah Schell

Deborah teaches college Accounting and has a master's degree in Educational Technology.

We can show the relationship between two variables using a table, a graph or an equation. In this lesson, you will learn how to write and graph linear functions.

What Is a Linear Function?

Let's meet Matt who missed math class while attending a swim meet. In his absence, the class covered linear functions, and while he has read the notes and the textbook, he is still struggling with the concept. Let's see if we can help Matt with this problem.

A linear function shows the relationship between two variables and always results in a graph that is a straight line. One of the variables is independent, which means it doesn't depend on the other variable. Independent variables are represented by x. The other variable in a linear function is dependent, which means its value depends on another variable and it is represented by y.

There are a number of different ways to express a linear function, such as a table, a graph or an equation. Let's look at these methods in more detail.

Expressing a Linear Function Using an Equation

A linear function is represented by the equation:

y = mx + b where:

y = the y-coordinate

m = the slope of the line, or how steep it is

x = the x coordinate

b = the y-intercept, or where the line crosses the y-axis on a graph

Let's see how we can use the equation to graph a linear function. How would we graph y = 2x + 3? The equation tells us that the slope of the line (m) = 2 and it crosses the y-axis (b) at 3. In order to graph the function, we need to have some ordered pairs. The best way to produce these points is to create a table of values that shows us the points that are on the line. When creating a table of values, it is always helpful to use some positive and some negative values for x so that you can get an idea of how the line behaves. Let's assume that we want to graph the values when x is -2, -1, 0, 1 and 2. The table of values would be:

table of values

Now that we have our ordered pairs, or a value for x and y, we can graph the equation y = 2x + 3 by plotting these pairs on a graph.

slope y intercept graph

We can see from the graph that the line crosses the y-axis at 3 or point (0, 3) and that the line slopes upward and to the right which indicates that the slope is positive. This is consistent with our equation, y=2x+3 as the slope of the line in this equation is +2. We can also note that all of the ordered pairs we calculated in our table of values are on the graph as well, specifically, (-2, -1), (-1, 1), (0, 3), (1, 5) and (2, 7).

Writing a Linear Function From a Graph

Let's try starting from a graph and writing the equation that goes with it. In order to write the linear function in the form of y=mx+b, we will need to determine the line's:

  • slope (m)
  • y-intercept (b)

slope graph to equation

We can tell from the graph that the slope of the line is negative because the line goes down and to the right. It looks like the y-intercept (b) of the graph is 2, as represented by point (0,2). Now we have to determine the slope of the line. In order to do this, we must use at least two points from the line. Let's choose (-2, 4) and (0, 2). We can use any two points since the slope is a straight line. To calculate slope, we use the following formula:

slope formula

Using our two points and substituting them into the formula, we get:

m = (4 - 2) / (-2 - 0)

m = 2 / -2

m = -1

We now know that the slope (m) = -1 and the y-intercept (b) is 2. When we put it all together, the equation for the line on the graph is:

y = mx + b

y = -1x + 2

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account