# Subsection2.3.1Domain and Range

Sometimes a formula can only accept certain kinds of input values. For instance the square root function \begin{equation*} f(x) = \sqrt x \end{equation*} can only accept values of $x$ that are not negative, because only non-negative inputs allow the function to yield real-valued outputs.

In math we say

The function $f$ has a domain such that $x \geqslant 0$

meaning whatever values we choose for $x\text{,}$ they must be greater than or equal to zero. That's the math way of saying “not negative”.

The domain of a function is the set of all inputs a function is allowed to use.

##### Example2.3.1

Find the domain of the function \begin{equation*} f(x) = \frac{x}{{{x^2} - 1}}. \end{equation*}

Solution

To find the domain of a function, it is sometimes easiest to find the “bad” input values — numbers which are not in the domain. Then, the domain is all numbers except the bad ones. Typical examples of “bad” inputs are those which cause division by zero or negatives under a radical.

Once we find the domain of a function, we can then consider all the possible outputs for the function. The set of all possible outputs is called the range of the function.

##### Example2.3.3

Find the domain and range of the function \begin{equation*} f(x) = \sqrt {x - 8}. \end{equation*}

Solution

At this point it is important to note that when we state the domain of a function, we refer to the input variable. So far our inputs have been called $x\text{,}$ so every domain we have described has had $x$ in it. For instance, $f(x) = \frac{x}{{{x^2} - 1}}$ had the domain $\{x \vert x \neq \pm 1 \}\text{.}$

When we state the range of a function, we must refer to the output. If $y=f(x)$ where $f(x) = \frac{x}{{{x^2} - 1}}\text{,}$ then our range has to refer to $y$ or to $f(x)\text{,}$ both of which represent the output. In this case the range could be written $y \geqslant 0$ or $f(x) \geqslant 0\text{.}$

Identifying the domain and range directly from a formula can be difficult. It is often more clear if we look at functions graphically. Below is a graph of $f(x) = \sqrt {x - 8}$

##### Example2.3.4

Notice the graph only appears for input values $x \geqslant 8\text{.}$ That is the domain of $f\text{.}$

Also notice the graph only appears at or above the $x-$axis. The graph shows us the range is $y \geqslant 0\text{.}$

When you want to find the domain and range of a function, one option is to graph it on a graphing tool. Determine the intervals or boundaries on the horizontal axis where the graph exists. This is the domain.

Next, use the graph to determine if there are vertical intervals or boundaries to how high or low the graph reaches. This is the range.

##### Example2.3.6

Find the domain and range of the function $f(x)$ graphed below.

Solution

In the next exercise, you will manipulate a graph to change its domain and range.

# Subsection2.3.2Piecewise Defined Functions

A piecewise defined function is actually a collection of two or more functions that tell us how to use an input to get an output. Each function must state the domain on which it is defined, that way you know when to use it.

##### Example2.3.9

The cost of renting a snowboard is $25$ per day, or $60$ for three days, or $75$ for a week.

The first cost function is $25$ per day and is good for $1$ or $2$ days. The domain of this function is the “$1$ or $2$ days”. It tells you when to use this cost function.

On the third day is a new cost function, a simple constant of $60\text{.}$

Finally, the constant function $75$ is used when we keep the snowboard for more than $3$ days, up to $7$ days (a full week).

Each rule has its own domain that tells us when to use the rule. In Figure 2.3.10, we see the graph of the price function. Notice the graph has a constant output of $50$ when $1 \lt x \leq 2\text{,}$ but it immediately changes to $60$ when $x \gt 2\text{.}$

##### Example2.3.11

A hot cup of coffee sits on a counter and begins to cool down. The rate at which the coffee cools is related to the temperature of the coffee and the temperature in the room (there's actually a formula for that). The formula is good for as long the situation in the room remains the same.

If you suddenly change the room conditions by turning on the air conditioner, then the rate at which the coffee cools will also change. There would be a new formula to model the coffee's temperature after the air conditioner is switched on.

One formula is good from the time you pour the coffee up until you switch on the air conditioner. Then the other formula takes over after the air conditioner has been turned on.

##### Example2.3.12

In the United States there are $7$ income tax brackets. That means there are $7$ different functions to tell us how much income tax we owe. The function you use is determined by how much money you make.

In other words, each function has its own domain (income bracket) that tells you when to use the function.

One family's income will put them in a $25\%$ tax bracket, but another family with a higher income will fall under a higher tax bracket, like $28\%\text{.}$

To create a piecewise function, start by finding formulas or rules for all the different functions in the set. Then identify the domain for each function.

When you finally write the piecewise function, write each formula with its corresponding domain to its right.

# Subsection2.3.3Exercises

Domain and Range

Evaluating Piecewise Functions

Formulas for Piecewise Functions