## Writing a Linear Function

### Learning Outcomes

• Calculate slope for a linear function given two points
• Write the equation of a linear function given two points and a slope

## Calculate and Interpret Slope

In the examples we have seen so far, we have had the slope provided for us. However, we often need to calculate the slope given input and output values. Given two values for the input, ${x}_{1}$ and ${x}_{2}$, and two corresponding values for the output, ${y}_{1}$ and ${y}_{2}$ which can be represented by a set of points, $\left({x}_{1}\text{, }{y}_{1}\right)$ and $\left({x}_{2}\text{, }{y}_{2}\right)$, we can calculate the slope $m$, as follows:

$m=\frac{\text{change in output (rise)}}{\text{change in input (run)}}=\frac{\Delta y}{\Delta x}=\frac{{y}_{2}-{y}_{1}}{{x}_{2}-{x}_{1}}$

where $\Delta y$ is the change in output and $\Delta x$ is the change in input. In function notation, ${y}_{1}=f\left({x}_{1}\right)$ and ${y}_{2}=f\left({x}_{2}\right)$ so we could write:

$m=\frac{f\left({x}_{2}\right)-f\left({x}_{1}\right)}{{x}_{2}-{x}_{1}}$

The graph below indicates how the slope of the line between the points, $\left({x}_{1,}{y}_{1}\right)$ and $\left({x}_{2,}{y}_{2}\right)$, is calculated. Recall that the slope measures steepness. The greater the absolute value of the slope, the steeper the line is.

The slope of a function is calculated by the change in $y$ divided by the change in $x$. It does not matter which coordinate is used as the $\left({x}_{2,\text{ }}{y}_{2}\right)$ and which is the $\left({x}_{1},\text{ }{y}_{1}\right)$, as long as each calculation is started with the elements from the same coordinate pair.

### Q & A

Are the units for slope always $\frac{\text{units for the output}}{\text{units for the input}}$ ?

Yes. Think of the units as the change of output value for each unit of change in input value. An example of slope could be miles per hour or dollars per day. Notice the units appear as a ratio of units for the output per units for the input.

### A General Note: CalculatING Slope

The slope, or rate of change, $m$, of a function can be calculated according to the following:

$m=\frac{\text{change in output (rise)}}{\text{change in input (run)}}=\frac{\Delta y}{\Delta x}=\frac{{y}_{2}-{y}_{1}}{{x}_{2}-{x}_{1}}$

where ${x}_{1}$ and ${x}_{2}$ are input values and ${y}_{1}$ and ${y}_{2}$ are output values.

### How To: Given two points from a linear function, calculate and interpret the slope.

1. Determine the units for output and input values.
2. Calculate the change of output values and change of input values.
3. Interpret the slope as the change in output values per unit of the input value.

### Example: Finding the Slope of a Linear Function

If $f\left(x\right)$ is a linear function and $\left(3,-2\right)$ and $\left(8,1\right)$ are points on the line, find the slope. Is this function increasing or decreasing?

### Try It

If $f\left(x\right)$ is a linear function, and $\left(2,3\right)$ and $\left(0,4\right)$ are points on the line, find the slope. Is this function increasing or decreasing?

### Example: Finding the Population Change from a Linear Function

The population of a city increased from 23,400 to 27,800 between 2008 and 2012. Find the change in population per year if we assume the change was constant from 2008 to 2012.

### Try It

The population of a small town increased from 1,442 to 1,868 between 2009 and 2012. Find the change in population per year if we assume the change was constant from 2009 to 2012.

## Point-Slope Form

Up until now, we have been using the slope-intercept form of a linear equation to describe linear functions. Now we will learn another way to write a linear function called point-slope form which is given below:

$y-{y}_{1}=m\left(x-{x}_{1}\right)$

where $m$ is the slope of the linear function and $({x}_{1},{y}_{1})$ is any point which satisfies the linear function.

The point-slope form is derived from the slope formula.

$\begin{array}{llll}{m}=\frac{y-{y}_{1}}{x-{x}_{1}}\hfill & \text{assuming }{ x }\ne {x}_{1}\hfill\\{ m }\left(x-{x}_{1}\right)=\frac{y-{y}_{1}}{x-{x}_{1}}\left(x-{x}_{1}\right)\hfill & \text{Multiply both sides by }\left(x-{x}_{1}\right)\hfill\\{ m }\left(x-{x}_{1}\right)=y-{y}_{1}\hfill & \text{Simplify}\hfill \\ y-{y}_{1}={ m }\left(x-{x}_{1}\right)\hfill &\text{Rearrange}\hfill \end{array}$

