Applied calculus topic summary: functions and linear models

Tools: Function Evaluator & Grapher | Excel Grapher | Simple Regression Utility

Subtopics: Functions and Domains | Intervals | Graph of a Function | Mathematical Models | Cost, Revenue, Profit Models | Demand and Supply Models | Linear Functions | Straight Lines | Graph of a Linear Function | Linear Models | Interpretation of the Slope | Linear Regression

Functions and Domains

A real-valued function f of a real variable is a rule that assigns to each real number x in a specified set of numbers, called the domain of f, a single real number f(x).

The variable x is called the independent variable. If y = f(x) we call y the dependent variable.

A function can be specified:

  • numerically: by means of a table
  • algebraically: by means of a formula
  • graphically: by means of a graph

Note on Domains
The domain of a function is not always specified explicitly; if no domain is specified for the function f, we take the domain to be the largest set of numbers x for which f(x) makes sense. This "largest possible domain" is sometimes called the natural domain.

Press here to link to a page that will allow you to evaluate and graph functions on-line.
Press here to download an Excel grapher.


A Numerically Specified Function: Let the function f be specified by the following table.

f(x) 3.01 -1.03 2.22 0.01

Then, f(0) = 3.01, f(1) = -1.03, and so on.

An Algebraically Specified Function: Let the function f be specified by f(x) = 3x2 - 4x + 1. Then

    f(2) = 3(2)2 - 4(2) + 1 = 12 - 8 + 1 = 5,
    f(-1) = 3(-1)2 - 4(-1) + 1 = 3 + 4 + 1 = 8.
Since f(x) is defined for every x, the domain of f is the set of all real numbers.

A Graphically Specified Function: Suppose f is specified by the following graph.

Then, f(0) = 1, f(1) = 0, and f(3) = 5.


The closed interval [a, b] is the set of all real numbers x with axb.

The open interval (a, b) is the set of all real numbers x with a < x < b.

The interval (a, ∞) is the set of all real numbers x with a < x < +∞, while (-∞, b) is the set of all real numbers x with -∞ < x < b.

We also have half open intervals of the form [a, b) and (a, b].


IntervalPicture Description
[-1, 6)-1 ≤ x < 6
(2, 4)2 < x < 4
(-∞, 0]-∞ < x ≤ 0
Graph of a Function

The graph of a function f is the set of all points (x, f(x)) in the xy-plane, where we restrict the values of x to lie in the domain of f.

The following diagram illustrates the graph of a function

Vertical Line Test
For a graph to be the graph of a function, each vertical line must intersect the graph in at most one point.


To get the graph of

f(x) = 3x2 - 4x + 1   Function notation
with domain restricted to [0, + ∞), we replace f(x) by y, getting the equation
y = 3x2 - 4x + 1.   Equation notation
We then graph it by plotting points, restricting x to lie in [0, + ∞), and obtain the following picture.

There is nothing to the left of the y-axis, since we have restricted x to be ≥ 0.

Mathematical Models

To mathematically model a situation means to represent it in mathematical terms. The particular representation used is called a mathematical model of the situation.

Examples 1 and 2 opposite are analytical models, obtained by analyzing the situation being modeled, whereas Example 3 is a curve-fitting model, obtained by finding a mathematical formula that approximates the observed data.

Situation Model
1. There are currently 50 movies on your hard drive, and this number is growing by 2 per week. Model the size of your collection as a function of time.
N(t) = 50 + 2t
t = time in weeks, N = number of movies
2. I invest $1000 at 5% interest compounded quarterly. Find the value of the investment after t years.
A(t) = 1000(1 + 0.0125)^{4t}
From the compound interest formula
3. Facebook membership:
The following function approximates the number of Facebook members since the start of 2004:
n(t) = 4t if 0 ≤ t ≤ 3       million members
50t-138     if 3 < t ≤ 5

t = time in years since the start of 2004, n = membership in millions
Cost, Revenue and Profit Models

A cost function specifies the cost C as a function of the number of items x. Thus, C(x) is the cost of x items, and has the form

    Cost = Variable cost + Fixed cost
where the variable cost is a function of x and the fixed cost is a constant. A cost function of the form
    C(x) = mx + b
is called a linear cost function; the variable cost is mx and the fixed cost is b. The slope m, the marginal cost, measures the incremental cost per item.

A revenue function R gives the total revenue R(x) from the sale of x items.

A profit function P gives the total profit P(x) from the sale of x items. The profit, cost and revenue functions are related by the formula

