Section 2.1 All About Functions
¶A function \(y=f(x)\) is a rule for determining \(y\) when we're given a value of \(x\text{.}\) For example, the rule \(y=f(x)=2x+1\) is a function. Any line \(y=mx+b\) is called a linear function. The graph of a function looks like a curve above (or below) the \(x\)axis, where for any value of \(x\) the rule \(y=f(x)\) tells us how far to go above (or below) the \(x\)axis to reach the curve.
Functions can be defined in various ways: by an algebraic formula or several algebraic formulas, by a graph, or by an experimentally determined table of values. In the latter case, the table gives a bunch of points in the plane, which we might then interpolate with a smooth curve, if that makes sense.
Given a value of \(x\text{,}\) a function must give at most one value of \(y\text{.}\) Thus, vertical lines are not functions. For example, the line \(x=1\) has infinitely many values of \(y\) if \(x=1\text{.}\) It is also true that if \(x\) is any number (not 1) there is no \(y\) which corresponds to \(x\text{,}\) but that is not a problem—only multiple \(y\) values is a problem.
One test to identify whether or not a curve in the \((x,y)\) coordinate system is a function is the following.
Theorem 2.1. The Vertical Line Test.
A curve in the \((x,y)\) coordinate system represents a function if and only if no vertical line intersects the curve more than once.
In addition to lines, another familiar example of a function is the parabola \(y=f(x)=x^2\text{.}\) We can draw the graph of this function by taking various values of \(x\) (say, at regular intervals) and plotting the points \((x,f(x))=(x,x^2)\text{.}\) Then connect the points with a smooth curve.
The two examples \(y=f(x)=2x+1\) and \(y=f(x)=x^2\) are both functions which can be evaluated at any value of \(x\) from negative infinity to positive infinity. For many functions, however, it only makes sense to take \(x\) in some interval or outside of some “forbidden” region. The interval of \(x\)values at which we're allowed to evaluate the function is called the domain of the function.
Example 2.2. Domain of the SquareRoot Function.
The squareroot function \(y=f(x)=\sqrt{x}\) is the rule which says, given an \(x\)value, take the nonnegative number whose square is \(x\text{.}\) This rule only makes sense if \(x\ge 0\text{.}\) We say that the domain of this function is \(x\ge 0\text{,}\) or more formally \(\left\{x\in\mathbb{R}\,:\,x\ge 0\right\}\text{.}\) Alternately, we can use interval notation, and write that the domain is \([0,\infty)\text{.}\) The fact that the domain of \(y=\sqrt{x}\) is \([0,\infty)\) means that in the graph of this function (see Figure 2.(b)) we have points \((x,y)\) only above \(x\)values on the right side of the \(x\)axis.
Another example of a function whose domain is not the entire \(x\)axis is: \(y=f(x)=1/x\text{,}\) the reciprocal function. We cannot substitute \(x=0\) in this formula. The function makes sense, however, for any nonzero \(x\text{,}\) so we take the domain to be: \(\{x\in\mathbb{R}\,:\,x\ne 0\}\text{.}\) The graph of this function does not have any point \((x,y)\) with \(x=0\text{.}\) As \(x\) gets close to 0 from either side, the graph goes off toward infinity. We call the vertical line \(x=0\) an asymptote.
To summarize, two reasons why certain \(x\)values are excluded from the domain of a function are the following.
Restrictions for the Domain of a Function.
We cannot divide by zero, and
We cannot take the square root of a negative number.
When the domain of a function is restricted, we say that the function is undefined at that point. We will encounter some other ways in which functions might be undefined later.
Another reason why the domain of a function might be restricted is that in a given situation the \(x\)values outside of some range might have no practical meaning. For example, if \(y\) is the area of a square of side \(x\text{,}\) then we can write \(y=f(x)=x^2\text{.}\) In a purely mathematical context the domain of the function \(y=x^2\) is all of \(\mathbb{R}\text{.}\) However, in the storyproblem context of finding areas of squares, we restrict the domain to positive values of \(x\text{,}\) because a square with negative or zero side makes no sense.
In a problem in pure mathematics, we usually take the domain to be all values of \(x\) at which the formulas can be evaluated. However, in a story problem there might be further restrictions on the domain because only certain values of \(x\) are of interest or make practical sense.
In a story problem, we often use letters other than \(x\) and \(y\text{.}\) For example, the volume \(V\) of a sphere is a function of the radius \(r\text{,}\) given by the formula \(V=f(r)=\frac{4}{3}\pi r^3\text{.}\) Also, letters different from \(f\) may be used. For example, if \(y\) is the velocity of something at time \(t\text{,}\) we may write \(y=v(t)\) with the letter \(v\) (instead of \(f\)) standing for the velocity function (and \(t\) playing the role of \(x\)).
The letter playing the role of \(x\) is called the independent variable, and the letter playing the role of \(y\) is called the dependent variable (because its value “depends on” the value of the independent variable). In story problems, when one has to translate from English into mathematics, a crucial step is to determine what letters stand for variables. If only words and no letters are given, then we have to decide which letters to use. Some letters are traditional. For example, almost always, \(t\) stands for time.
Example 2.3. Open Box.
An opentop box is made from an \(a\times b\) rectangular piece of cardboard by cutting out a square of side \(x\) from each of the four corners, and then folding the sides up and sealing them with duct tape. Find a formula for the volume \(V\) of the box as a function of \(x\text{,}\) and find the domain of this function.
The box we get will have height \(x\) and rectangular base of dimensions \(a2x\) by \(b2x\text{.}\) Thus,
Here \(a\) and \(b\) are constants, and \(V\) is the variable that depends on \(x\text{,}\) i.e., \(V\) is playing the role of \(y\text{.}\)
This formula makes mathematical sense for any \(x\text{,}\) but in the story problem the domain is much less. In the first place, \(x\) must be positive. In the second place, it must be less than half the length of either of the sides of the cardboard. Thus, the domain is
In interval notation we write: the domain is the interval \((0,\min(a,b)/2)\text{.}\) You might think about whether we could allow 0 or (the minimum of \(a\) and \(b \)) to be in the domain. They make a certain physical sense, though we normally would not call the result a box. If we were to allow these values, what would the corresponding volumes be? Does that volume make sense?
Example 2.4. Circle of Radius \(r\) Centered at the Origin.
Is the circle of radius \(r\) centered at the origin the graph of a function?
The equation for this circle is usually given in the form \(x^2+y^2=r^2\text{.}\) To write the equation in the form \(y=f(x)\) we solve for \(y\text{,}\) obtaining \(y=\pm\sqrt{r^2x^2}\text{.}\) But this is not a function, because when we substitute a value in the interval \((r,r)\) for \(x\) there are two corresponding values of \(y\text{.}\) To get a function, we must choose one of the two signs in front of the square root. If we choose the positive sign, for example, we get the upper semicircle \(y=f(x)=\sqrt{r^2 x^2}\) (see graph below). The domain of this function is the interval \([r,r]\text{,}\) i.e., \(x\) must be between \(r\) and \(r\) (including the endpoints). If \(x\) is outside of that interval, then \(r^2x^2\) is negative, and we cannot take the square root. In terms of the graph, this just means that there are no points on the curve whose \(x\)coordinate is greater than \(r\) or less than \(r\text{.}\)
Example 2.5. Domain.
Find the domain of
To answer this question, we must rule out the \(x\)values that make \(4xx^2\) negative (because we cannot take the square root of a negative number) and also the \(x\)values that make \(4xx^2\) zero (because if \(4xx^2=0\text{,}\) then when we take the square root we get 0, and we cannot divide by 0). In other words, the domain consists of all \(x\) for which \(4xx^2\) is strictly positive. The inequality \(4xx^2>0\) was solved in Example 1.12. In interval notation, the domain is the interval \((0,4)\text{.}\)
A function does not always have to be given by a single formula as the next example demonstrates.
Example 2.6. Piecewise Velocity.
Suppose that \(y=v(t)\) is the velocity function for a car which starts out from rest (zero velocity) at time \(t=0\text{;}\) then increases its speed steadily to 20 m/sec, taking 10 seconds to do this; then travels at constant speed 20 m/sec for 15 seconds; and finally applies the brakes to decrease speed steadily to 0, taking 5 seconds to do this. The formula for \(y=v(t)\) is different in each of the three time intervals: first \(y=2x\text{,}\) then \(y=20\text{,}\) then \(y=4x+120\text{.}\) The graph of this function is shown below:
This example leads to the following definition of a piecewise defined function.
Definition 2.7. Piecewise Defined Function.
A piecewise defined function \(f\) is defined by more than one rule:
where \(\mathcal{D}_{f_{i}}\text{,}\) \(1 \leq i \leq n\text{,}\) are mutually exclusive domains.
Example 2.8. Piecewise Defined Function.
Sketch the graph of the function \(f\) defined by
The function \(f\) is defined in a piecewise fashion on the set of all real numbers. In the subdomain \(\left(\infty ,0\right)\text{,}\) the rule for \(f\) is given by \(f(x) = x\text{.}\) The equation \(y = x\) is a linear equation in the slopeintercept form (with slope \(1\) and intercept \(0\)).
Next, in the subdomain \(\left[0,\infty\right)\text{,}\) the rule for \(f\) is given by \(f(x) = \sqrt{x}\text{.}\) The values of \(f(x)\) corresponding to \(x = 0,1,2,3,4,9,16\) are shown in the following table:
Using these values, we sketch the graph of the function \(f\) as shown in below.
Our focus in this textbook will be on elementary functions . Examples of elementary functions include both algebraic functions, such as polynomials, rational functions, and powers, and transcendental functions, such as exponential, logarithmic, and trigonometric functions.
Exercises for Section 2.1.
Exercise 2.1.1.
Find the domain of each of the following functions:

