Equations of Linear Functions

In this section, we will learn how to write equations for linear functions given different pieces of information, including two points on the line and the graph of the line. We will also identify the equations of horizontal and vertical lines and write linear equations from written information.

Point-Slope Formula

We have seen that we can define the slope of a line given two points on the line, and use that information along with the y-intercept to graph the line. If you don't know the y-intercept, or the equation for the line you can use two points to define the equation of the line using the point-slope formula.

This is an important formula, as it will be used in other areas of college algebra and often in calculus to find the equation of a tangent line. We need only one point and the slope of the line to use the formula. After substituting the slope and the coordinates of one point into the formula, we simplify it and write it in slope-intercept form.

The Point-Slope Formula

Given one point and the slope, the point-slope formula will lead to the equation of a line:

In our first example, we will start with the slope, then we will show how to find the equation of a line without being given the slope.

Example

Write the equation of the line with slope [latex]m=-3[/latex] and passing through the point [latex]\left(4,8\right)[/latex]. Write the final equation in slope-intercept form.

Answer: Using the point-slope formula, substitute [latex]-3[/latex] for m and the point [latex]\left(4,8\right)[/latex] for [latex]\left(_,_\right)[/latex].

[latex]\beginy-_=m\left(x-_\right)\hfill \\ y - 8=-3\left(x - 4\right)\hfill \\ y - 8=-3x+12\hfill \\ y=-3x+20\hfill \end[/latex]

Note that any point on the line can be used to find the equation. If done correctly, the same final equation will be obtained.

In our next example we will start with two points and define the equation of the line that passes through them.

Example

Find the equation of the line passing through the points [latex]\left(3,4\right)[/latex] and [latex]\left(0,-3\right)[/latex]. Write the final equation in slope-intercept form.

Answer: First, we calculate the slope using the slope formula and two points.

[latex]\beginm\hfill=\frac\hfill \\ \hfill =\frac\hfill \\ \hfill =\frac\hfill \end[/latex]

Next, we use the point-slope formula with the slope of [latex]\frac[/latex], and either point. Let’s pick the point [latex]\left(3,4\right)[/latex] for [latex]\left(_,_\right)[/latex].

[latex]\beginy - 4=\frac\left(x - 3\right)\hfill \\ y - 4=\fracx - 7\hfill&\text\frac.\hfill \\ y=\fracx - 3\hfill \end[/latex]

In slope-intercept form, the equation is written as [latex]y=\fracx - 3[/latex]. To prove that either point can be used, let us use the second point [latex]\left(0,-3\right)[/latex] and see if we get the same equation.

[latex]\beginy-\left(-3\right)=\frac\left(x - 0\right)\hfill \\ y+3=\fracx\hfill \\ y=\fracx - 3\hfill \end[/latex]

We see that the same line will be obtained using either point. This makes sense because we used both points to calculate the slope.

The following video examples shows how to write the equation for a line given it's slope and a point on the line. https://youtu.be/vut5b2fRQQ0

Standard Form of a Line

Another way that we can represent the equation of a line is in standard form. Standard form is given as

where [latex]A[/latex], [latex]B[/latex], and [latex]C[/latex] are integers. The x- and y-terms are on one side of the equal sign and the constant term is on the other side.

Example

Find the equation of the line with [latex]m=-6[/latex] and passing through the point [latex]\left(\frac<1>,-2\right)[/latex]. Write the equation in standard form.

Answer: We begin using the point-slope formula.

[latex]\beginy-\left(-2\right)=-6\left(x-\frac\right)\hfill \\ y+2=-6x+\frac\hfill \end[/latex]

From here, we multiply through by 2, as no fractions are permitted in standard form, and then move both variables to the left aside of the equal sign and move the constants to the right.

[latex]\begin2\left(y+2\right)=\left(-6x+\frac\right)2\hfill \\ 2y+4=-12x+3\hfill \\ 12x+2y=-1\hfill \end[/latex]

This equation is now written in standard form.

Vertical and Horizontal Lines

The equations of vertical and horizontal lines do not require any of the preceding formulas, although we can use the formulas to prove that the equations are correct. The equation of a vertical line is given as

where c is a constant. The slope of a vertical line is undefined, and regardless of the y-value of any point on the line, the x-coordinate of the point will be c. Suppose that we want to find the equation of a line containing the following points: [latex]\left(-3,-5\right),\left(-3,1\right),\left(-3,3\right)[/latex], and [latex]\left(-3,5\right)[/latex]. First, we will find the slope.

Zero in the denominator means that the slope is undefined and, therefore, we cannot use the point-slope formula. However, we can plot the points. Notice that all of the x-coordinates are the same and we find a vertical line through [latex]x=-3[/latex]. The equation of a horizontal line is given as

