Skip to main content
\( \newcommand{\lt}{ < } \newcommand{\gt}{ > } \newcommand{\amp}{ & } \)

Section7.2Linear Models

Subsection7.2.1Linear Equations

A linear relation between two variables, say \(x\) and \(y\), is when the change between the variables, rather than the variables themselves, are proportional.

Definition7.2.1Linear Relation

Given two covarying variables \(x\) and \(y\), we say that \(x\) and \(y\) have a linear relation if there exist some constants \(A\), \(B\) and \(C\) such that for every state of the system, the variables \(x\) and \(y\) satisfy \begin{equation*}Ax+By=C.\end{equation*} The graph of such a relation in the Cartesian plane is a line.

The form of the equation used in the definition of a linear relation is called the general equation for a line. This equation can describe horizontal, vertical and slanted lines. A vertical line occurs in the \(x\)-\(y\) plane when the value of \(x\) is the same regardless of the value of \(y\), or \(x\) is independent of \(y\). This corresponds in the general equation with \(B=0\) and the equation can be rewritten as \(x=a\) with \(a=C/A\), where \(a\) represents the constant value of \(x\) over all states of the system.

With the exception of the case of that \(x\) is constant (discussed above), for linear relations we say that \(y\) is a linear function of \(x\).

Definition7.2.2Linear Function

Given two covarying variables \(x\) and \(y\), we say that \(y\) is a linear function of \(x\) if there exist a constant \(m\) such that for any two states of the system \((x_1,y_1)\) and \((x_2,y_2)\), the ratio of the change in \(y\), \(\Delta y = y_2-y_1\), to the change in \(x\), \(\Delta x = x_2-x_1\), always equals \(m\), \begin{equation*}\frac{\Delta y}{\Delta x} = \frac{y_2-y_1}{x_2-x_1} = m.\end{equation*}

That is, the change in \(y\) is proportional to the change in \(x\), or \(\Delta y \propto \Delta x\). The ratio of the changes, or rate of change, is called the slope.

Many students finish algebra courses remembering the slope–intercept form of the equation of a line, \begin{equation*} y = mx+b, \end{equation*} and have unfortunately used it so much that they think this is a preferred form. This equation's form involves two model parameters, the slope \(m\) and the \(y\)–intercept, \(b\). An intercept describes a point where a graph crosses one of the axes in the plane. A \(y\)-intercept is a point where the graph crosses the \(y\)-axis. So this form of the line requires knowing the slope \(m\) and the value of \(y\) when \(x=0\) so that \((x,y)=(0,b)\) is a known state.

It would be much better to remember the more general point–slope form, \begin{equation*} y-y_1 = m(x-x_1). \end{equation*} Although this form involves three parameters, it is structured in a way that reminds you of the definition of the slope and the idea of proportional change, \begin{equation*}\Delta y = m \cdot \Delta x.\end{equation*} In addition to the slope \(m\), we need one particular known point for the state \((x,y) = (x_1,y_1)\). If we solve for \(y\), this form is written \begin{equation*} y = y_1 + m(x-x_1), \end{equation*} which mathematically says that the value of \(y\) for a corresponding value of \(x\) is equal to the known value of \(y=y_1\) at some known value \(x=x_1\) plus the change that is proportional to \(\Delta x=x-x_1\).

If you remember the point–slope form of an equation for a line, other uses can be immediately recovered. For example, if you do know the \(y\)–intercept \(b\), then you know a point \((x,y)=(0,b)\). The resulting point–slope form becomes equivalent to the slope–intercept form, \begin{equation*}y=b+m(x-0) = b+mx.\end{equation*} But if you instead know the \(x\)–intercept \(a\), then you know a point on the \(x\)–axis \((x,y)=(a,0)\) and the point–slope form immediately leads to an equation capturing this information, \begin{equation*}y=m(x-a).\end{equation*}

Write \(y\) as a linear function of \(x\) if we know that \(y=24\) when \(x=5\) and the rate of change is \(\frac{\Delta y}{\Delta x}=-3\).

If we have two points, we need to calculate the slope before proceeding. One special application of this is the idea of linear interpolation. Often, we have data for two variables where we expect there is a nice relation between the variables but we do not know an appropriate formula. Linear interpolation adopts a modeling strategy that between any two neighboring data points, a linear model should give a reasonable approximation. So the strategy involves identifying which two points to use, finding the appropriate slope and equation of a line, and then use the equation to approximate the unknown point.


The following graph illustrates data representing the volume of water in a draining container \(V\) (liters) at various times \(t\) (seconds). Approximate how much water was in the container after 35 seconds.

<<SVG image is unavailable, or your browser cannot render it>>


Subsection7.2.2Testing for Linearity

Given some data involving two variables, we want to decide if those data follow a linear relation. We do this by testing whether the statement in the definition is satisfied.


Consider the simple dataset consisting of four points illustrated in the table. Determine if \(y\) is a linear function of \(x\).