\(\ds y=x^2+1\)
Answer\(\ds \{x\mid x\in \R\}\) 
\(\ds y=f(x)=\sqrt{2x3}\)
AnswerSolution\(\ds \{x\mid x\ge 3/2\}\)We need \(2x3 \geq 0\text{.}\) The domain is thus \(\left[\frac{3}{2}, \infty\right)\text{.}\) 
\(\ds y=f(x)=1/(x+1)\)
AnswerSolution\(\ds \{x\mid x\not=1\}\)Since we cannot have denominator equal to \(0\text{,}\) \(x \neq 1\text{.}\) 
\(\ds y=f(x)=1/(x^21)\)
Answer\(\ds \{x\mid x\not=1 \hbox{ and } x\not=1\}\) 
\(\ds y=f(x)=\sqrt{1/x}\)
Answer\(\ds \{x\mid x\lt 0\}\) 
\(\ds y=f(x)={\root 3 \of x}\)
AnswerSolution\(\ds \{x\mid x\in \R\}\)Unlike the square root, there are no domain restrictions here, since any negative number can be cuberooted. 
\(\ds y=f(x)=\sqrt{r^2(xh)^2}\text{,}\) where \(r\) and \(h\) are positive constants.
Answer\(\ds \{x\mid hr\le x\le h+r\}\) 
\(\ds y=f(x) = {\root 4 \of x}\)
Answer\(\ds \{x\mid x\ge0\}\) 
\(\ds y=\sqrt{1x^2}\)
AnswerSolution\(\ds \{x\mid 1\le x\le 1\}\)The domain of \(y = \sqrt{1x^2}\) is all \(x \in \mathbb{R}\) such that:
\begin{equation*} \begin{gathered} 1x^2 \geq 0 \\ x^2 \leq 1 \\ 1 \leq x \leq 1 \end{gathered} \end{equation*}Thus, the domain is \([1,1]\text{.}\)