where c is a constant. The slope of a horizontal line is zero, and for any x-value of a point on the line, the y-coordinate will be c. Suppose we want to find the equation of a line that contains the following set of points: [latex]\left(-2,-2\right),\left(0,-2\right),\left(3,-2\right)[/latex], and [latex]\left(5,-2\right)[/latex]. We can use the point-slope formula. First, we find the slope using any two points on the line.

Use any point for [latex]\left(_,_\right)[/latex] in the formula, or use the y-intercept.

[latex]\beginy-\left(-2\right)=0\left(x - 3\right)\hfill \\ y+2=0\hfill \\ y=-2\hfill \end[/latex]

The graph is a horizontal line through [latex]y=-2[/latex]. Notice that all of the y-coordinates are the same.

Coordinate plane with the x-axis ranging from negative 7 to 4 and the y-axis ranging from negative 4 to 4. The function y = negative 2 and the line x = negative 3 are plotted.

The line [latex]x=−3[/latex] is a vertical line. The line [latex]y=−2[/latex] is a horizontal line.

Example

Find the equation of the line passing through the given points: [latex]\left(1,-3\right)[/latex] and [latex]\left(1,4\right)[/latex].

Answer: The x-coordinate of both points is 1. Therefore, we have a vertical line, [latex]x=1[/latex].

Our last video show another example of writing the equation of a line given two points on the line. https://youtu.be/ndRpJxdmZJI

Now that we have written equations for linear functions in both the slope-intercept form and the point-slope form, we can choose which method to use based on the information we are given. That information may be provided in the form of a graph, a point and a slope, two points, and so on. Look at the graph of the function f below.

Graph depicting how to calculate the slope of a line

The function f passing through the points (0.7) and (4,4) with a negative slope.

We are not given the slope of the line, but we can choose any two points on the line to find the slope. Let’s choose (0, 7) and (4, 4). We can use these points to calculate the slope.

[latex]\begin m=\frac_-_>_-_>\hfill \\ \text< >=\frac\hfill \\ \text< >=-\frac \end[/latex]

Now we can substitute the slope and the coordinates of one of the points into the point-slope form.

[latex]\beginy-_=m\left(x-_\right)\hfill \\ y - 4=-\frac\left(x - 4\right)\hfill \end[/latex]

If we want to rewrite the equation in the slope-intercept form, we would find

[latex]\beginy - 4=-\frac\left(x - 4\right)\hfill \\ y - 4=-\fracx+3\hfill \\ \text< >y=-\fracx+7\hfill \end[/latex]

Rewrite the equation in slope intercept form.

If we wanted to find the slope-intercept form without first writing the point-slope form, we could have recognized that the line crosses the y-axis when the output value is 7. Therefore, b = 7. We now have the initial value b and the slope m so we can substitute m and b into the slope-intercept form of a line.

So the function is [latex]f\left(x\right)=-\fracx+7[/latex], and the linear equation would be [latex]y=-\fracx+7[/latex].

Given the graph of a linear function, write an equation to represent the function.

  1. Identify two points on the line.
  2. Use the two points to calculate the slope.
  3. Determine where the line crosses the y-axis to identify the y-intercept by visual inspection.
  4. Substitute the slope and y-intercept into the slope-intercept form of a line equation.

Example

Graph of an increasing function with points at (-3, 0) and (0, 1).

Write an equation for a linear function given a graph of f shown below.

Identify two points on the line, such as (0, 2) and (–2, –4). Use the points to calculate the slope.

Substitute the slope and the coordinates of one of the points into the point-slope form.

We can use algebra to rewrite the equation in the slope-intercept form.

[latex]\beginy+4=3\left(x+2\right)\hfill \\ y+4=3x+6\hfill \\ \text< >y=3x+2\hfill \end[/latex]

Analysis of the Solution

Graph of an increasing line with points at (0, 2) and (-2, -4).

This makes sense because we can see from the graph below that the line crosses the y-axis at the point (0, 2), which is the y-intercept, so b = 2. In the following video we show an example of how to write the equation of a line given it's graph. https://youtu.be/mmWf_oLTNSQ

Example

If f is a linear function, with [latex]f\left(3\right)=-2[/latex] , and [latex]f\left(8\right)=1[/latex], find an equation for the function in slope-intercept form.

We can write the given points using coordinates.

[latex]\beginf\left(3\right)=-2\to \left(3,-2\right)\hfill \\ f\left(8\right)=1\to \left(8,1\right)\hfill \end[/latex]

We can then use the points to calculate the slope.

[latex]\begin m=\frac_-_>_-_>\hfill \\ \text< >=\frac<1-\left(-2\right)>\hfill \\ \text< >=\frac\hfill \end[/latex]