Keep in mind that slope-intercept form and point-slope form can be used to describe the same linear function. We can move from one form to another using basic algebra. For example, suppose we are given the equation $y - 4=-\frac{1}{2}\left(x - 6\right)$ which is in point-slope form. We can convert it to slope-intercept form as shown below.

$\begin{array}{llll}y - 4=-\frac{1}{2}\left(x - 6\right)\hfill & \hfill \\ y - 4=-\frac{1}{2}x+3\hfill & \text{Distribute the }-\frac{1}{2}.\hfill \\ \text{}y=-\frac{1}{2}x+7\hfill & \text{Add 4 to each side}.\hfill \end{array}$

Therefore, the same line can be described in slope-intercept form as $y=-\frac{1}{2}x+7$.

### A General Note: Point-Slope Form of a Linear Equation

Point-slope form of a linear equation takes the form

$y-{y}_{1}=m\left(x-{x}_{1}\right)$

where $m$ is the slope and ${x}_{1 }\text{ and } {y}_{1}$ are the $x\text{ and }y$ coordinates of a specific point through which the line passes.

Point-slope form is particularly useful if we know one point and the slope of a line. For example, suppose we are told that a line has a slope of 2 and passes through the point $\left(4,1\right)$. We know that $m=2$ and that ${x}_{1}=4$ and ${y}_{1}=1$. We can substitute these values into point-slope form.

$\begin{array}{l}y-{y}_{1}=m\left(x-{x}_{1}\right)\\ y - 1=2\left(x - 4\right)\end{array}$

If we wanted to rewrite the equation in slope-intercept form, we apply algebraic techniques.

$\begin{array}{llll} y - 1=2\left(x - 4\right)\hfill & \hfill \\ y - 1=2x - 8\hfill & \text{Distribute the }2.\hfill \\ \text{}y=2x - 7\hfill & \text{Add 1 to each side}.\hfill \end{array}$

Both equations $y - 1=2\left(x - 4\right)$ and $y=2x - 7$ describe the same line. The graph of the line can be seen below.

### Example: Writing Linear Equations Using a Point and the Slope

Write the point-slope form of an equation of a line with a slope of 3 that passes through the point $\left(6,-1\right)$. Then rewrite the equation in slope-intercept form.

### Try It

Write the equation of a line in point-slope form with a slope of $-2$ that passes through the point $\left(-2,\text{ }2\right)$. Then rewrite the equation in the slope-intercept form.

## Writing the Equation of a Line Using Two Points

Point-slope form of an equation is also useful if we know any two points through which a line passes. Suppose, for example, we know that a line passes through the points $\left(0,\text{ }1\right)$ and $\left(3,\text{ }2\right)$. We can use the coordinates of the two points to find the slope.

$\begin{array}{l}{m}=\frac{{y}_{2}-{y}_{1}}{{x}_{2}-{x}_{1}}\\ \text{}{m}=\frac{2 - 1}{3 - 0}\hfill \\ \text{}{m}=\frac{1}{3}\hfill \end{array}$

Now we can use the slope we found and the coordinates of one of the points to find the equation for the line. Let’s use (0, 1) for our point.

$\begin{array}{l}y-{y}_{1}=m\left(x-{x}_{1}\right)\\ y - 1=\frac{1}{3}\left(x - 0\right)\end{array}$

As before, we can use algebra to rewrite the equation in slope-intercept form.

$\begin{array}{lll}y - 1=\frac{1}{3}\left(x - 0\right)\hfill & \hfill \\ y - 1=\frac{1}{3}x\hfill & \text{Distribute the }\frac{1}{3}.\hfill \\ \text{}y=\frac{1}{3}x+1\hfill & \text{Add 1 to each side}.\hfill \end{array}$

Both equations describe the line graphed below.

### Example: Writing Linear Equations Using Two Points

Write the point-slope form of an equation of a line that passes through the points $\left(5,\text{ }1\right)$ and $\left(8,\text{ }7\right)$. Then rewrite the equation in slope-intercept form.

### Try It

Write the point-slope form of an equation of a line that passes through the points $\left(-1,3\right)$ and $\left(0,0\right)$. Then rewrite the equation in slope-intercept form.

## Contribute!

Did you have an idea for improving this content? We’d love your input.