# 8.1 Functions

## 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.

#### Concept Check

Can you determine what is input and what is output in a relationship? Which value in a relationship represents the independent and which represents the dependent variable? Try this quick set of multiple choice exercises:

MathMatize: Independent vs. dependent variables

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.

In this course we will be working with relationships of the first type, where for each input value we get one and only one output value. In other words, there is no ambiguity about the result – it is uniquely determined by the given information, or input. These types of relationships are called functions and have many very useful properties that will allow us to study those relationships in great detail.

#### 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 1

Is height a function of age? Is age a function of height?

Answer: 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.

#### Concept Check

Can you determine if a relationship could be represented as a function or possibly not? Test your understanding of the concept of function through these quick multiple choice and fill-in-the-blank exercises:

MathMatize: Function or not?

## Function Notation

As you can see from Concept Check exercises above, talking about relationships can get quite “wordy”. 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 variables used 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. We can then simply write $h(a)$ to say “height is a function of age”.

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 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?

Answer: 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.

#### Concept Check

Function notation can be confusing. Check if you are on the right track connecting words to symbols and symbols to words when discussing relationships represented through functions:

Try MathMatize: Function notation

## 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.

Important note: by convention, the first row (or column) in a table represents the independent variable.

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 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 4

Answer:  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.

## 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 4

Using the table shown, where $Q=g(n)$

 $n$ 1 2 3 4 5 $Q$ 8 6 7 6 8

a) Evaluate $g(3)$.
b) Solve $g(n)=6$.

a) Evaluate $g(3)$: 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$.

b) Solve $g(n)=6$: 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$.

#### Concept Check

Here are some examples relationships represented using tables. Which ones of them represent functions?

MathMatize: Functions from data tables

## 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 5

Which of these graphs defines a function $y=f(x)$?

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 third 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 and so the graph does not represent a function.

Evaluating a function using a graph requires taking the given input (horizontal axis) and using the graph to look up the corresponding output. Solving a function equation using a graph requires taking the given output and looking on the graph to determine the corresponding input.

#### Example 6

Consider the graph below.

a) Evaluate $f(2)$.

b) Solve $f(x) = 4$.

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 $f(x)=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.

Note 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, i.e., there are two or more inputs that map to the same output. This, in turn, means this relationship cannot be reversed, i.e., $f$ is a function of $x$, but $x$ is not a function of $f$ because otherwise there would be input values $f$ giving more than one output $x$. On the other hand, if a function is one-to-one, i.e., no output values are repeated, then the function is invertible.

## 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.

#### Concept in Action – Demo by Video

Writing functions as rules:

#### Example 7

Express the relationship $2n + 6p = 12$ as a function $p(n)$ if possible.

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{align*}&2n + 6p = 12\\ &\Rightarrow 6p = 12 - 2n\\ &\Rightarrow p=\frac{12-2n}{6}=\frac{12}{6}-\frac{2n}{6}=2-\frac{1}{3}n \end{align*}

Having rewritten the formula to solve for $p$, we can now express $p$ as a function of $n$:

$p(n)=2-\frac{1}{3}n$

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 a function will require replacing the input variable in the formula with the value provided and calculating the value of the expression. Solving a function will require replacing the output variable in the formula with the value provided, and rearranging the function formula to solve for the input(s) that would produce that output.

#### Example 8

Given the function $k(t)=t^3+2$:
a) Evaluate $k(2)$.
b) Solve $k(t)=1$.

a) To evaluate $k(2)$, we plug in the input value 2 into the formula wherever we see the input variable $t$, then simplify:
$k(2) = 2^3+2 = 8+2 =10$

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:

\begin{align*} k(t) &= 1 & \\ &\Rightarrow t^3+2 = 1 &\text{substitute the original formula} \\ &\Rightarrow t^3 = -1 &\text{subtract 2 from each side} \\ &\Rightarrow t = -1 &\text{take the cube root of each side} \end{align*}

We want to know if $k(t) = 1$ is true when $t=-1$: \begin{align*}k(-1) & = (-1)^3+2\\ & = -1+2\\ & = 1\end{align*} which was the desired result.

## Basic Function Types

There are some basic functions that one should know and be able to recognize through name and shape. General functions will often come from these basic types through various operations and transformations. These basic types are listed below and for their definitions we will use $x$ as the input variable and $f(x)$ as the output variable.

