Skip to main content
\(\newcommand{\N}{\mathbb{N}} \newcommand{\Z}{\mathbb{Z}} \newcommand{\R}{\mathbb{R}} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

Section 4.3 Functions Defined on Sets


In this section, we consider how functions are defined on different sets. We learn about the domain of the function and how to find the domain given a formula. Sometimes, we need to restrict a function to use a rule only on a particular set, called the explicit domain. Other times, we need the function to use different rules on different sets, creating a piecewise function.

As part of finding domains, we learn about solving inequalities in order to determine where an expression is positive and negative. We approach these problems using sign analysis. This consists in finding points where the expression might change sign and then testing what sign occurs in each resulting interval.

With piecewise functions, a function might not be continuous. We learn about limit notation as a way of evaluating what a rule to the left or right of a point would have given at a point. Continuity requires that the function is defined and that the left- and right-limits both agree with the actual function value.

Subsection 4.3.1 Function Domains

Recall from Definition 4.1.27 that the domain of a function \(x \mapsto y\) is the set of values of the independent variable \(x\) for which the function has a state \((x,y)\text{.}\) Most sets that we encounter are made up of intervals, which describe sets of all real numbers between two extremes. For a brief review of concepts related to sets and interval, see Appendix A.1.2.

When a function is defined by a formula, the domain is usually not stated. The natural domain is then understood to be the set of inputs for which the function is defined. We find this set by identifying which operations might not be defined for all values and then solve either equations or inequalities that will identify where the function is defined. Our elementary operations and functions have the following constraints.

  • Division is undefined if the denominator equals zero.
  • Even roots (e.g., square roots) and irrational powers are undefined if the inner expression is negative.
  • Logarithms are undefined if the inner expression is non-positive (zero or negative).
Example 4.3.1

Determine the domain of \(\displaystyle f(x) = \frac{2x+3}{x^2-4}\text{.}\)


Because \(f(x)\) is defined as a quotient, the domain will be the set of all values except where \(x^2-4=0\text{.}\) We solve this equation by factoring, since a product can only equal zero if one of the factors equals zero.

\begin{gather*} x^2-4 = 0\\ (x+2)(x-2) = 0 \\ x+2 = 0 \quad \text{or} \quad x-2=0\\ x=-2 \quad \text{or} \quad x=2 \end{gather*}

This means \(f(x)\) is defined for all inputs except \(x=-2\) or \(x=2\text{.}\)

To describe the domain using intervals, we think of the real number line and remove \(x=\pm 2\text{.}\) A graphical representation of the set using a number line is shown below. Intervals are read from the line left-to-right. It starts at \(-\infty\) and continues until \(-2\text{,}\) then goes from \(-2\) to \(2\text{,}\) and finally goes from \(2\) until \(+\infty\text{.}\) We write

\begin{equation*} D = (-\infty,-2) \cup (-2, 2) \cup (2,+\infty)\text{.} \end{equation*}

Sometimes finding the domain of a function involves solving an inequality (such as for a square root or a logarithm). To solve the inequality, we identify points where the expression of interest might change sign. This can only occur where the expression equals zero or where the expression has a discontinuity (e.g., undefined), usually found by solving equations. We then check the sign of the expression in each of the resulting intervals.

Example 4.3.2

Find the domain of the function \(\displaystyle g(x)=\log_{4}(x^2-x-6)\text{.}\)


The logarithm in \(g(x)\) will only have a real value when the input expression is positive, \(x^2-x-6 \gt 0\text{.}\) Our task becomes determining the signs of the expression \(x^2-x-6\text{.}\) First, we find possible sign-changing points. The expression is always defined (no discontinuities) so we just solve for zeros \(x^2-x-6=0\text{.}\)

\begin{gather*} x^2-x-6=0 \\ (x-3)(x+2)=0\\ x-3=0 \quad \text{or} \quad x+2=0\\ x=3 \quad \text{or} \quad x=-2 \end{gather*}

If we mark these points on a number line, we can easily identify the intervals to test for signs. It is helpful to use the same number line to record the resulting signs, so we can label \(x\)-values below the line and the resulting sign or value of the expression above the line.

The number line shows we need to test the intervals \((-\infty,-2)\text{,}\) \((-2,3)\text{,}\) and \((3,\infty)\text{.}\) Choosing one value from each interval, we can evaluate the expression at that point and identify the sign.

\begin{align*} x=-3 \quad &\Rightarrow \quad x^2-x-6 = (-3)^2-(-3)-6 = 6\\ x=0 \quad &\Rightarrow \quad x^2-x-6 = 0^2-0-6 = -6\\ x=4 \quad & \Rightarrow \quad x^2-x-6 = 4^2-4-6 = 6 \end{align*}

We can now update the number line we started by recording either \(+\) or \(-\) above each interval that we tested.

We were finding the domain of \(g(x)=\log_4(x^2-x-6)\text{,}\) which requires \(x^2-x-6 \gt 0\text{.}\) Based on our summary, we need to find all values which result in the expression having a positive sign. So our solution is the set \(D\) formed from the union of intervals \((-\infty,-2)\) and \((3,\infty)\text{,}\)

\begin{equation*} D = (-\infty,-2) \cup (3,\infty)\text{.} \end{equation*}

A visualization of the domain on the number line might also help solidify the connections between the sign analysis number line and the domain set.

Example 4.3.3

Find the domain of the function \(\displaystyle h(x) = \sqrt{\frac{4x}{x^2-9}}\text{.}\)


A square root (any even root) requires that the input expression is non-negative. Our domain is to solve the inequality

\begin{equation*} D = \{ x : \frac{4x}{x^2-9} \ge 0 \}\text{.} \end{equation*}

To use sign analyis, we need to know the zeros and discontinuities and then test each resulting interval. Discontinuities occur when we try to divide by zero.

\begin{gather*} x^2-9 = 0\\ (x+3)(x-3) = 0\\ x+3=0 \quad \text{or} \quad x-3=0\\ x=-3 \quad \text{or} \quad x=3 \end{gather*}

Zeros for a quotient require that the numerator equals zero.

\begin{gather*} 4x=0\\ x=0 \end{gather*}

Our sign analysis number line will have three points.

Checking one point in each resulting interval gives us the sign. Because we only need to know the sign, it is simpler to think of factors of positive or negative values.

\begin{align*} x = -4 \quad &\Rightarrow \quad \frac{4x}{(x+3)(x-3)} = \frac{4(-4)}{(-4+3)(-4-3)} = \frac{(-)}{(-)(-)}\\ x = -1 \quad &\Rightarrow \quad \frac{4x}{(x+3)(x-3)} = \frac{4(-1)}{(-1+3)(-1-3)} = \frac{(-)}{(+)(-)}\\ x = 1 \quad &\Rightarrow \quad \frac{4x}{(x+3)(x-3)} = \frac{4(1)}{(1+3)(1-3)} = \frac{(+)}{(+)(-)}\\ x = 4 \quad &\Rightarrow \quad \frac{4x}{(x+3)(x-3)} = \frac{4(4)}{(4+3)(4-3)} = \frac{(+)}{(+)(+)} \end{align*}

The signs can be summarized on the number line.

We interpret our analysis to find the domain of \(h(x)\text{.}\) The domain must include intervals where the inner expression is positive, \((-3,0)\) and \((3,\infty)\text{,}\) along with points where the expression equals zero, \(x=0\text{.}\) The set is visualized below. We do not include the points where the expression was undefined, \(x=\pm3\text{.}\) The domain is the set

\begin{equation*} D = (-3,0] \cup (3,\infty)\text{.} \end{equation*}

Sometimes, we want a function restricted to a particular explicit domain. This will be especially important when we work with piecewise functions. Mapping notation for sets can be used to show an explicit domain \(D\) for a function \(f\text{.}\)

Definition 4.3.4

A real-valued function \(x \overset{f}{\mapsto} f(x)\) defined on an explicit domain \(D\) is written

\begin{equation*} f : D \to \mathbb{R}; x \mapsto f(x). \end{equation*}

(Notice the different arrows used for the domain.) The set \(\mathbb{R}\) is the standard co-domain, meaning all \(f(x)\)-values belong to \(\mathbb{R}\text{.}\)

Example 4.3.5

Interpret \(f:[0,1] \to \mathbb{R}; x \mapsto 2x+5\text{.}\)


Mapping notation gives us the domain and the rule. The mapping notation \([0,1] \to \mathbb{R}\) tells us the domain is the set \([0,1]\text{.}\) The second piece of the mapping notation \(x \mapsto 2x+5\) gives us the rule, \(f(x)=2x+5\text{.}\) Normally, \(f(x)=2x+5\) would be defined for any value of \(x \in (-\infty,\infty)\text{.}\) The mapping notation tells us we have restricted the relation to only include \(0 \le x \le 1\text{,}\) so that \(f(-0.1)\) and \(f(1.05)\) are both undefined.

Instead of using mapping notation, we will usually use a restriction on the domain. In this approach, we use an equation and include an inequality or similar test specifying which values of the independent variable may be used.

Example 4.3.6

The function \(f:[0,1] \to \mathbb{R}; x \mapsto 2x+5\) could also be written using a standard equation with a restriction. In this form, it would be written

\begin{equation*} f(x) = 2x+5, \quad 0 \le x \le 1. \end{equation*}

The graphical representations of \(f\) as a map or as a graph are shown in the figures below. For values of the independent variable outside of the restricted domain, the value of the dependent variable is undefined.

Figure 4.3.7 The restricted function \(f(x)=2x+5\) for \(0 \le x \le 1\) as a map.
Figure 4.3.8 The graph of the restricted function \(y=f(x)=2x+5\) for \(0 \le x \le 1\) in the \((x,y)\) plane.

Restricting a domain is necessary to define inverse functions when a function is not one-to-one. For example, we have earlier noted that \(y=x^2\) is not one-to-one because when solving for \(x\text{,}\) we get two solutions \(x=\pm\sqrt{y}\text{.}\) The next example explores this in more depth.

Example 4.3.9

We intuitively, but incorrectly, think of \(f(x)=x^2\) and \(g(x)=\sqrt{x}\) as inverse functions. The composition \(g \circ f(x) = \sqrt{x^2}\) is not the identity because \(\sqrt{x^2} = |x|\text{.}\) This is illustrated in the figure below. For \(x \lt 0\text{,}\) \(g \circ f(x) \ne x\text{;}\) but for \(x \ge 0\text{,}\) \(g \circ f(x)=x\text{.}\)

Figure 4.3.10 The chain \(x \mapsto u=x^2 \mapsto y=\sqrt{u}\) .

The function restricted to this domain, \(f:[0,\infty) \to \mathbb{R}; x \mapsto x^2\text{,}\) can be written using a standard equation with a constraint as

\begin{equation*} f(x) = x^2, \quad x \ge 0\text{.} \end{equation*}

The restricted function is the inverse of the square root.

Subsection 4.3.2 Piecewise Functions and Continuity

A function does not need to follow the same rule for all values in its domain. Piecewise functions are functions that define different rules for different subsets of the domain. The standard notation for piecewise function is to create a list of rules using an equation with constraints on the domain for each given rule.

Example 4.3.11

Describe the piecewise function

\begin{equation*} f(x) = \begin{cases} 3, & x \lt 0, \\ x^2, & 0 \lt x \le 2, \\ 4-x, & x \gt 2. \end{cases} \end{equation*}

Include a graph.


The function \(f:x \mapsto y\) is listed with three different rules. For inputs \(x \in (-\infty,0)\) (i.e., \(x \lt 0\)), we use the rule \(y=3\text{;}\) for inputs \(x \in (0,2]\text{,}\) we use the rule \(y=x^2\text{;}\) and for \(x \in (2,\infty)\text{,}\) we use the rule \(y=4-x\text{.}\) Notice that for \(x=0\text{,}\) there is no rule provided. The domain of \(f\) is the union of the component domains, so

\begin{equation*} D=(-\infty,0) \cup (0,\infty)\text{.} \end{equation*}

Notice how we would evaluate the function at different points. Looking at the input, we determine which rule applies and then use only that rule.

\begin{align*} f(-2) &= 3 \\ f(1) &= 1^2 = 1\\ f(2) &= 2^2 = 4\\ f(2.01) & = 4-2.01 = 1.99 \end{align*}

The graph of the relation \(y=f(x)\) is created by pasting the graphs \(y=3\text{,}\) \(y=x^2\text{,}\) and \(y=4-x\) into a single graph, but including only that portion of the graphs that is relevant for the constrained domains of those rules. For points at the edge of a domain interval, we use filled circles only when the point is explicitly included.

In the previous example, the graph of the function had breaks. Those breaks occurred at the edges of the constrained domains of the rule. We call such a break a discontinuity. When a function is connected, we say it is continuous. For a piecewise function to be continuous at a point, the rule used to the left and right of a point need to give the same value as the rule at the point.

We need a notation that says to use the different rules around a point. Function evaluation notation \(f(x)\) finds the value using the rule at the point. We use a new notation, called limit notation, to apply the rules coming from the left or from the right to predict the value at a point.

Definition 4.3.12 Intuitive Meaning of Limit Notation

For a piecewise function using otherwise continuous expressions around a point \(x=c\text{,}\)

\begin{equation*} f(x) = \begin{cases} f_{\text{left}}(x), & x \lt c, \\ f_{\text{at}}(x), & x=c, \\ f_{\text{right}}(x), & x \gt c, \end{cases} \end{equation*}

the left- and right-limits of \(f(x)\) at \(c\) are the values of the expressions \(f_{\text{left}}(c)\) and \(f_{\text{right}}(c)\) and are written using limit notation,

\begin{gather*} \lim_{x \to c^-} f(x) = f_{\text{left}}(c),\\ \lim_{x \to c^+} f(x) = f_{\text{right}}(c). \end{gather*}
Example 4.3.13

For the piecewise function

\begin{equation*} f(x) = \begin{cases} 3, & x \lt 0, \\ x^2, & 0 \lt x \le 2, \\ 4-x, & x \gt 2, \end{cases} \end{equation*}

evaluate the limits at \(x=0\) and at \(x=2\text{.}\)


Around \(x=0\text{,}\) the function \(f(x)\) uses \(f(x)=3\) to the left of \(x=0\) and \(f(x)=x^2\) immediately to the right of \(x=0\text{.}\) Using limit notation, we write

\begin{align*} \lim_{x \to 0^-} f(x) &= 3,\\ \lim_{x \to 0^+} f(x) &= 0^2 = 0. \end{align*}

Around \(x=2\text{,}\) the function \(f(x)\) uses \(f(x)=x^2\) to the left and \(f(x)=4-x\) to the right. For limits, we then have

\begin{align*} \lim_{x \to 2^-} f(x) &= 2^2=4,\\ \lim_{x \to 2^+} f(x) &= 4-2 = 2. \end{align*}

In the earlier example using this same function, we included a filled circle at the point \((2,4)\) for the value \(f(2)=2^2=4\text{.}\) When a limit is different from the value of the function (or the function value doesn't exist), we can include an empty circle to show the limit of either the left or the right branch. The limits at \(x=0\) leads to two empty points at \((0,3)\) (left-limit) and at \((0,0)\) (right-limit). The limits at \(x=2\) leads to one empty point at \((2,2)\text{,}\) since the left-limit matches the value of the function at \((2,4)\text{.}\) This improved graph is shown below.

At a point away from break points of piecewise functions, the same rule is applied on the left and on the right. Consequently, we can compute left- and right-limits for formulas that are not defined piecewise as well.

Example 4.3.14

Find \(\displaystyle \lim_{x \to 1^-} \left[x^2-2x\right]\) and \(\displaystyle \lim_{x \to 1^+} \left[x^2-2x\right]\text{.}\)


We can think of the expression \(x^2-2x\) as a function. The same rule is applied everywhere, so this is equivalent to a piecewise function

\begin{equation*} f(x)=\begin{cases} x^2-2x, & x \lt 1, \\ x^2-2x, & x = 1, \\ x^2-2x, & x \gt 1. \end{cases}. \end{equation*}

(You wouldn't normally write this down—just think it.) Consequently, we have

\begin{gather*} \lim_{x \to 1^-} \left[x^2-2x\right] = 1^2-2(1)=-1,\\ \lim_{x \to 1^+} \left[x^2-2x\right] = 1^2-2(1)=-1. \end{gather*}

Continuity captures the idea of connectedness. The rule for a function to either side of a point should perfectly match up with the rule for the point itself. We express this with limits.

Definition 4.3.15 Continuity at a Point

The statement “the function \(f\) is continuous at a point \(x=c\)” means that the left-limit and right-limit at \(x=c\) are equal to the value \(f(c)\text{,}\)

\begin{gather*} \lim_{x \to c^-} f(x) = f(c), \\ \lim_{x \to c^+} f(x) = f(c). \end{gather*}
Note 4.3.16

Our definition for continuity is, at the moment, a bit circular because our intuitive definition of limits (Definition 4.3.12) indicated that we needed “otherwise continuous expressions”. We will need a definition for limits that captures the same idea but does not require continuous expressions. We will then show that every simple algebraic expression is continuous using that new definition.

Example 4.3.17

For the function

\begin{equation*} f(x) = \begin{cases} 2x+a, & x \lt 2, \\ 1, & x=2, \\ -3x+b, & x \ge 2, \end{cases} \end{equation*}

what values of \(a\) and \(b\) are needed to make \(f\) continuous at \(x=2\text{?}\)


The parameters \(a\) and \(b\) for these formulas set the \(y\)-intercepts of the lines, allowing us to slide the lines up or down. We are looking for values that make these lines intersect at the point \((2,1)\text{.}\) We use limit notation to create the equations we need to solve.

To make the rule \(f(x)=2x+a\) (to the left of \(x=2\)) reach the correct point, we use the left-limit.

\begin{align*} \lim_{x \to 2^-} f(x) &= \lim_{x \to 2^-} \left[2x+a\right] \\ &= 2(2)+a = 4+a \end{align*}

So that the left branch intersects at the correct point, we need \(4+a=1\) with \(a=-3\text{.}\)

To make the rule \(f(x)=-3x+b\) (to the right of \(x=2\)) reach the correct point, we use the right-limit.

\begin{align*} \lim_{x \to 2^+} f(x) &= \lim_{x \to 2^+} \left[-3x+b\right] \\ &= -3(2)+b = -6+b \end{align*}

We need \(-6+b=1\) so that \(b=7\text{.}\)

The function

\begin{equation*} f(x) = \begin{cases} 2x-3, & x \lt 2, \\ 1, & x=2, \\ -3x+7, & x \gt 2, \end{cases} \end{equation*}

is continuous at \(x=2\text{.}\) A graph of this function is shown below.

Subsection 4.3.3 Summary

  • Sets are often defined as the union of intervals. An open interval \((a,b)\) describes a set that is a solution to \(a \lt x \lt b\text{.}\) A closed intervals \([a,b]\) includes the endpoints, \(a \le x \le b\text{.}\)
  • The natural domain of a function is found by determining the set of inputs for which the function output is defined.

    • A quotient \(\frac{u}{w}\) is defined for non-zero denominator \(w \ne 0\text{.}\)
    • An even root (e.g., square root) \(\sqrt{u}\) is defined for a non-negative input \(u \ge 0\text{.}\)
    • A logarithm \(\log_b{u}\) is defined for a positive input \(u \gt 0\text{.}\)
  • Inequalities related to zero can be solved by sign analysis: (1) create intervals separated by zeros and discontinuities, (2) test intervals for sign, and (3) interpret the results.
  • An explicit domain for a function can be specified using mapping notation,
    \begin{equation*} f:D \rightarrow \mathbb{R}; x \mapsto f(x), \end{equation*}
    or using a constraint.
  • A piecewise function uses different rules for different sets of the domain. The boundaries of these sets are the break-points of the function.
  • Continuity of functions is introduced as a concept to guarantee that piecewise functions are connected. At each break-point, we need to verify using limits that the formula to the left and the formula to the right both match the value at the break-point.
  • Limit notation indicates that we use a function rule to the left or right of a point and find the value if that rule were extended continuously to the point of interest.
    \begin{gather*} \lim_{x \to c^-} f(x) = \text{value from rule on left} \\ \lim_{x \to c^+} f(x) = \text{value from rule on right} \end{gather*}

Subsection Exercises


Write the function

\begin{equation*} f:[0,3) \to \mathbb{R}; x \mapsto 2x-3 \end{equation*}

as an equation with a restriction.


Write the function

\begin{equation*} f(x) = 4x+1, \quad -2 \lt x \le 1 \end{equation*}

using mapping notation.

For each of the functions, find the natural domain.


\(\displaystyle f(x) = \frac{3x}{x^2+1}\)


\(\displaystyle f(x) = \frac{3x}{x^2-1}\)


\(\displaystyle f(x) = \frac{x+2}{x^2-4x-21}\)


\(\displaystyle f(x) = \log_3(x+5)\)


\(\displaystyle f(x) = \log_{10}\left(\frac{x+2}{x-1}\right)\)


\(\displaystyle f(x) = \sqrt{x^2-2x-15}\)


\(\displaystyle f(x) = \sqrt[3]{\frac{x^2-2x-3}{x^2+2x}}\)


\(\displaystyle f(x) = \sqrt[4]{\frac{x^3-8x}{x^2-1}}\)

For each function, find the indicated values.


\(\displaystyle f(x) = \begin{cases} x^2-3x, & x \lt 1, \\ 2, & x = 1, \\ 3x-2, & x \gt 1. \end{cases}\)

  1. \(f(\frac{1}{2})\)
  2. \(f(1)\)
  3. \(f(2)\)
  4. \(\displaystyle \lim_{x \to 1^-} f(x)\)
  5. \(\displaystyle \lim_{x \to 1^+} f(x)\)
  6. \(\displaystyle \lim_{x \to 2^-} f(x)\)
  7. \(\displaystyle \lim_{x \to 2^+} f(x)\)

Is \(f\) continuous at \(x=1\text{?}\) Is \(f\) continuous at \(x=2\text{?}\)


\(\displaystyle g(x) = \begin{cases} -3x+1, & x \lt 0, \\ 2^x, & 0 \lt x \lt 3, \\ 2x+3, & x \ge 3. \end{cases}\)

  1. \(g(-2)\)
  2. \(g(0)\)
  3. \(g(3)\)
  4. \(\displaystyle \lim_{x \to 0^-} g(x)\)
  5. \(\displaystyle \lim_{x \to 0^+} g(x)\)
  6. \(\displaystyle \lim_{x \to 3^-} g(x)\)
  7. \(\displaystyle \lim_{x \to 3^+} g(x)\)

Is \(g\) continuous at \(x=0\text{?}\) Is \(g\) continuous at \(x=3\text{?}\)


Find the value of \(a\) so that

\begin{equation*} f(x) = \begin{cases} 2x+5, & x \le 3, \\ ax-4, & x \gt 3, \end{cases} \end{equation*}

is continuous at \(x=3\text{.}\)


Find the values of \(a\) and \(b\) so that

\begin{equation*} f(x) = \begin{cases} 5-2x, & x \le -1, \\ ax+b, & -1 \lt x \lt 2, \\ 2x-5, & x \ge 2, \end{cases} \end{equation*}

is continuous at \(x=-1\) and at \(x=2\text{.}\)