# Functions and Relations

A function is a relation between two sets called the domain and range, in which each element of the domain corresponds to exactly one element of the range. The relationship can be represented by a mapping diagram, an algebraic rule, or a graph.

A relation is a set of ordered pairs. Relations can be represented in a variety of ways, including lists, diagrams, equations, and graphs. The domain of a relation is the set of the first coordinates of the ordered pairs in the relation. The first coordinate is often represented by the variable $x$. The range of a relation is the set of the second coordinates of the ordered pairs in the relation. The second coordinate is often represented by the variable $y$.

A type of relation that is particularly important is called a function. A function is a relation in which each element of the domain corresponds to exactly one element of the range.

The domain of a function is the set of the first coordinates of the ordered pairs. A value in the domain of the function is called the input. The independent variable represents the input values of a function.

The range of a function is the set of the second coordinates of the ordered pairs. A value in the range of the function is called the output. The dependent variable represents the output values of a function.

In a function, each input has a unique output. If $y$ is a function of $x$, then every $x$-value corresponds to only one $y$-value.

Relation That Is Not a Function Relation That Is a Function
The mapping diagram represents
the set of ordered pairs $\{(1,5),(1,7),(2,7),(3,9)\}$. The relation is not a function because the value of 1 in the domain corresponds to both 5 and 7 in the range.
The mapping diagram represents the set of ordered pairs $\{(1,5),(2,7),(3,7)\}$. Each value in the domain corresponds to only one value in the range, so the relation is a function. Note that a value in the range can correspond to more than one value in the domain.

A function can be named by a letter, such as $f$. When the function $f$ is written as an equation, the dependent variable is sometimes written as $f(x)$ rather than $y$. Read $f(x)$ as "$f$ of $x$." It represents the value of the function $f$ at $x$. While functions are frequently called $f$, they may be named with any letter to distinguish among several functions or describe the output.

For example, three functions may be named $f$, $g$, and $h$.
$f(x)=x+3\;\;\;\;\;g(x)=5x+9\;\;\;\;\;h(x)=x^2+2x+7$
Another type of function, known as a cost function, might be labeled $C$. This could describe the cost of producing a quantity, $q$, of an item.
$C(q)=q^3-14q^2+160$
If a relation is described by an equation in two variables $x$ and $y$, to determine whether the relation is a function of $x$, determine whether any value of $x$ could correspond to more than one value of $y$. For example, the equation $y=x^2$ represents a function of $x$ because, for every value of $x$, that is substituted into the equation, there is only one possible $y$-value that results. However, the equation $x=y^2$ does not represent a function of $x$ because an $x$-value, such as 1 corresponds to two $y$-values, 1 and –1.

### Domain and Range

The domain and range of a function are the sets of values that define a function. The domain is all possible inputs to the function. The range is all possible outputs from the function.
To describe the domain and range of a function, identify the set of all possible inputs and the corresponding set of outputs. When a function is represented in a table, the inputs, or $x$-values, represent the domain. The outputs, or values of $f(x)$, represent the range.
$x$ $f(x)$
15 30
20 40
25 50

The function $f(x)$ is represented by a table. The domain is the set of inputs, or $x$-values shown in the table: $\{15,20,25\}$. The range is the set of outputs, or $f(x)$ values shown in the table: $\{30,40,50\}$.

When a function is represented by an equation, analyze the equation to determine all possible input and output values.

• For the domain, look for values that would make the function undefined. This includes values that would make the denominator of a fraction equal to zero or values that would make an expression under a square root have a negative value.
• For the range, look for any values that could not be the output of the function. For example, if an expression is squared or a square root, the value cannot be negative. A fraction with a nonzero numerator cannot be equal to zero.
Step-By-Step Example
Determining the Domain and Range
Identify the domain and range of the function:
$f(x) = 2x$
Step 1
Determine the possible input values. Any value can be used for $x$, so the domain is the set of all real numbers.
Step 2
Determine the possible output values. Any value could be the output of the function, so the range is also the set of all real numbers.
Solution

Write the domain and range. Both the domain and range are all real numbers.