Substitute the slope and the coordinates of one of the points into the point-slope form.

[latex]\begin\text< >y-_=m\left(x-_\right)\hfill \\ y-\left(-2\right)=\frac\left(x - 3\right)\hfill \end[/latex]

We can use algebra to rewrite the equation in the slope-intercept form.

In the video we show another example of how to write a linear function given two points written with function notation. https://youtu.be/TSIcryAtCmY

Model an Application With a Linear Function

In the real world, problems are not always explicitly stated in terms of a function or represented with a graph. Fortunately, we can analyze the problem by first representing it as a linear function and then interpreting the components of the function. As long as we know, or can figure out, the initial value and the rate of change of a linear function, we can solve many different kinds of real-world problems.

Given a linear function f and the initial value and rate of change, evaluate f(c).

  1. Determine the initial value and the rate of change (slope).
  2. Substitute the values into [latex]f\left(x\right)=mx+b[/latex].
  3. Evaluate the function at [latex]x=c[/latex].
  • The point [latex](0,y)[/latex] is often the initial value of a linear function
  • The y value of the initial value comes from b in the slope intercept form of a linear function, [latex]f\left(x\right)=mx+b[/latex]
  • The initial value can be found by solving for b, or substituting 0 for x in a linear function.

Example

Marcus currently has 200 songs in his music collection. Every month, he adds 15 new songs. Write a formula for the number of songs, N, in his collection as a function of time, t, the number of months. How many songs will he own in a year?

The initial value for this function is 200 because he currently owns 200 songs, so N(0) = 200, which means that b = 200.

Figure 12

The number of songs increases by 15 songs per month, so the rate of change is 15 songs per month. Therefore we know that m = 15. We can substitute the initial value and the rate of change into the slope-intercept form of a line.

We can write the formula [latex]N\left(t\right)=15t+200[/latex].

With this formula, we can then predict how many songs Marcus will have in 1 year (12 months). In other words, we can evaluate the function at t = 12.

[latex]\beginN\left(12\right)=15\left(12\right)+200\hfill \\ \text< >=180+200\hfill \\ \text< >=380\hfill \end[/latex]

Marcus will have 380 songs in 12 months.

Analysis of the Solution

Notice that N is an increasing linear function. As the input (the number of months) increases, the output (number of songs) increases as well.

In our next example, we will show that you can write the equation for a linear function given two data points. In this case, Ilya's weekly income depends on the number of insurance policies he sells. We are given his income for two different weeks and the number of policies sold. We first find the rate of change and then solve for the initial value.

Example

Working as an insurance salesperson, Ilya earns a base salary plus a commission on each new policy. Therefore, Ilya’s weekly income, I, depends on the number of new policies, n, he sells during the week. Last week he sold 3 new policies, and earned $760 for the week. The week before, he sold 5 new policies and earned $920. Find an equation for I(n), and interpret the meaning of the components of the equation.

The given information gives us two input-output pairs: (3, 760) and (5, 920). We start by finding the rate of change.

[latex]\beginm=\frac\hfill \\ \text< >=\frac>\hfill \\ \text< >=$80\text< per policy>\hfill \end[/latex]

Keeping track of units can help us interpret this quantity. Income increased by $160 when the number of policies increased by 2, so the rate of change is $80 per policy. Therefore, Ilya earns a commission of $80 for each policy sold during the week.

We can then solve for the initial value.

[latex]\begin\text< >I\left(n\right)=80n+b\hfill & \hfill \\ \text< >760=80\left(3\right)+b\hfill & \textn=3, I\left(3\right)=760\hfill \\ 760 - 80\left(3\right)=b\hfill & \hfill \\ \text< >520=b\hfill & \hfill \end[/latex]

The value of b is the starting value for the function and represents Ilya’s income when n = 0, or when no new policies are sold. We can interpret this as Ilya’s base salary for the week, which does not depend upon the number of policies sold.

We can now write the final equation.

[latex]I\left(n\right)=80n+520[/latex]

Our final interpretation is that Ilya’s base salary is $520 per week and he earns an additional $80 commission for each policy sold.

Analysis of the Solution

We used units to help us verify that we were calculating the rate correctly. It makes sense to speak in terms of the price per policy. To calculate the initial value, we solved for b by substituting values from one of the points we were given for n and I. In the following video example we show how to identify the initial value, slope and equation for a linear function. https://youtu.be/JMQSdRFJ1S4 We will show one more example of how to write a linear function that represents the monthly cost to run a company given monthly fixed costs and production costs per item.

Example

Suppose Ben starts a company in which he incurs a fixed cost of $1,250 per month for the overhead, which includes his office rent. His production costs are $37.50 per item. Write a linear function C where C(x) is the cost for x items produced in a given month.