\(i\) \(x_i\) \(y_i\)
1 0.20 0.48
2 0.45 0.45
3 0.60 0.40
4 0.80 0.36
Table7.2.6Dataset to illustrate testing if data are linear.

To test whether the definition of a linear function is satisfied, we need to check the slope between any two points. This corresponds to computing six different slopes, shown in the next table.

Comparison: \(i\)–\(j\) Slope: \(\displaystyle m_{i,j}=\frac{y_j-y_i}{x_j-x_i}\)
1-2 \(\displaystyle m_{1,2} = \frac{y_2-y_1}{x_2-x_1} = \frac{0.45-0.48}{0.45-0.20} = -0.12\)
1-3 \(\displaystyle m_{1,3} = \frac{y_3-y_1}{x_3-x_1} = \frac{0.40-0.48}{0.60-0.20} = -0.20\)
1-4 \(\displaystyle m_{1,4} = \frac{y_4-y_1}{x_4-x_1} = \frac{0.36-0.48}{0.80-0.20} = -0.20\)
2-3 \(\displaystyle m_{2,3} = \frac{y_3-y_2}{x_3-x_2} = \frac{0.40-0.45}{0.60-0.45} = -0.333\ldots\)
2-4 \(\displaystyle m_{2,4} = \frac{y_4-y_2}{x_4-x_2} = \frac{0.36-0.45}{0.80-0.45} = -0.257\ldots\)
3-4 \(\displaystyle m_{3,4} = \frac{y_4-y_3}{x_4-x_3} = \frac{0.36-0.40}{0.80-0.60} = -0.20\)
Table7.2.7Dataset to illustrate testing if data are linear.

Notice that the computed values for the slope between points are not always the same value. So these data do not satisfy a linear relation. However, notice that those pairings that do not include \(i=2\) all result in slopes \(m=-0.20\). It is the second point \(i=2\) that makes these data fail to be linear.

The graphical visualization of the data reinforces why the data are not linear. It is possible to draw a line going through the points \(i=1,3,4\), but that line fails to go through the point \(i=2\).

<<SVG image is unavailable, or your browser cannot render it>>

Figure7.2.8Plot illustrating data from Table 7.2.6 with the line passing through points 1, 3 and 4, but not 2.

When checking a collection of points to determine if they are collinear (on the same line), we do not need to check all of the pairs of points. It is enough to choose one point, and then compare the slopes between that point and each of the other points. If those all agree, then the points will be collinear. Alternatively, it is also acceptable to compute the slope for each consecutive pair of points. This is a consequence of the following theorem.


So in the previous example, we really only needed to compute \(m_{1,2}\), \(m_{1,3}\) and \(m_{1,4}\). Because \(m_{1,3}=m_{1,4}\) we know that the points 1, 3 and 4 were collinear. But because \(m_{1,2}\) was different, we knew immediately that the point 2 falls off of the line.

Example7.2.10Testing for Proportionality and Linearity

Consider two variables \(x\) and \(y\) that are measured under four different states, as recorded in the following table. Determine if these data are consistent with a proportional or linear model.

\(i\) \(x_i\) \(y_i\)
1 0.2 0.3
2 0.4 0.5
3 0.8 0.9
4 1.6 1.7
Table7.2.11Second dataset to illustrate testing if data are linear.

For a real application, you would not compute values by hand; you would use a computational tool, such as a calculator or spreadsheet, which can perform many calculations at essentially one time.

Nearly all spreadsheets use a grid system with columns labeled by letters and rows labeled by numbers. Each rectangle in the sheet is called a cell and stores either a value or text. The value can be a formula based on other cells by typing an equal sign followed by a formula. References to the values of other cells in the formula are accomplished by using the column letter followed by the row number.

While we are at it, let us also illustrate how we could determine if the data have a proportional relation in addition to testing the more general linear relation. We will compute the ratio of \(y/x\) and observe if it is constant and then compute the ratio of changes \((y_j-y_i)/(x_j-x_i)\) for consecutive points and observe if that is constant. A completed spreadsheet is shown, once showing formulas that you would type and another showing the numeric results. (Technically, you only type a formula for the first entry; then you copy and paste the result in the other cells and it will adjust the references appropriately.)

Image showing a spreadsheet table with data and formulas used to compute 
                    ratio and slope.
Image showing a spreadsheet table with data and values of  
                    ratio and slope computed using formulas.
Figure7.2.12Automatic calculation of ratio and slope based on data in a table using a spreadsheet.

Because the ratio of variables was changing, we know that \(y\) is not proportional to \(x\). However, because the ratio of change for the variables is constant, we know that \(y\) is a linear function of \(x\) with a slope \(m=1\). Using the first point as our reference, \((x_1,y_1) = (0.2,0.3)\), we can write an equation of our line. \begin{equation*} y = y_1+m(x-x_1) = 0.3 + 1.(x-0.2) = x+0.1 \end{equation*} You can easily verify that this formula is correct since for every data point, if you add 0.1 to the \(x\)-value, you get the \(y\)-value.