P(x) = R(x) - C(x).

Break-even occurs when

P(x) = 0

or equivalently when

R(x) = C(x).

If the cost to manufacture x refrigerators is

C(x) = 2x^2 + 150x + 6000 dollars,
then the variable cost is 2x^2 + 150x and the fixed cost is $6000.

If you sold the refrigerators for $500 each, then the revenue is

R(x) = 500x dollars,
and the profit function is
    P(x)=R(x) - C(x)
    =500x - (2x^2 + 150x + 6000)
    =-2x^2 + 350x - 6000
Break-even occurs when P(x) = -2x^2 + 350x - 6000 = 0. Solving this equation using the quadratic formula yields two solutions: x ≈ 19.26 and 155.74. When x is between these two values, P(x) is positive, indicating a profit. Thus, you should sell at least 20 refrigerators (but no more than 155) to make a profit.

Go to the tutorial for more examples.

Demand and Supply Models

A demand equation or demand function expresses demand q (the number of items demanded) as a function of the unit price p (the price per item). A supply equation or supply function expresses supply q (the number of items a supplier is willing to bring to the market) as a function of the unit price p (the price per item). It is usually the case that demand decreases and supply increases as the unit price increases.

Demand and supply are said to be in equilibrium when demand equals supply. The corresponding values of p and q are called the equilibrium price and equilibrium demand. To find the equilibrium price, determine the unit price p where the demand and supply curves cross (sometimes we can determine this value analytically by setting demand equal to supply and solving for p). To find the equilibrium demand, evaluate the demand (or supply) function at the equilibrium price.


If the demand for Ludington's Wellington Boots is q = -4.5p + 4000 pairs of boots sold per week and the supply is q = 50p - 1995 pairs per week (see the graph below), then the equilibrium point is obtained when demand = supply:

    -4.5p+4000 = 50p-1995
    54.5p = 5995
giving p = 5995/54.5 = $110. The equilibrium price is therefore $110 and the equilibrium demand is q = −4.5(110) + 4000 = 3505 pairs per week. What happens at prices other than the equilibrium price can be seen in the following figure:

  • When the price is lower that the equilibrium price, the demand is greater than the supply, resulting in a shortage.
  • When the price is set at the equilibrium price, the demand equals supply, so there is no shortage or surplus, and we say that the market clears.
  • When the price is greater that the equilibrium price, the supply is greater than the demand, resulting in a surplus.
Linear Functions

A linear function is a function of the form

    f(x) = mx + b     Function notation
    y = mx + b     Equation notation

with m and b being fixed numbers (the names 'm' and 'b' are traditional).

Role of m: If y = mx + b, then:
 (a) y changes by m units for every 1-unit change in x.
 (b) A change of Δx units in x results in a change of Δy = mΔx units in y.
 (c) Solving for m, we obtain


    change in y

    change in x

Role of b: When x = 0, y = b (Equation form), or f(0) = b (Function form)


The function

f(x) = 5x - 1
is a linear function with m = 5 and b = -1.

The following equations can be solved for y as linear functions of x.

    3x - y + 4 = 0   y = 3x + 4
    4y = 0y = 0
    3x + 4y = 5y = -(3/4)x + 5/4
Straight Lines

The graph of a linear equation or function is a straight line. The slope of the line through (x1, y1) and (x2, y2) is given by the formula

    y2 - y1

    x2 - x1


The graph of the linear function

f(x) = mx + b   Function form
y = mx + b   Equation form

is a line with slope m and y-intercept b.


The slope of the line through (2, -3) and (1, 2) is given by

    y2 - y1

    x2 - x1
    2 + 3

    1 - 2

To see how to sketch the graph of a linear function, see the next item

Sketching the Graph of a Linear Function

There are two good ways to sketch the graph of a linear function.

(a) Put the function in y = mx+b form, and draw the line with y-intercept b and slope m.

(b) Find the x- and y-intercepts and draw the line going through those two points. To find the x-intercept of a line, set y = 0 in its equation and solve for x. To find the y-intercept, set x = 0 and solve for y. This method works only if the line does not pass through the origin. If it does, then you will need to plot an extra point or use the first method.


Here are the these techniques applied to the line with equation 2x - 3y = -6.

(a) Solving for y, we get y = 2x/3 + 2. Thus, the slope is 2/3 and the y-intercept is 2. The following figure shows two stages of drawing its graph.