Answer: The fixed cost is present every month, $1,250. The costs that can vary include the cost to produce each item, which is $37.50 for Ben. The variable cost, called the marginal cost, is represented by 37.5. The cost Ben incurs is the sum of these two costs, represented by [latex]C\left(x\right)=1250+37.5x[/latex].

Analysis of the Solution

It is important to note that we are writing a function based on monthly costs, so the initial cost will be $1,250 becuase Ben has to pay that amount monthly for rent. If Ben produces 100 items in a month, his monthly cost is represented by

[latex]\beginC\left(100\right)=1250+37.5\left(100\right)\hfill\text < >\\ =5000\hfill \end[/latex]

So his monthly cost would be $5,000.

The following video example show how to write a linear function that represents how many miles you can travel in a rental car for a fixed amount. https://youtu.be/H8KR3w2nXqs

In the next example we will take data that is in tabular (table) form to write an equation that describes the rate of change in the numbers of a rat population.

Example

The table below relates the number of rats in a population to time, in weeks. Use the table to write a linear equation.

w, number of weeks 0 2 4 6
P(w), number of rats 1000 1080 1160 1240

We can see from the table that the initial value for the number of rats is 1000, so b = 1000.

Rather than solving for m, we can tell from looking at the table that the population increases by 80 for every 2 weeks that pass. This means that the rate of change is 80 rats per 2 weeks, which can be simplified to 40 rats per week.

[latex]P\left(w\right)=40w+1000[/latex]

If we did not notice the rate of change from the table we could still solve for the slope using any two points from the table. For example, using (2, 1080) and (6, 1240)

[latex]\beginm=\frac\hfill \\ \text< >=\frac\hfill \\ \text< >=40\hfill \end[/latex]

Think About It

Is the initial value always provided in a table of values like the table in the previous example? Write your ideas in the textbox below before you look at the answer. If your answer is no, give a description of how you would find the initial value. [practice-area rows="2"][/practice-area]

Answer: No. Sometimes the initial value is provided in a table of values, but sometimes it is not. If you see an input of 0, then the initial value would be the corresponding output. If the initial value is not provided because there is no value of input on the table equal to 0, find the slope, substitute one coordinate pair and the slope into [latex]f\left(x\right)=mx+b[/latex], and solve for b.

Summary

Slope of a line

  • The slope of a line indicates the direction in which a line slants as well as its steepness. Slope is defined algebraically as:[latex]m=\frac_-_>_-_>[/latex]
  • Given the slope and one point on a line, we can find the equation of the line using the point-slope formula. [latex]y-_=m\left(x-_\right)[/latex]

Equations of Lines

  • Standard form of a line is given as [latex]Ax+By=C[/latex].
  • The equation of a vertical line is given as [latex]x=c[/latex]
  • The equation of a horizontal line is given as [latex]y=c[/latex]
  • Given a graph you can write the equation of the line it represents
  • This method only works for graphs that have points that are easy to verify by visual inspection

Modeling Applications With Linear Functions

  • Sometimes we are given an initial value, and sometimes we have to solve for it
  • Using units can help you verify that you have calculated slope correctly
  • We can write the equation for a line given a slope and a data point, or from a table of data

Licenses & Attributions

CC licensed content, Original

  • Revision and Adaptation. Provided by: Lumen Learning License:CC BY: Attribution.
  • Ex: Savings Linear Function Application (Slope, Intercept Meaning). Authored by: James Sousa (Mathispower4u.com) . License:CC BY: Attribution.

CC licensed content, Shared previously

  • Ex: Find the Equation of a Line in Point Slope and Slope Intercept Form Given the Slope and a Point. Authored by: James Sousa (Mathispower4u.com) . License:CC BY: Attribution.
  • Ex: Find The Equation of the Line in Point-Slope and Slope Intercept Form Given Two Points. Authored by: James Sousa (Mathispower4u.com) . License:CC BY: Attribution.
  • College Algebra. Provided by: OpenStax Located at: https://cnx.org/contents/[email protected]:1/Preface. License:CC BY: Attribution. License terms: Download for free: http://cnx.org/contents/[email protected]:1/Preface.
  • Ex: Linear Equation Application (Cost of a Rental Car). Authored by: James Sousa (Mathispower4u.com) . License:CC BY: Attribution.
  • Ex 1: Find the Equation of a Line in Slope Intercept Form Given the Graph of a Line. Authored by: James Sousa (Mathispower4u.com) . License:CC BY: Attribution.
  • Ex: Find the Linear Function Given Two Function Values in Function Notation. Authored by: James Sousa (Mathispower4u.com) . License:CC BY: Attribution.