1.1: Functions
- Last updated
- Save as PDF
- Page ID
- 80873
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\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]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\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]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
What is a Function?
The natural world is full of relationships between quantities that change. When we see these relationships, it is natural for us to ask “If I know one quantity, can I then determine the other?” This establishes the idea of an input quantity, or independent variable, and a corresponding output quantity, or dependent variable. From this we get the notion of a functional relationship in which the output can be determined from the input.
For some quantities, like height and age, there are certainly relationships between these quantities. Given a specific person and any age, it is easy enough to determine their height, but if we tried to reverse that relationship and determine height from a given age that would be problematic, since most people maintain the same height for many years.
Function
A function is rule for a relationship between an input, or independent, quantity and an output, or dependent, quantity in which each input value uniquely determines one output value. We say the output is a function of the input.
Example \(\PageIndex{1}\)
In the height and age example above, is height a function of age? Is age a function of height?
In the height and age example above, it would be correct to say that height is a function of age, since each age uniquely determines a height. For example, on my 18th birthday, I had exactly one height of 69 inches.
However, age is not a function of height, since one height input might correspond with more than one output age. For example, for an input height of 70 inches, there is more than one output of age since I was 70 inches at the age of 20 and 21.
Function Notation
To simplify writing out expressions and equations involving functions, a simplified notation is often used. We also use descriptive variables to help us remember the meaning of the quantities in the problem.
Rather than write height is a function of age,
we could use the descriptive variable \(h\) to represent height and we could use the descriptive variable \(a\) to represent age.
"height is a function of age" | if we name the function \(f\) we write |
"\(h\) is \(f\) of \(a\)" | or more simply |
\(h = f(a)\) | we could instead name the function \(h\) and write |
\(h(a)\) | which is read "\(h\) of \(a\)" |
Remember we can use any variable to name the function; the notation \(h(a)\) shows us that \(h\) depends on \(a\). The value \(a\)
must be put into the function \(h\)
to get a result. Be careful – the parentheses indicate that age is input into the function (Note: do not confuse these parentheses with multiplication!).
Function Notation
The notation output = \(f\)(input) defines a function named \(f\). This would be read output is \(f\) of input.
Example \(\PageIndex{2}\)
A function \(N = f(y)\) gives the number of police officers, \(N\), in a town in year \(y\). What does \(f(2005) = 300\) tell us?
Solution
When we read \(f(2005) = 300\), we see the input quantity is 2005, which is a value for the input quantity of the function, the year (\(y\)). The output value is 300, the number of police officers (\(N\)), a value for the output quantity. Remember \(N=f(y)\). So this tells us that in the year 2005 there were 300 police officers in the town.
Tables as Functions
Functions can be represented in many ways: Words (as we did in the last few examples), tables of values, graphs, or formulas. Represented as a table, we are presented with a list of input and output values.
This table represents the age of children in years and their corresponding heights. While some tables show all the information we know about a function, this particular table represents just some of the data available for height and ages of children.
(input) \(a\), age in years | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|
(output) \(h\), height in inches | 40 | 42 | 44 | 47 | 50 | 52 | 54 |
Example \(\PageIndex{3}\)
Which of these tables define a function (if any)?
Input | Output |
---|---|
2 | 1 |
5 | 3 |
8 | 6 |
Input | Output |
---|---|
-3 | 5 |
0 | 1 |
4 | 5 |
Input | Output |
---|---|
1 | 0 |
5 | 2 |
5 |
Solution
The first and second tables define functions. In both, each input corresponds to exactly one output. The third table does not define a function since the input value of 5 corresponds with two different output values.
To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video
Solving and Evaluating Functions
When we work with functions, there are two typical things we do: evaluate and solve. Evaluating a function is what we do when we know an input, and use the function to determine the corresponding output. Evaluating will always produce one result, since each input of a function corresponds to exactly one output.
Solving equations involving a function is what we do when we know an output, and use the function to determine the inputs that would produce that output. Solving a function could produce more than one solution, since different inputs can produce the same output.
Example \(\PageIndex{4}\)
Using the table shown, where \(Q=g(n)\)
\(n\) | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
\(Q\) | 8 | 6 | 7 | 6 | 8 |
- Evaluate \(g(3)\)
- Solve \(g(n)=6\)
Solution
Evaluating g(3) (read: “g of 3”) means that we need to determine the output value, Q, of the function g given the input value of n=3. Looking at the table, we see the output corresponding to n=3 is Q=7, allowing us to conclude g(3) = 7.
Solving g(n) = 6 means we need to determine what input values, n, produce an output value of 6. Looking at the table we see there are two solutions: n = 2 and n = 4. When we input 2 into the function g, our output is Q = 6 When we input 4 into the function g, our output is also Q = 6
Graphs as Functions
Oftentimes a graph of a relationship can be used to define a function. By convention, graphs are typically created with the input quantity along the horizontal axis and the output quantity along the vertical.
Example \(\PageIndex{5}\)
Which of these graphs defines a function \(y=f(x)\)?
Solution
Looking at the three graphs above, the first two define a function y=f(x), since for each input value along the horizontal axis there is exactly one output value corresponding, determined by the y-value of the graph. The 3rd graph does not define a function y=f(x) since some input values, such as x=2, correspond with more than one output value.
Vertical Line Test
The vertical line test is a handy way to think about whether a graph defines the vertical output as a function of the horizontal input. Imagine drawing vertical lines through the graph. If any vertical line would cross the graph more than once, then the graph does not define only one vertical output for each horizontal input.
Example \(\PageIndex{6}\)
Given the graph below,
- Evaluate \(f(2)\).
- Solve \(f(x) = 4\).
Solution
a) To evaluate f(2), we find the input of x=2 on the horizontal axis. Moving up to the graph gives the point (2, 1), giving an output of y=1. So f(2) = 1
b) To solve f(x) = 4, we find the value 4 on the vertical axis because if f(x) = 4 then 4 is the output. Moving horizontally across the graph gives two points with the output of 4: (-1,4) and (3,4). These give the two solutions to f(x) = 4: x = -1 or x = 3 This means f(-1)=4 and f(3)=4, or when the input is -1 or 3, the output is 4.
Notice that while the graph in the previous example is a function, getting two input values for the output value of 4 shows us that this function is not one-to-one.
Formulas as Functions
When possible, it is very convenient to define relationships using formulas. If it is possible to express the output as a formula involving the input quantity, then we can define a function.
Example \(\PageIndex{7}\)
Express the relationship \(2n + 6p = 12\) as a function \(p = f(n)\) if possible.
Solution
To express the relationship in this form, we need to be able to write the relationship where \(p\) is a function of \(n\), which means writing it as \(p=\) [something involving \(n\) ].
\[
\begin{array}{l}
2 n+6 p=12 \quad \text { subtract } 2 n \text { from both sides } \\
6 p=12-2 n \quad \text { divide both sides by } 6 \text { and simplify } \\
p=\frac{12-2 n}{6}=\frac{12}{6}-\frac{2 n}{6}=2-\frac{1}{3} n \\
\end{array}
\notag \]
Having rewritten the formula as \(p=\), we can now express \(p\) as a function:
\[
p=f(n)=2-\frac{1}{3} n
\notag \]
Not every relationship can be expressed as a function with a formula. As with tables and graphs, it is common to evaluate and solve functions involving formulas. Evaluating will require replacing the input variable in the formula with the value provided and calculating. Solving will require replacing the output variable in the formula with the value provided, and solving for the input(s) that would produce that output.
Example \(\PageIndex{8}\)
Given the function \(k(t)=t^3+2\):
- Evaluate \(k(2)\).
- Solve \(k(t)=1\).
Solution
a) To evaluate \(k(2)\), we plug in the input value 2 into the formula wherever we see the input variable \(t\), then simplify
\[
\begin{array}{l}
k(2)=2^3+2 \\
k(2)=8+2
\end{array}
\notag \]
So \(k(2)=10\)
b) To solve \(k(t)=1\), we set the formula for \(k(t)\) equal to 1 , and solve for the input value that will produce that output
\[
k(t)=1 \quad \text { substitute the original formula } k(t)=t^3+2
\notag \]
\(t^3+2=1 \quad\) subtract 2 from each side
\(t^3=-1 \quad\) take the cube root of each side
\(t=-1\)
When solving an equation using formulas, you can check your answer by using your solution in the original equation to see if your calculated answer is correct.
We want to know if \(k(t)=1\) is true when \(t=-1\).
\[
\begin{aligned}
k(-1) & =(-1)^3+2 \\
& =-1+2 \\
= & 1 \text { which was the desired result. }
\end{aligned}
\]
Basic Toolkit Functions
There are some basic functions that it is helpful to know the name and shape of. We call these the basic toolkit of functions.
For these definitions we will use \(x\) as the input variable and \(f(x)\) as the output variable.
Toolkit Functions
Linear | |
Constant: | \(f(x)=c\), where \(c\) is a constant (number) |
Identity: | \(f(x)=x\) |
Absolute Value: | \(f(x)=|x|\) |
Power | |
Quadratic: | \(f(x)=x^2\) |
Cubic: | \(f(x)=x^3\) |
Reciprocal: | \(f(x)=\frac{1}{x}\) |
Reciprocal squared: | \(f(x)=\frac{1}{x^2}\) |
Square root: | \(f(x)=\sqrt[2]{x}=\sqrt{x}\) |
Cube root: | \(f(x)=\sqrt[3]{x}\) |
Graphs of the Toolkit Functions
One of our main goals in mathematics is to model the real world with mathematical functions. In doing so, it is important to keep in mind the limitations of those models we create.
This table shows a relationship between circumference and height of a tree as it grows.
Circumference, \(c\) | 1.7 | 2.5 | 5.5 | 8.2 | 13.7 |
Height, \(h\) | 24.5 | 31 | 45.2 | 54.6 | 92.1 |
While there is a strong relationship between the two, it would certainly be ridiculous to talk about a tree with a circumference of -3 feet, or a height of 3000 feet. When we identify limitations on the inputs and outputs of a function, we are determining the domain and range of the function.
Domain and Range
- Domain: The set of possible input values to a function.
- Range: The set of possible output values of a function
Example \(\PageIndex{9}\)
Using the tree table above, determine a reasonable domain and range.
Solution
We could combine the data provided with our own experiences and reason to approximate the domain and range of the function \( h = f(c)\). For the domain, possible values for the input circumference c, it doesn’t make sense to have negative values, so \(c > 0\). We could make an educated guess at a maximum reasonable value, or look up that the maximum circumference measured is about 119 feet. With this information we would say a reasonable domain is feet.
Similarly for the range, it doesn’t make sense to have negative heights, and the maximum height of a tree could be looked up to be 379 feet, so a reasonable range is feet.
A more compact alternative to inequality notation is interval notation, in which intervals of values are referred to by the starting and ending values. Curved parentheses are used for strictly less than,
and square brackets are used for less than or equal to.
Since infinity is not a number, we can’t include it in the interval, so we always use curved parentheses with \(\infty\) and \(-\infty\). The table below will help you see how inequalities correspond to interval notation:
Inequality | Interval notation |
---|---|
\( 5 \lt h \leq10 \) | (5, 10] |
\(5\leq h \lt10 \) | [5, 10) |
\(5 \lt h \lt 10\) | (5, 10) |
\(h \lt10\) | \((-\infty,10)\) |
\(h\geq10\) | \([10,\infty)\) |
All real numbers (\(\mathbb{R}\)) | \((-\infty,\infty)\) |
Example \(\PageIndex{10}\)
Describe the intervals of values shown on the line graph below using set builder and interval notations:
Solution
To describe the values, \(x\), that lie in the intervals shown above we would say, \(x\) is a real number greater than or equal to 1 and less than or equal to 3, or a real number greater than 5.
As an inequality it is \(1\leq x\leq 3\) or \(x \gt 5 \)
. In interval notation it is \([1,3]\cup(5,\infty)\)
.
Example \(\PageIndex{11}\)
Find the domain of each function:
- \(f(x)=2\sqrt{x+4}\)
- \(g(x)=\dfrac{3}{6-3x}\)
Solution
- Since we cannot take the square root of a negative number, we need the inside of the square root to be non-negative. \(x+4\geq 0\) when \(x\geq -4\), so the domain of \(f(x)\) is \([-4,\infty)\).
- We cannot divide by zero, so we need the denominator to be non-zero. \(6-3x=0\) when \(x = 2\), so we must exclude 2 from the domain. The domain of \(g(x)\) is \((-\infty,2)\cup(2,\infty)\).