In this explainer, we will learn how to graph linear functions.

If a relation or function can be represented graphically by a straight line,
we say that the relation or function is *linear*. For example, the
relationship between
degrees Celsius and
degrees Fahrenheit is linear. Converting from degrees Fahrenheit to
degrees Celsius,
we use the formula
, and as shown below,
its graph is a straight line. If an employee is paid by the
hour
(h)βfor
example, $20 per
hourβthen their salary (S) is a linear function of the
number of
hours they work:
. In economics, the price (P) and
demand (Q) for certain goods may be linearly related:
.

In each of these examples, we see that the graph of the function is a straight line. Further, each of these straight lines has a unique linear equation or function specifying the relationship between the two variables.

We recall that, in general, a function is a rule expressing the dependent, or output variable, often called , in terms of the independent, or input variable, often called . Each input value, , produces a unique output value, . The input and output values combine to form ordered pairs , or , and each ordered pair corresponds to the coordinates of one point on the graph of the function in the plane.

We define a linear function as follows.

### Definition: Linear Functions

The function , where
,
, and , is
called a **linear** function.

In the special case where , we call
the **constant** function.

For a linear function, the ordered pairs , or , is represented graphically as a point on a line. Letβs look at an example.

### Example 1: Graphing Linear Functions by Making Tables

Let us consider the function .

- Fill in the table.
0 1 - Identify the three points that lie on the line .

### Answer

**Part 1**

To fill in the table, we will need to calculate the values of the function associated with each of the three given values: , and 1. We do this by substituting each of the three values, in turn, into the function, as follows:

We can now complete the table with these three values.

0 | 1 | ||

**Part 2**

We are also asked to identify the three points in the graph that lie on the line . Now, in creating a table of values for a function, we produce ordered pairs, which are coordinates on the graph of that function. From the table, we see that the three ordered pairs for our function are , , and . If we plot these on our graph, we will see which of the given points they coincide with. Plotting our first point, , we see that, on our graph, this coincides with the point labeled I.

Our next point, , coincides with point H on the graph.

Finally, plotting our third point, , we see that this coincides with point G on our graph.

Therefore, the three points that lie on the line are points I, H, and G, as shown in the diagram below.

In our next example, we are given a table with some known and some unknown values. We use the known values to identify the graph of the linear relation and then the graph to identify the unknown values.

### Example 2: Identifying the Graph of a Linear Relation given Values from a Table and Determining Unknowns Using the Graph

The following table represents a linear function.

0 | 1 | 2 | 3 | |

1 | 3 |

- Which of the following graphs represents this line?
- Find the values of and .
- Write the equation of the straight line in the form .

### Answer

**Part 1**

In the table, we have the - and -values for two ordered pairs, , of the linear relation. These are and representing two points on the line. Comparing with the given graphs, we see that only the lines in graphs B and C go through the point . In fact, only graph B goes through both the given points.

Therefore, the linear relation is represented by graph B.

**Part 2**

We can now use graph B to find the values of and . Since we know that the -values associated with and are and , respectively, we can read off the values of and directly from the line, as shown below.

We see that, on the line, when , and when , . Hence, and .

**Part 3**

We are asked to write the equation of the straight line in the form . Since graph B goes through the point , we know that when , . Substituting these values into our function , we have

Hence, . Now, using this value for in our function , with another point on the line, say, , we can find the value of as follows. Substituting , , and , we have

Solving for , we find . Hence, with and , the equation of the straight line is .

Letβs consider another example of how we determine the graph of a straight line from a table of values.

### Example 3: Graphing Linear Functions by Plotting Points

Consider the linear function .

- We can draw a straight line to represent this function. Complete the table to find the coordinates of points on the line.
0 1 2 - Which of the following is the graph of the function?
- Which of these points is
**not**on the line?

### Answer

**Part 1**

We begin by using the equation to determine the -values corresponding to the -values given in the table. These are , and 2. Substituting each of these in turn into the equation, we have

Hence, we can complete the table as follows:

0 | 1 | 2 | |||

9 | 7 | 5 | 3 | 1 |

**Part 2**

Now, from the table, we can construct the ordered pairs, , corresponding to points on the line. These are , , , , and . All five of these points must lie on the graph of the line , and we see that this is the case only in graph B.

Hence, graph B is the graph of the equation .

**Part 3**

Next, we must determine which of the points , , , , and is not on the line. Since we know that graph B represents the equation of the line, we could try plotting the given points on graph B to see which are on the line and which are not. However, a more accurate method is to substitute the - and -values of each point into the given equation, . If the left-hand side is equal to the right-hand side after evaluation, then the point lies on the line. If not, then the point does not lie on the line. Letβs do this for our five points:

The only point that does not satisfy the equation is the point . Hence, the point is not on the line.

In our next example, using the graph of a straight line, we create a table of values and use this to determine which is the correct equation of the line.

### Example 4: Creating a Table of Values to Determine Which Function Matches the Graph

By making a table of values, determine which of the following is the function represented by the graph shown.

### Answer

From the graph, we see that there are three points that will be convenient to work with, since their coordinates have integersβthat is, whole number values.

These points have coordinates , , and . We can now construct a table with the - and -values of these points as cell values.

0 | 1 | ||

0 | 4 |

Using these three points, we can determine which is the correct function as follows.

Taking first the point with coordinates , we know that, on our line, when , . Substituting and into each of the given functions, we have

Since only for options A and E, we can eliminate options B, C, and D. Now, following the same procedure with the remaining two points, and , in options A and E, we have

We see that, for both points, the function in option A satisfies the equation and the function in option B does not. In fact, we need not have tried both points since either one would have given us the required result. That is, option A, , is the correct function.

Before completing this explainer, we recall that, in the special case where a linear function is a constant function, the function is represented graphically by a horizontal line. As an example, suppose we are asked to complete the table below for values of the function .

0 | 1 | 2 | |||

Since our function is a constant function, we know that it takes the same value for no matter the value of . In our case, this value is . Hence, we complete the table where each -value is equal to .

0 | 1 | 2 | |||

This function is represented graphically as shown below.

We see that a constant output means that all points on the graph of have same -coordinate, which, in this case, is .

In general, if a linear function is a constant functionβthat is, it has the form βthe function is represented graphically by a horizontal line through the point . The graph below shows such a function for a positive value of .

Letβs look at another example.

### Example 5: Determining the Graph of a Constant Function

Identify which of the graphs represents the function .

### Answer

We recall that a linear function is a function of the form , where and are real numbers. We know also that a linear function is represented graphically by a straight line. In the special case where such that , the function is called a constant function. A constant function is represented graphically by a horizontal line passing through the point on the -axis.

The function we are given, , is of this form, where, in our case, and . This means that, graphically, our function is represented by a horizontal line passing through the point.

Considering each of the graphs shown, we see that although graph A is a horizontal line, it passes through the point , not . Therefore, graph A cannot represent our function. Graph B is a vertical line, as is graph D, so we can eliminate these. Finally, graph C is not a horizontal line. The only graph that is a horizontal line passing through the point is graph E.

Hence, graph E represents the function .

Letβs finish by reminding ourselves of some of the key points covered in this explainer.

### Key Points

- A
**linear**function is a function of the form , where , , and . In the special case where , we call the**constant**function. - When graphing a function, the coordinates of each point on the graph are (input, output)βthat is, , or .
- A linear function is represented graphically as a straight line. A constant function is represented graphically as a horizontal line.
- A table containing a selection of input and output values of a linear function can be helpful in identifying or plotting the graph of the function.