\(\ds y=f(x)=\sqrt{1(1/x)}\)
Answer\(\ds \{x\mid x\ge 1\}\) 
\(\ds y=f(x)=1/\sqrt{1(3x)^2}\)
Answer\(\ds \{x\mid 1/3\lt x\lt 1/3\}\) 
\(\ds y=f(x)=\sqrt{x}+1/(x1)\)
Answer\(\ds \{x\mid x\ge0 \hbox{ and } x\not=1\}\) 
\(\ds y=f(x)=1/(\sqrt{x}1)\)
AnswerSolution\(\ds \{x\mid x\ge0 \hbox{ and } x\not=1\}\)The domain of \(f(x) = \frac{1}{\sqrt{x}1}\) is the set of all \(x \in \mathbb{R}\) which satisfy the two conditions: \(\sqrt{x} \neq 1\text{,}\) and \(x \geq 0\text{.}\) Therefore, the domain is \([0,1) \cup (1,\infty)\text{.}\)
Exercise 2.1.2.
A farmer wants to build a fence along a river. He has 500 feet of fencing and wants to enclose a rectangular pen on three sides (with the river providing the fourth side). If \(x\) is the length of the side perpendicular to the river, determine the area of the pen as a function of \(x\text{.}\) What is the domain of this function?
AnswerLet \(x\) be the length of fence along the side perpendicular to the river, and let \(y\) be the length of fence parallel to the river:
The total length of fencing is then \(x + x + y = 500\text{,}\) and so we must have that \(y = 500  2x\text{.}\) If we approximate the river by a straight line, the area enclosed by the fence and river can be given as a function of \(x\text{:}\)
Both the side length \(x\) and the total area \(A\) must be nonnegative. Therefore, the domain of \(A\) will be all \(x \in \mathbb{R}\) such that \(x > 0\) and \(A(x) > 0 \implies 500  2x \geq 0 \implies x \leq 250\text{.}\) Hence, the domain is \((0, 250)\text{.}\)
Exercise 2.1.3.
A can in the shape of a cylinder is to be made with a total of 100 square centimetres of material in the side, top, and bottom; the manufacturer wants the can to hold the maximum possible volume. Write the volume as a function of the radius \(r\) of the can; find the domain of the function.
AnswerYou are given \(100\) cm\(^{2}\) of material with which to build a cylinder. Let \(r, h, V\) be the radius, height and volume (respectively) of the object. The material must cover the entire surface area,
Eventually, we want a formula for the volume of the can as a function of \(r\text{,}\) so let's write \(h\) as a function of \(r\text{:}\)
assuming that \(r \neq 0\) (note that this would be an uninteresting case). The volume of the cyclinder can now be expressed as a function of \(r\text{,}\)
\(r\) and \(V\) both represent positive physical quantities, which, together with the assumption that \(r \neq 0\text{,}\) gives the domain \(0 \lt r \leq \sqrt{\frac{50}{\pi}}\text{.}\)
Exercise 2.1.4.
A can in the shape of a cylinder is to be made to hold a volume of one liter (1000 cubic centimetres). The manufacturer wants to use the least possible material for the can. Write the surface area of the can (total of the top, bottom, and side) as a function of the radius \(r\) of the can; find the domain of the function.
AnswerExercise 2.1.5.
Let \(f\) be the function defined by
Find \(f(1)\text{,}\) \(f(0)\text{,}\) \(f(1)\text{,}\) and \(f(2)\text{.}\)
AnswerExercise 2.1.6.
For each of the following functions, sketch the graph and find the domain and range.

\(f(x) = \begin{cases} x \amp x \lt 0\\ 2x+1 \amp x \geq 0 \end{cases}\)
AnswerDomain is \(\left(\infty ,\infty\right)\text{.}\) Range is \(\left(\infty ,0\right) \cup \left[\infty ,\infty\right)\text{.}\)

\(f(x) = \begin{cases} x+1 \amp x \leq 1\\ x^{2}1 \amp x > 1 \end{cases}\)
AnswerDomain is \(\left(\infty , \infty\right)\text{.}\) Range is \(\left[0 , \infty\right)\text{.}\)
Exercise 2.1.7.
In \(2006\text{,}\) the Canadian postage for domestic lettermail was $\(0.51\) for the first \(30\) grams or a fraction thereof, $\(0.89\) over \(30\)g and up to \(50\)g, $\(1.05\) over \(50\)g and up to \(100\)g, $\(1.78\) over \(100\)g and up to \(200\)g, and $\(2.49\) over \(200\)g and up to \(500\)g. Any lettermail not exceeding $\(500\)g may be sent by domestic mail. Letting \(x\) denote the weight of a parcel in grams and \(f(x)\) the postage in dollars, complete the following description of the "lettermail function" \(f\text{:}\)
Sketch the graph of \(f\) and state the domain.
Solution\(x \in \left[0,500\right]\text{.}\)