#### Basic functions

 Constant: $f(x)=c$, where $c$ is a constant (number) Identity: $f(x)=x$ Absolute Value: $f(x)=|x|$ Quadratic: $f(x)=x^2$ Cubic: $f(x)=x^3$ Reciprocal: $f(x)=\frac{1}{x}$ General reciprocal: $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 Basic Types of Functions

Constant, $f(x)=c$ (c is 2 in this picture).

Identity: $f(x)=x$.

Absolute Value: $f(x)=|x|$

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}$

#### Concept in Action - Visualization

See these functions for yourself:

Geogebra: Basic types of functions (click on circle beside the function whose graph you would like to explore)

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 all possible input values to a function.
Range: The set of all possible output values of a function.

#### Example 9

Using the tree table above, determine a reasonable domain and range.

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 more than 0 and less than 120 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 more than 0 and less than 380 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 curved parentheses are also referred to as open while the square ones are referred to as closed. The table below will help you see how inequalities correspond to interval notation:

 Inequality Interval Notation $5 \lt h \leq10$ $(5, 10]$ $5 \lt h \lt 10$ $(5, 10)$ $5\leq h \lt10$ $[5, 10)$ $h \lt10$ $(-\infty,10)$ $h\geq10$ $[10,\infty)$ All real numbers ($\mathbb{R}$) $(-\infty,\infty)$

#### Example 10

Describe the intervals of values shown on the line graph below using set builder and interval notations:

To describe the values of $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.

Written as an inequality, it is $1\leq x\leq 3$ or $x \gt 5$.

Written in interval notation, it is $[1,3]\cup(5,\infty)$.

#### Example 11

Find the domain of each function:

a) $f(x)=2\sqrt{x+4}$

b) $g(x)=\dfrac{3}{6-3x}$

a) 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)$.

b) 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)$.

#### Example 12

A phone data plan has a basic charge of $30 a month. The plan includes first 2GB free and charges$10 for each additional GB, up to 8 GB total usage, after which it charges $15 for each additional GB. If $d$ is the amount of data used (in GB) and $C$ is the total monthly cost: a. Express $C(d)$ as a (piece-wise) formula. b. Identify the domain and range of $C(d)$. c. Graph $C$ as a function of $d$ for $0\le d\le 10$. d. Calculate the cost if 9GB were used. Answer: a. Task: $C(d)=?$ Conditions: only basic charge for first 2GB $\Rightarrow C(d)=\underbrace{30}_{\text{basic charge}}, 0\le d\le 2$ after 2GB and up to 8 GB, charge of$10/GB for additional GB
$\Rightarrow C(d)=\underbrace{30}_{\text{cost of first 2GB}}+\underbrace{10(d-2)}_{\text{cost above 2GB}}=10d+10, 2< d\le 8$

after 8GB, charge of 15/GB for additional GB $\Rightarrow C(d)=\underbrace{30+10(8-2)}_{\text{cost of first 8GB}}+\underbrace{15(d-8)}_{\text{cost above 8GB}}=15d-30, 2< d\le 8$ In piece-wise form: $C(d)=\begin{cases} 30 & 0\le d\le 2 \\ 10d+10& 2< d\le 8 \\ 15d-30 & 8< d \end{cases}$ b. domain: all possible input values input: amount of data used $d$ $C(d)$ can be calculated for any value of $d$ so $d$ can be any real number. $d=\text{amount of data used}\rightarrow$ can't be negative, no upper limit $\Rightarrow d\ge 0$ $\Rightarrow domain = [0,\infty)$ range: all possible output values output: cost $C(d)$ cost is at least 30, no upper limit $\Rightarrow C(d)\ge 30$ $\Rightarrow range = [30,\infty)$ c. Each section is a linear function so we can graph each section by finding two points that belong to the respective lines: \begin{align*} 0\le d\le 2&:C(0)=30; C(2)=30\\ 2< d\le 8&: C(2)=10\cdot 2+10=30; C(8)=10\cdot 8+10=90\\ d>8&:C(8)=15\cdot 8-30=90; C(20)=15\cdot 20-30=270 \end{align*} (Note that for the last section our choice for 20 as input was arbitrary; we could have picked any number greater than 8.) So the graph looks as follows: d. $C(9)=?$ Since $9>8$, $C(d)=15d-30$ applies and so $C(9)=15\cdot 9-30=105$. Hence the cost if 9GB are used is105.

#### Concept Check

Test your understanding of the concepts discussed in this section: Functions as relationships

## Section Exercises

Work on the following exercises. Discuss your solutions with your peers and/or course instructor.

Section 8.1 Exercises - Functions