Applied calculus topic summary: functions and linear models 
Functions and Domains A realvalued 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:
Note on Domains
Press here to link to a page that will allow you to evaluate and graph functions online.

Examples A Numerically Specified Function: Let the function f be specified by the following table.
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) = 3x^{2}  4x + 1. Then
f(1) = 3(1)^{2}  4(1) + 1 = 3 + 4 + 1 = 8. A Graphically Specified Function: Suppose f is specified by the following graph. Then, f(0) = 1, f(1) = 0, and f(3) = 5. 

Intervals
The closed interval [a, b] is the set of all real numbers x with a ≤ x ≤ b. 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]. 
Examples


Graph of a Function
The graph of a function f is the set of all points (x, f(x)) in the xyplane, 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

Example
To get the graph of
There is nothing to the left of the yaxis, 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 curvefitting model, obtained by finding a mathematical formula that approximates the observed data. 
Examples


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
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
Breakeven occurs when
or equivalently when

Example
If the cost to manufacture x refrigerators is
If you sold the refrigerators for $500 each, then the revenue is
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. 
Example
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:
54.5p = 5995


Linear Functions
A linear function is a function of the form
with m and b being fixed numbers (the names 'm' and 'b' are traditional). Role of m: If y = mx + b, then:
Role of b: When x = 0, y = b (Equation form), or f(0) = b (Function form) 
Examples
The function
The following equations can be solved for y as linear functions of x.


Straight Lines
The graph of a linear equation or function is a straight line. The slope of the line through (x_{1}, y_{1}) and (x_{2}, y_{2}) is given by the formula
The graph of the linear function
is a line with slope m and yintercept b. 
Examples
The slope of the line through (2, 3) and (1, 2) is given by
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 yintercept b and slope m. (b) Find the x and yintercepts and draw the line going through those two points. To find the xintercept of a line, set y = 0 in its equation and solve for x. To find the yintercept, 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. 
Examples
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 yintercept is 2. The following figure shows two stages of drawing its graph.
(b) To get the xintercept, set y = 0. The equation becomes 2x  3(0) = 6, giving x = 3. This is the xintercept. To get the yintercept, set x = 0, to obtain 2(0)  3y = 6, giving y = 2. The following figure shows two stages of drawing its graph.


Fitting a Linear Equation to Data: How to Make a Linear Model
PointSlope Formula: An equation of the line through the point (x_{1}, y_{1}) with slope m is given by
When to Apply the PointSlope Formula
Horizontal and Vertical Lines An equation of the horizontal line through (x_{1}, y_{1}) is
An equation of the vertical line through (x_{1}, y_{1}) is

Examples
An equation of the line through (1, 2) with slope 5 is given by
An equation of the horizontal line through (3, 4) is given by
An equation of the vertical line through (3, 4) is given by


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). 
Example
The number of web pages in this site is given by the equation


Linear Regression
Observed and Predicted Values Suppose we are given a collection of data points (x_{1}, y_{1}), ..., (x_{n}, y_{n}). The n quantities y_{1}, y_{2}, ..., y_{n} are called the observed y values. If we model these data with a linear equation
Residuals and SumofSquares Error (SSE) If we model a collection of data (x_{1}, y_{1}), ... , (x_{n}, y_{n}) with a linear equation as above, then the residuals are the n quantities (Actual Value  Predicted Value):
The sumofsquares error (SSE) is the sum of the squares of the residuals:
Regression Line The regression line (least squares line, bestfit line) associated with the points (x_{1}, y_{1}), (x_{2}, y_{2}), . . ., (x_{n}, y_{n}) is the line that gives the minimum value for SSE. The regression line has the form
where
Try the online regression utility if you want to see regression at work. 
Examples
Observed and Predicted Values For the three data points (0, 2), (2, 5), and (4, 6), the observed y values are y_{1} = 2, y_{2} = 5, and y_{3} = 6. If we model these data with the equation
Residuals and SumofSquares 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: The sumofsquares error is obtained by squaring and adding the answers:
