# 1.4: Functions

$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$$$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

A function $$y=f(x)$$ is a rule for determining $$y$$ when we're given a value of $$x$$. 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$$, a function must give at most one value of $$y$$. Thus, vertical lines are not functions. For example, the line $$x=1$$ has infinitely many values of $$y$$ if $$x=1$$. It is also true that if $$x$$ is any number not 1 there is no $$y$$ which corresponds to $$x$$, but that is not a problem---only multiple $$y$$ values is a problem.

In addition to lines, another familiar example of a function is the parabola $$y=f(x)=x^2$$. 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)$$. Then connect the points with a smooth curve. (See figure 1.3.1.)

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. Figure 1.3.1. Some graphs

For example, the square-root function $$y=f(x)=\sqrt{x}$$ is the rule which says, given an $$x$$-value, take the nonnegative number whose square is $$x$$. This rule only makes sense if $$x$$ is positive or zero. We say that the domain of this function is $$x\ge 0$$, or more formally $$\{x\in R\mid x\ge 0\}$$. Alternately, we can use interval notation, and write that the domain is $$0,\infty)$$. (In interval notation, square brackets mean that the endpoint is included, and a parenthesis means that the endpoint is not included.) The fact that the domain of $$y=\sqrt{x}$$ is $$[0,\infty)$$ means that in the graph of this function (see figure 1.3.1) 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$$, the reciprocal function. We cannot substitute $$x=0$$ in this formula. The function makes sense, however, for any nonzero $$x$$, so we take the domain to be:

$\{x\in R\mid x\ne 0.\}$

The graph of this function does not have any point $$(x,y)$$ with $$x=0$$. 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 that (i) we cannot divide by zero, and (ii) we cannot take the square root of a negative number. 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$$, then we can write $$y=f(x)=x^2$$. In a purely mathematical context the domain of the function $$y=x^2$$ is all of $$R$$. But in the story-problem context of finding areas of squares, we restrict the domain to positive values of $$x$$, 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. But 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, often letters different from $$x$$ and $$y$$ are used. For example, the volume $$V$$ of a sphere is a function of the radius $$r$$, given by the formula $$V=f(r)=\frac4/3\pi r^3$$. Also, letters different from $$f$$ may be used. For example, if $$y$$ is the velocity of something at time $$t$$, 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.

This formula makes mathematical sense for any $$x$$, 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 $$\{x\in R\mid 0 < x < {1\over2}(\hbox{minimum of $$a$$ and $$b$$})\}.$$ In interval notation we write: the domain is the interval $$(0,\min(a,b)/2)$$. (You might think about whether we could allow 0 or $$\min(a,b)/2$$ 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 make sense?) To answer this question, we must rule out the $$x$$-values that make $$4x-x^2$$ negative (because we cannot take the square root of a negative number) and also the $$x$$-values that make $$4x-x^2$$ zero (because if $$4x-x^2=0$$, 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 $$4x-x^2$$ is strictly positive. We give two different methods to find out when $$4x-x^2>0$$.

• First method. Factor $$4x-x^2$$ as $$x(4-x)$$. The product of two numbers is positive when either both are positive or both are negative, i.e., if either $$x>0$$ and $$4-x>0$$, or else $$x < 0$$ and $$4-x < 0$$. The latter alternative is impossible, since if $$x$$ is negative, then $$4-x$$ is greater than 4, and so cannot be negative. As for the first alternative, the condition $$4-x>0$$ can be rewritten (adding $$x$$ to both sides) as $$4>x$$, so we need: $$x>0$$ and $$4>x$$ (this is sometimes combined in the form $$4>x>0$$, or, equivalently, $$0 < x < 4$$). In interval notation, this says that the domain is the interval $$(0,4)$$.
• Second method. Write $$4x-x^2$$ as $$-(x^2-4x)$$, and then complete the square, obtaining $$-\Bigl((x-2)^2-4\Bigr)=4-(x-2)^2$$. For this to be positive we need $$(x-2)^2 < 4$$, which means that $$x-2$$ must be less than 2 and greater than $$-2$$: $$-2 < x-2 < 2$$. Adding 2 to everything gives $$0 < x < 4$$. Both of these methods are equally correct; you may use either in a problem of this type.

A function does not always have to be given by a single formula, as we have already seen (in the income tax problem, for example). Suppose that $$y=v(t)$$ is the velocity function for a car which starts out from rest (zero velocity) at time $$t=0$$; 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$$, then $$y=20$$, then $$y=-4x+120$$. The graph of this function is shown in figure 1.3.3. Figure 1.3.3. A velocity function

Not all functions are given by formulas at all. A function can be given by an experimentally determined table of values, or by a description other than a formula. For example, the population $$y$$ of the U.S. is a function of the time $$t$$: we can write $$y=f(t)$$. This is a perfectly good function---we could graph it (up to the present) if we had data for various $$t$$---but we can't find an algebraic formula for it.

## Contributors

• Integrated by Justin Marshall.

This page titled 1.4: Functions is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by David Guichard.