Using inequality notation, the domain is written as:
$-\infty \lt x \lt \infty$
The range is written as:
$-\infty \lt y \lt \infty$
In interval notation, both the domain and range are written as $\left(-\infty,\infty\right)$.
Step-By-Step Example
Determining the Domain and Range of a Radical Function
Identify the domain and range of the function:
$f(x)=\sqrt{x+5}$
Step 1
Determine the possible input values. The expression under the radical cannot be negative. So, the value of $x$ must be greater than or equal to –5. Check this reasoning by setting the entire expression equal to zero and then solve for $x$.
\begin{aligned}x+5 &\ge 0\\x+5-5 &\ge 0-5 \\ x&\ge -5 \end{aligned}
Step 2
Determine the possible output values. The square root symbol represents the positive root, so all outputs of the function are positive. The possible outputs are all positive numbers and zero.
Solution
Write the domain and range. Using inequality notation, the domain is written as $x\ge-5$ and the range is $y\ge0$. Using interval notation, the domain is $[-5,\infty)$ and the range is $[0,\infty)$.

### Evaluating Functions

A function can be evaluated for a specific element in the domain by finding the corresponding element of the range.
It is often necessary to evaluate a function, or find its output value for a given input. The $x$-value is substituted into the equation, and the resulting expression is simplified. A "machine" can be used to represent a function, showing the input values going into the machine and the output values coming out after the rule is applied.
To evaluate a function for a given value of an expression:
1. Write the equation.
2. Replace each $x$ with the desired value or expression.
3. Simplify the resulting expression.

The input of a function can also be an algebraic expression. In this case, the output will also be an algebraic expression, not just a number.

Step-By-Step Example
Evaluating a Function
The function $f$ is defined by the rule:
$f(x)=x^2+3x+6$
Determine $f(2)$.
Step 1
Substitute 2 into the equation, replacing each $x$.
\begin{aligned}f({\color{#c42126}x})&={\color{#c42126}x}^2+3{\color{#c42126}x}+6\\f({\color{#c42126}2})&={\color{#c42126}2}^2+3\cdot{\color{#c42126}2}+6\end{aligned}
Step 2
Simplify the resulting numerical expression.
\begin{aligned}f({\color{#c42126}2})&={\color{#c42126}2}^2+3\cdot{\color{#c42126}2}+6\\&=4+6+6\\&=16\end{aligned}
Solution
$f(2)=16$
Step-By-Step Example
Evaluating a Function for an Algebraic Expression
The function $f$ is defined by the rule:
$f(x)=2x+7$
Determine $f(x+1)$.
Step 1
Substitute $x+1$ into the equation, replacing each $x$.
\begin{aligned}f({\color{#c42126}x})&=2{\color{#c42126}x}+7\\f({\color{#c42126} {x+1}})&=2{\color{#c42126} {(x+1)}}+7\end{aligned}
Remember that the variable, $x$, is simply a placeholder. Write it using blanks for the variables, and then fill in the blanks with the desired expression.
$f(\underline{\hspace{1.5cm}})=2(\underline{\hspace{1.5cm}})+7$
Step 2
Simplify the resulting numerical expression.
\begin{aligned}f({\color{#c42126} {x+1}})&=2{\color{#c42126} {(x+1)}}+7\\ &={\color{#c42126}{2x+2}}+7\\&=2x+9\end{aligned}
Solution
$f(x+1)=2x+9$

### Operations with Functions

Functions can be added, subtracted, multiplied, and divided.
Functions that are written as equations can be added, subtracted, multiplied, or divided. First, add, subtract, multiply, or divide the expressions, and then simplify if needed.

### Operations with Functions

Operation $f(x)= 3x$ and $g(x)= x-1$
\begin{aligned}(f+g)(x)&= {\color{#c42126}f(x)} + {\color{#0047af}g(x)}\\&= {\color{#c42126}3x} + {\color{#0047af}(x-1)}\\&=4x-1\end{aligned}
\begin{aligned}(f-g)(x) &= {\color{#c42126}f(x)} - {\color{#0047af}g(x)}\\ &={\color{#c42126}3x} \color{black}- {\color{#0047af}(x-1)}\\ &=3x-x+1\\ &=2x+1\end{aligned}
\begin{aligned}(f\cdot g)(x)&= {\color{#c42126}f(x)} \cdot {\color{#0047af}g(x)}\\&={\color{#c42126}3x} \cdot {\color{#0047af}(x-1)}\\&=3x^2-3x\end{aligned}
\begin{aligned}\left ( \frac{f}{g} \right ) (x) &= \frac{{\color{#c42126} f(x)}}{{\color{#0047af} g(x)}}\\&=\frac{{\color{#c42126} 3x}}{{\color{#0047af} x-1}}\end{aligned}