Step 1
Start with the y-intercept.
Step 2
Draw a line with the given slope.
y-intercept =2
slope = 2/3

(b) To get the x-intercept, set y = 0. The equation becomes 2x - 3(0) = -6, giving x = -3. This is the x-intercept. To get the y-intercept, set x = 0, to obtain 2(0) - 3y = -6, giving y = 2. The following figure shows two stages of drawing its graph.

Step 1
Start with x- and y-intercepts.
x-intercept = -3
y-intercept = 2
Step 2
Draw the line through the intercepts.
Fitting a Linear Equation to Data: How to Make a Linear Model

Point-Slope Formula:

An equation of the line through the point (x1, y1) with slope m is given by

y = mx + b    
b = y1 - mx1

When to Apply the Point-Slope Formula

  • Apply the point-slope formula to find the equation of a line whenever you are given information about a point and the slope of a line. The formula does not apply if the slope is undefined.
  • If you already know the slope m and y-intercept b, then you can just write down the linear function as
        y = mx + b.
    This is known as the slope-intercept formula

Horizontal and Vertical Lines

An equation of the horizontal line through (x1, y1) is

y = y1.

An equation of the vertical line through (x1, y1) is

x = x1.

An equation of the line through (1, 2) with slope -5 is given by
y = -5x + b,
b = y1 - mx1 = 2 - (-5)(1) = 7
y = -5x + 7.

An equation of the horizontal line through (3, -4) is given by

    y = -4.

An equation of the vertical line through (3, -4) is given by

    x = 3.
Interpretation of the Slope in Applications

The slope of the line y = mx + b is the rate at which y is changing per unit of change in x. The units of measurement of the slope are units of y per unit of x

If y is displacement and x is time, then the slope represents velocity. Its units are units of displacement per unit time (for example, meters per second)

If y is cost and x is the number of items, then the slope represents marginal cost. Its units are units of cost per item (for example, Eurodollars per item).


The number of web pages in this site is given by the equation

n = 1.2t + 200,
where t is time in weeks since June 1, 1997. The slope is m = 1.2 web pages per week. Thus, the number of web pages is growing at a rate of 1.2 web pages per week.
Linear Regression

Observed and Predicted Values

Suppose we are given a collection of data points (x1, y1), ..., (xn, yn). The n quantities y1, y2, ..., yn are called the observed y values. If we model these data with a linear equation

    =mx + b      

      stands for "estimated" or "predicted" y.
then the y values we get by substituting the given x-values into the equation are called the predicted y values:

    = mx1 + b       Substitute x1 for x

    = mx2 + b Substitute x2 for x
        . . .    

    = mxn + b Substitute xn for x

Residuals and Sum-of-Squares Error (SSE)

If we model a collection of data (x1, y1), ... , (xn, yn) with a linear equation as above, then the residuals are the n quantities (Actual Value - Predicted Value):

    (y1 - y1),  
    (y2 - y2),  
    . . .   ,    
    (yn - yn)

The sum-of-squares error (SSE) is the sum of the squares of the residuals:

    SSE =          
    (y1 - y1)2 +
    (y2 - y2)2 +
    . . .   +        
    (yn - yn)2 +

Regression Line

The regression line (least squares line, best-fit line) associated with the points (x1, y1), (x2, y2), . . ., (xn, yn) is the line that gives the minimum value for SSE.

The regression line has the form

    y = mx + b


    nxy) -x)(Σy)

    nx2) -x)2
    Σy - mx)

    n= number of data points

Try the on-line regression utility if you want to see regression at work.


Observed and Predicted Values

For the three data points (0, 2), (2, 5), and (4, 6), the observed y values are y1 = 2, y2 = 5, and y3 = 6. If we model these data with the equation

    =2x + 1.5
then the predicted values are obtained by substituting the x-values in the equation of the line:

    2x1 + 1.5 = 2(0) + 1.5 = 1.5

    2x2 + 1.5 =  

    2x3 + 1.5 =

Residuals and Sum-of-Squares Error (SSE)

For the three data points (0, 2), (2, 5), and (4, 6) and linear model 2x + 1.5 as given above, the residuals are:

    y1 - y1
    =2 - 1.5 = 0.5
    y2 - y2
    y2 - y2

The sum-of-squares error is obtained by squaring and adding the answers:

    SSE = (0.5)2 + (-0.5)2 + (-3.5)2 = 12.75
Last Updated: December 2009
Copyright © Stefan Waner

Top of Page