Skip to main content

Section 6.1 Functions and Their Representations

In this section, we introduce the formal definition of a function, look at examples of functions defined by formulas, and discuss how to visually represent functions. The definition of a function requires sets, so we begin with the names of some common infinite sets of numbers.

Subsection 6.1.A Infinite sets of numbers

The definition of a function involves sets. Functions in discrete contexts often involve sets of integers, natural numbers, or rational numbers as defined in DefinitionΒ 2.1.7 and DefinitionΒ 4.1.12. It is convenient to have names for such sets.

Definition 6.1.1 Sets of integers.

Β 
  1. The set of all integers
     1 
    Why is \(Z\) is used for the set of integers? Part of the reason is because \(I\) already stands for many other things in mathematics and physics. But why \(Z\text{?}\) In the past, a lot of European mathematics was written in German and the German word for numbers is Zahlen which starts with the letter \(Z\text{.}\) The name \(Z\) for the set of all integers was introduced by the German mathematician David Hilbert who is rightfully famous for many other reasons. Source: Integer. (2024, May 20). (See Wikipedia.)
    is
    \begin{equation*} \mathbb{Z} = \{ \ldots, -3,-2,-1,0,1,2,3,\ldots\}\text{.} \end{equation*}
  2. The set of all positive integers is
    \begin{equation*} \mathbb{Z}^+=\{1,2,3,\ldots\}\text{.} \end{equation*}
  3. The set of all natural numbers (or set of all non-negative integers) is
    \begin{equation*} \mathbb{N} = \{0, 1,2,3,\ldots\}\text{.} \end{equation*}
Let’s look at an example involving these sets.

Example 6.1.2 Sets of integers.

Β 
  1. Which of the sets \(\mathbb{Z}\text{,}\) \(\mathbb{Z}^+\text{,}\) and \(\mathbb{N}\) have the integer 0 as an element?
    Solution.
    The integer 0 is an element of \(\mathbb{Z}\) and \(\mathbb{N}\text{,}\) but it is not an element of \(\mathbb{Z}^+\text{.}\)
  2. Which of the sets \(\mathbb{Z}\text{,}\) \(\mathbb{Z}^+\text{,}\) and \(\mathbb{N}\) are subsets of the others?
    Solution.
    Every positive integer is a natural number so \(\mathbb{Z}^+\) is a subset of \(\mathbb{N}\text{.}\) Every positive integer and every natural number is an integer so \(\mathbb{Z^+}\) and \(\mathbb{N}\) are subsets of \(\mathbb{Z}\text{.}\) And, of course, each set is a subset of itself too.
Functions in more continuous contexts, like algebra or calculus, often involve real numbers. A formal definition of real numbers requires mathematics beyond this textbook, but we start with a casual form of the definition.

Definition 6.1.3 Real numbers.

Β 
  1. A real number is any number that can be represented in decimal notation. For example, each of the following numbers is a real number: 523.7, \(34 = 34.0\text{,}\) \(\frac{3}{8} = .375\text{,}\) \(-\sqrt{2} = -1.414213\ldots\text{,}\) and \(\pi = 3.141592\ldots\text{.}\) The … indicates that the decimal representation continues.
  2. When the decimal notation for a real number repeats forever, we use bar notation. For example,
    \begin{equation*} \frac{7}{11} = 0.636363\ldots = 0.\overline{63}\text{.} \end{equation*}
It is useful to have a notation for commonly used sets of real numbers.

Definition 6.1.4 Sets of real numbers.

Β 
  1. The set of all rational numbers
     2 
    The letter \(Q\) comes from the word β€œquotient”.
    is denoted \(\mathbb{Q}\text{.}\) For example, \(\frac{3}{8}\text{,}\) \(^-\frac{7}{11} = \frac{-7}{11}\text{,}\) and \(34 = \frac{34}{1}\) are elements of \(\mathbb{Q}\text{.}\)
  2. The set of all real numbers is denoted \(\mathbb{R}\text{.}\) For example, each of the following real numbers is an element of \(\mathbb{R}\text{:}\) 523.7, \(34\text{,}\) \(\frac{3}{8}\text{,}\) \(^-\frac{7}{11}\text{,}\) \(-\sqrt{2}\text{,}\) and \(\pi\text{.}\)
  3. If \(S\) is a subset of real numbers, then the set \(S^+\) is the set of all positive numbers in \(S\) and the set \(S^*\) is the set of all nonzero numbers in \(S\text{.}\) For example,
    \begin{equation*} \mathbb{R}^+ = \text{ set of all positive real numbers } \end{equation*}
    and
    \begin{equation*} \mathbb{R}^* = \text{ set of all nonzero real numbers }\text{.} \end{equation*}
Let’s look at an example.

Example 6.1.5 Sets of real numbers.

Β 
  1. Which of the sets \(\mathbb{Q}\text{,}\) \(\mathbb{R}\text{,}\) \(\mathbb{R}^+\text{,}\) and \(\mathbb{R}^*\) have the integer 0 as an element?
    Solution.
    The integer 0 can be written as a fraction, for example \(0 = \frac{0}{1}\text{.}\) Thus 0 is an element of \(\mathbb{Q}\text{.}\)
    The integer 0 can be written as 0.0 (or just 0). Thus 0 is an element of \(\mathbb{R}\text{.}\)
    Since the integer 0 is not positive, 0 is not an element of \(\mathbb{R}^+\text{.}\)
    Since the integer 0 is not nonzero, 0 is not an element of \(\mathbb{R}^*\text{.}\)
  2. Which of the sets \(\mathbb{Z}\text{,}\) \(\mathbb{Q}\text{,}\) and \(\mathbb{R}\) are subsets of the others?
    Solution.
    Any integer \(n\) can be written as a fraction, for example \(n = \frac{n}{1}\text{.}\) Thus \(n\) is an element of \(\mathbb{Q}\) and so \(\mathbb{Z}\) is a subset of \(\mathbb{Q}\text{.}\)
    Any integer \(n\) can also be written as a real number, for example \(n = n.0\) (or just \(n\)). Thus \(n\) is an element of \(\mathbb{R}\) and so \(\mathbb{Z}\) is a subset of \(\mathbb{R}\text{.}\)
    Any rational number \(\frac{a}{b}\text{,}\) where \(a\) is an integer and \(b\) is a nonzero integer, can be written as a decimal by dividing \(a \div b\text{.}\) We might get a terminating decimal, like \(\frac{3}{8}=0.375\text{,}\) or we might get a repeating decimal, like \(\frac{7}{11} = 0.636363\ldots = 0.\overline{63}\text{.}\) (It turns out we cannot get a non-repeating decimal.) Thus \(\frac{a}{b}\) is an element of \(\mathbb{R}\) and so \(\mathbb{Q}\) is a subset of \(\mathbb{R}\text{.}\)
There is a special notation for subsets of real numbers that are defined by inequalities.

Definition 6.1.6 Intervals.

Β 
  1. An interval is a set of all real numbers \(x\) between two real numbers known as bounds. For example, the set of all real numbers \(x\) such that \(11 \le x \lt 12\) is an interval bounded below by 11 and bounded above by 12. The integer 11 is an element of the interval, but the integer 12 is not an element of the interval.
  2. An unbounded interval (or ray) is a set of all real numbers greater than a real number or a set of all real numbers less than a real number. For example, the set of all real numbers \(x\) such that \(x\ge 4.32\) is an unbounded interval. The real number 4.32 is an element of that interval. The set of negative real numbers \(x\) is the unbounded interval defined by \(x\lt 0\text{.}\) The real number 0 is not an element of that interval.
  3. We can abbreviate an interval using interval notation where a square bracket indicates that the bound is included, whereas a round bracket indicates that the bound is excluded. When the interval is unbounded, we use \(\infty\) to indicate that the interval has no upper bound and \(-\infty\) to indicate that the interval has no lower bound. For example, the interval described by the inequality \(11 \le x \lt 12\) is denoted \([11,12)\) and the positive real numbers is denoted \((0,\infty)\text{.}\) Occasionally we write the full set of real numbers \(\mathbb{R}\) as the interval \((-\infty,\infty)\text{.}\) ENDTableΒ 6.1.7 shows examples of each type of interval notation.
    Table 6.1.7. Interval notation
    Interval \(a \le x \le b\) \(a \le x \lt b\) \(a \lt x \le b\) \(a \lt x \lt b\)
    Notation \([a,b]\) \([a,b)\) \((a,b]\) \((a,b)\)
    Unbounded Interval \(x \ge a\) \(x > a\) \(x \le b\) \(x \lt b\) \(x\)
    Notation \([a,\infty)\) \((a,\infty)\) \((-\infty,b]\) \((-\infty,b)\) \((-\infty,\infty)\)
Let’s work with interval notation.

Example 6.1.8 Interval notation.

Β 
  1. Write the interval \((12,14]\) using inequality notation.
    Solution.
    For an element \(x\) in the interval, the round bracket at 12 tells us that \(x > 12\) whereas the square bracket at 14 tells us that \(x \le 14\text{.}\) Together we have \(12 \lt x \le 14\text{.}\)
  2. Which of the real numbers 13.7, 12, and 14 are elements of the interval \((12,14]\text{?}\)
    Solution.
    Since \(12 \lt 13.7 \le 14\text{,}\) the real number 13.7 is in the interval. The round bracket tells us that 12 is not in the interval. The square bracket tells us that 14 is in the interval.
  3. Write the interval \(x \le 2\) in interval notation.
    Solution.
    Since the inequality is bounded above by 2, and 2 is in the interval, we use a square bracket at 2. Since there is no lower bound on the interval, we use \(-\infty\) (always with a round bracket). In interval notation we have \((- \infty,2]\text{.}\)
It is your turn to work with these sets.

Activity 6.1.A Sets of integers and real numbers.

Β 
  1. Give an example of an element of \(\mathbb{Z}\) that is not an element of \(\mathbb{N}\text{.}\)
  2. Give an example of an element of \(\mathbb{Q}\) that is not an element of \(\mathbb{Z}\text{.}\)
  3. Give an example of an element of \(\mathbb{R}\) that is not an element of \(\mathbb{R}^+\text{.}\)
  4. Describe the set of real numbers that are in the interval \(x \ge 5\) and the interval \(x \lt 10\text{.}\) Report your answer in inequality notation and in interval notation.
  5. Which integers are in the interval \([5,10)\text{?}\)
  6. Negate the following statement: \(x\) is an element of the interval \([5,10)\text{.}\) Hint: DeMorgan’s law and (d).

Subsection 6.1.B Function Notation and Vocabulary

Before we give a rigorous definition of a function, let us look at an example.

Example 6.1.10 Garden.

Each tomatillo plant in my garden produces about 100 tomatillos.
  1. One year I planted 3 plants. Approximately how many tomatillos grew?
    Solution.
    I grew around \(3 \times 100 = 300\) tomatillos, which made a lot of salsa verde!
  2. If I planted \(n\) plants, approximately how many tomatillos would grow?
    Solution.
    I would grow around \(100n\) tomatillos. In general, we say that the number of tomatillos is a function of the number of plants.
We are ready to define a function and related vocabulary.

Definition 6.1.11 Function.

A function, \(f\text{,}\) consists of three parts: a domain set, a codomain set, and a rule. Specifically,
  1. The domain of the function \(f\) is the set of acceptable input values. For example, in ExampleΒ 6.1.10, we could have any non-negative integer number of plants, so the domain was \(\mathbb{N}\text{.}\)
  2. The codomain of the function \(f\) is the set of acceptable output values. For example, in ExampleΒ 6.1.10, we could have any non-negative integer number of tomatillos, so the codomain was also \(\mathbb{N}\text{.}\)
  3. To define a function, we need to say what the domain and codomain sets are. When \(f\) is a function with domain set \(X\) and codomain set \(Y\text{,}\) we use arrow notation to write
    \begin{equation*} f:X \to Y \end{equation*}
    which is pronounced β€œ\(f\) maps from \(X\) to \(Y\)”. For example, in ExampleΒ 6.1.10 we would write \(f: \mathbb{N} \to \mathbb{N}\text{.}\) If you want to know the domain of a function, look for the set before the arrow. Similarly, if you want to know the codomain of a function, look for the set after the arrow.
  4. The third part of a function is rule that, for each element \(x\) in the domain of \(f\text{,}\) uniquely determines a corresponding element \(y\) in the codomain of \(f\text{.}\) For example, in ExampleΒ 6.1.10 for the input value of \(n\) plants, the rule for the output value is \(100n\) tomatillos.
  5. We use function notation \(f(x)\text{,}\) pronounced β€œ\(f\) of \(x\text{,}\)” to denote the output \(y\) corresponding to the input \(x\text{.}\) We often write \(y=f(x)\text{.}\) For example, in ExampleΒ 6.1.10, our rule was \(f(n)=100n\text{.}\)
  6. Given an input value \(x\) in the domain, we evaluate the function \(f\) at \(x\) to get the corresponding output value \(f(x)\) in the codomain. For example, in ExampleΒ 6.1.10, when we evaluate \(f\) at 3 plants we get \(f(3) = 300\) tomatillos.
  7. There is one more set associated with a function. The image of the function \(f\) is the set of actual output values– the set of all elements \(y\) in the codomain such that there exists an element \(x\) in the codomain with \(f(x) = y\text{.}\) The image is a subset of the codomain. For example, in ExampleΒ 6.1.10, we can only get multiples of 100, so the image of \(f\) is the set of nonnegative multiples of 100: \(\{0, 100, 200, 300, \ldots\}\text{.}\)
Many algebra and calculus textbooks do not make a distinction between the function \(f\) and its output value \(f(x)\text{,}\) but being careful to make this distinction is very helpful for advanced mathematics and computer science.
Let’s look at an example using this vocabulary.

Example 6.1.12 Function vocabulary with finite sets.

Consider the function \(a: \{1,2,3,4\} \to \{0,1,2,3\}\) defined by \(a(n) = n-1\text{.}\) That is, \(a(1) = 0\text{,}\) \(a(2)=1\text{,}\) \(a(3) = 2\text{,}\) and \(a(4) = 3\text{.}\)
  1. What are the domain and codomain of the function \(a\text{?}\)
    Solution.
    The domain of \(a\) is \(\{1,2,3,4\}\) and the codomain is \(\{0,1,2,3\}\text{.}\)
  2. Find all values of \(n\) such that \(a(n) = 2\text{.}\) Is it unique?
    Solution.
    Note that \(a(3)=2\text{.}\) Yes, it is unique because no other value of \(n\) has \(a(n) = 2\text{.}\)
  3. Does there exist a value of \(n\) such that \(a(n)=4\text{?}\) Explain.
    Solution.
    No, no value of \(n\) has \(a(n) = 4\text{.}\)
  4. Describe the image of \(a\text{.}\)
    Solution.
    The image of \(a\) is the set \(\{0,1,2,3\}\) which happens to be the codomain.
Here is an example with infinite sets.

Example 6.1.13 Function vocabulary with infinite sets.

Consider the function \(f: \mathbb{Z} \to \mathbb{N}\) defined by \(f(n) = n^2\text{.}\)
  1. What are the domain and codomain of the function \(f\text{?}\)
    Solution.
    The domain of \(f\) is \(\mathbb{Z}\) and the codomain is \(\mathbb{N}\text{.}\)
  2. Evaluate \(f(5)\) and \(f(-6)\text{.}\)
    Solution.
    First, \(f(5) = 5^2=25\text{.}\)
    Next, \(f(-6) = (-6)^2=(-6)(-6)=36\text{.}\)
  3. Find all values of \(n\) such that \(f(n) = 4\text{.}\)
    Solution.
    Note that \(f(2) = 2^2=4\) and \(f(-2) = (-2)^2=4\text{.}\) The values are \(2\) and \(-2\text{.}\)
  4. Does there exist a value of \(n\) such that \(f(n)=3\text{?}\) Explain.
    Solution.
    No, if \(f(n)=3\text{,}\) then we would have \(n = \sqrt{3}\) which is not an integer because 3 is not a perfect square.
  5. Describe the image of \(f\text{.}\)
    Solution.
    The image of \(f\) is the set of perfect squares
    \begin{equation*} \{0,1,4,9,16,25,36, \ldots\} \end{equation*}
Although in mathematics functions usually have a single letter name, such as \(f\) or \(g\text{,}\) it is common practice in computer science and in work with databases to name a function with a string, often a word or abbreviation chosen to remind us of the rule of the function. Let’s look at an example.

Example 6.1.14 Functions with multi-letter names.

Consider the function \(\fn{half}: \mathbb{Z} \to \mathbb{Q}\) defined by \(\fn{half}(n) = \frac{n}{2}\text{.}\)
  1. What are the domain and codomain of the function \(\str{half}\text{?}\)
    Solution.
    The domain of \(\str{half}\) is \(\mathbb{Z}\) and the codomain is \(\mathbb{Q}\text{.}\)
  2. Evaluate \(\fn{half}(-6)\) and \(\fn{half}(5)\text{.}\)
    Solution.
    First, \(\fn{half}(-6) = \frac{-6}{2} = -3\text{.}\)
    Next, \(\fn{half}(5) = \frac{5}{2}\text{.}\)
  3. Find a value of \(n\) such that \(\fn{half}(n) = 10\text{.}\)
    Solution.
    Note that \(\fn{half}(20) = \frac{20}{2} = 10\text{.}\)
  4. Does there exist a value of \(n\) such that \(\fn{half}(n)=\frac{3}{5}\text{?}\) Explain.
    Solution.
    No, if \(\fn{half}(n) = \frac{3}{5}\text{,}\) then we would have \(\frac{n}{2} = \frac{3}{5}\text{.}\) Using the definition of equal fractions TheoremΒ 4.1.14, we would have \(5n = 6\) and so \(n = \frac{6}{5}\) which is not an integer. Since the domain is the integers, we cannot find an integer \(n\) with \(\fn{half}(n)= \frac{3}{5}\text{.}\)
  5. Describe the image of \(\str{half}\text{.}\)
    Solution.
    Any integer is in the image of \(\str{half}\) because \(\fn{half}(2a) = a\text{.}\) Any fraction of the form \(\frac{a}{2}\) where \(a\) is an integer is also in the image of \(\str{half}\) because \(\fn{half}(a) = \frac{a}{2}\text{.}\) Thus, the image of \(\str{half}\) is the set
    \begin{equation*} \left\{ \ldots, -3, ^-\frac{5}{2},-2,^-\frac{3}{2}, -1, ^-\frac{1}{2}, 0, \frac{1}{2}, 1, \frac{3}{2}, 2, \frac{5}{2}, 3, \ldots\right\} \end{equation*}
It is time to practice working with this vocabulary.

Activity 6.1.B Function vocabulary.

Β 
  1. Consider the function \(f: \mathbb{N} \to \mathbb{N}\) defined by \(f(n) = 2^n\text{.}\) Identify the domain and codomain of \(f\text{.}\)
  2. Evaluate \(f(8)\text{.}\)
  3. Find a natural number \(n\) such that \(f(n) = 8\text{.}\) Is it unique? Explain.
  4. Describe the image of \(f\text{.}\)
  5. Consider the function \(\fn{alt}: \mathbb{N} \to \mathbb{Z}\) defined by \(\fn{alt}(n) = (-1)^n\text{.}\) Identify the domain and codomain of \(\fn{alt}\text{.}\)
  6. Evaluate \(\fn{alt}(100)\text{.}\)
  7. Find a natural number \(n\) such that \(\fn{alt}(n) = -1\text{.}\) Is it unique? Explain.
  8. Explain why there does not exist an integer \(n\) such that \(\fn{alt}(n) = 2\text{.}\)
  9. Describe the image of \(\fn{alt}\text{.}\)
The domain and codomain are an important part of a function. Let’s look at an example of related functions sharing a common rule but having different domain and codomain sets.

Example 6.1.16 Different functions with the same rules.

Consider the following functions: \(f: \mathbb{Z} \to \mathbb{Z}\) is defined by \(f(n) = n+2\text{,}\) \(g: \mathbb{N} \to \mathbb{Z}\) is defined by \(g(n) = n+2\text{,}\) and \(h: \mathbb{N} \to \mathbb{N}\) is defined by \(h(n) = n+2\text{.}\)
  1. How are the functions \(f\text{,}\) \(g\text{,}\) and \(h\) different?
    Solution.
    One difference is their domain and codomain. The function \(f\) has domain \(\mathbb{Z}\) but the functions \(g\) and \(h\) have domain \(\mathbb{N}\text{.}\) The functions \(f\) and \(g\) have codomain \(\mathbb{Z}\) but the function \(h\) has codomain \(\mathbb{N}\text{.}\)
  2. Evaluate each function at \(n=3\text{.}\)
    Solution.
    We have \(f(3) = 3+2 = 5\text{,}\) \(g(3) = 3+2 = 5\text{,}\) and \(h(3) = 3+2 = 5\text{.}\)
  3. Evaluate each function at \(n=-6\) or explain why that is not possible.
    Solution.
    We have \(f(-6) = -6 + 2 = -4\) but \(g(-6)\) and \(h(-6)\) are not defined because -6 is not an element of their domain \(\mathbb{N}\text{.}\)
  4. Explain why we cannot define a function \(k: \mathbb{Z} \to \mathbb{N}\) by \(k(n) = n-2\text{.}\)
    Solution.
    Since 1 is in the domain \(\mathbb{Z}\text{,}\) if \(k\) were a function, then \(k(1) = 1-2=-1\) would need to be in the codomain. Since the codomain is \(\mathbb{N}\) and -1 is not an element of \(\mathbb{N}\text{,}\) we cannot define this function.
  5. Compare the images of \(f\text{,}\) \(g\text{,}\) and \(h\text{.}\)
    Solution.
    The image of \(f\) is \(\mathbb{Z}\) because given any integer \(m\text{,}\) we can find an integer \(n\) such that \(f(n) = m\text{,}\) namely \(n=m-2\text{.}\) We can check that \(f(m-2) = (m-2)+2 = m\text{.}\) On the other hand, the image of \(g\) and \(h\) are the set \(\{2, 3, 4, 5, \ldots\}\) because the smallest element of the domain \(\mathbb{N}\) is 0.
We introduce a little more vocabulary about functions.

Definition 6.1.17 Constant functions, the identity function, and fixed points.

Β 
  1. For sets \(X\) and \(Y\) and a specified element \(c\) of \(Y\text{,}\) a function \(f: X \to Y\) defined by \(f(x)=c\) is a constant function. For example, the function \(f: \mathbb{Z} \to \mathbb{Z}\) defined by \(f(n) = 3\) is a constant function. No matter what the input value \(n\) is, the output is always 3. For example, \(f(15) = 3\text{,}\) \(f(-2) = 3\text{,}\) and \(f(3)=3\text{.}\)
  2. For a set \(X\text{,}\) the identity function is the function \(i: X \to X\) defined by \(i\) is \(i(x) = x\text{.}\) For example, the function \(i: \{1,2,3,4\}\to \{1,2,3,4\}\) defined by \(i(x) = x\) is the identity function on \(\{1,2,3,4\}\text{.}\) We can evaluate to get \(i(1)=1\text{,}\) \(i(2)=2\text{,}\) \(i(3)=3\text{,}\) and \(i(4)=4\text{.}\)
  3. For a function \(f:X\to Y\text{,}\) an element \(a\) of the domain \(X\) is a fixed point of the function \(f\) if \(f(a) = a\text{.}\) Note that \(a\) must also be an element of the codomain \(Y\text{.}\) For example, the function \(\fn{sq}: \mathbb{Z} \to \mathbb{N}\) defined by \(\fn{sq}(n) = n^2\) has two fixed points: 0 and 1 because \(\fn{sq}(0)=0^2=0\) and \(\fn{sq}(1)=1^2=1\text{.}\) On the other hand, there are no fixed points of the function \(f: \mathbb{Z} \to \mathbb{Z}\) defined by \(f(n) = n+2\text{.}\) As another example, every element of the domain is a fixed point of the identity function.

Subsection 6.1.C Piecewise-defined Functions

The rule for a function can be defined in pieces.

Definition 6.1.18 Piecewise-defined function.

Β 
  1. A piecewise-defined function is a function in which the domain set is divided into cases and the rule for the function
     3 
    If you are uncomfortable that there is not a single formula for \(f\text{,}\) then you are in good company. This modern formal definition of function was not widely accepted until the early 1900s. Source: wikipedia (History of the Function Concept)
    depends on the case. For example, we might define a function with domain \(\mathbb{Z}\) where the rule uses one formula when we input an even integer and a different formula when we input an odd integer.
  2. We can write a piecewise-defined function using the notation
    \begin{equation*} f(x) = \left\{ \begin{array}{cl} \text{ formula 1 } \amp \text{ if } x \text{ is in case 1 } \\ \text{ formula 2 } \amp \text{ if } x \text{ is in case 2 } \\ \vdots \amp \vdots \\ \text{ formula } n \amp \text{ if } x \text{ is in case } n \end{array} \right.\text{.} \end{equation*}
Our next example illustrates a piecewise-defined function.

Example 6.1.19 Piecewise-defined function.

Consider the function \(p: \mathbb{Z} \to \mathbb{Z}\) defined by \(p(n)=n+1\) in the case where \(n\) is even and \(p(n) = 2n\) in the case where \(n\) is odd. In computer science lingo we might say β€œif \(n\) is even, then \(p(n)=n+1\text{,}\) else (meaning if \(n\) is odd) \(p(n)= 2n\text{.}\)” We can write this rule as
\begin{equation*} p(n) = \left\{ \begin{array}{cc} n+1 \amp \text{ if \(n\) is even } \\ 2n \amp \text{ if \(n\) is odd } \end{array} \right. \end{equation*}
  1. Evaluate \(p(6)\text{.}\)
    Solution.
    We know that 6 is even and so we are in the first case where \(p(n) = n+1\text{.}\) Therefore \(p(6)=6+1=7\text{.}\)
  2. Evaluate \(p(7)\text{.}\)
    Solution.
    We know that 7 is odd and so we are in the second case where \(p(n) = 2n\) and so \(p(7) = 2(7) = 14\text{.}\)
  3. Does there exist an integer \(n\) such that \(p(n) = 8\text{?}\) Explain
    Solution.
    Note that if \(n\) is even, then \(p(n) = n+1\) is odd and, therefore, cannot equal eight. On the other hand, if \(n\) is odd, then \(p(n) = 2n =8\) would imply that \(n=4\) which is even. No, there does not exist an integer \(n\) such that \(p(n)=8\text{.}\)
  4. Describe the image of \(p\text{.}\)
    Solution.
    Any odd integer \(2k+1\) is in the image because \(2k\) is even and so \(p(2k) = 2k+1\text{.}\) Any even integer of the form \(2m\) where \(m\) is odd is also in the image because \(m\) is odd and so \(p(m) = 2m\text{.}\) The integers that are not in the image are the even integers of the form \(2m\) where \(m\) is even which are the multiples of 4. The image of \(p\) is the set of integers that are not multiples of 4. That is, the image of \(p\) is
    \begin{equation*} \{ \ldots,-9, -7, -6, -5, -3, -2, -1, 1, 2, 3, 5, 6, 7, 9 \ldots\} \end{equation*}
We can define any function on a finite domain by specifying its value at each point in the domain. Technically, we are using a piecewise-defined function where the cases each have one value. Here is an example.

Example 6.1.20 Function on a finite set defined by a list.

Consider the function \(f: \{1, 2, 3, 4, 5\} \to \{a,b,c,d\}\) defined by
\begin{equation*} f(1) = a, f(2) = d, f(3) = a, f(4) = d, f(5)= c \end{equation*}
  1. The function \(f\) is piecewise-defined. Write \(f\) in the usual piecewise notation.
    Solution.
    We can write
    \begin{equation*} f(n) = \left\{ \begin{array}{cl} a \amp \text{ if } n =1 \\ d \amp \text{ if } n =2 \\ a \amp \text{ if } n =3 \\ d \amp \text{ if } n =4 \\ c \amp \text{ if } n =5 \end{array} \right.\text{.} \end{equation*}
    Alternatively, we could write
    \begin{equation*} f(n) = \left\{ \begin{array}{cl} a \amp \text{ if } n =1 \text{ or } n=3\\ d \amp \text{ if } n =2 \text{ or } n=4\\ c \amp \text{ if } n =5 \end{array} \right. \end{equation*}
  2. What is the domain and codomain of \(f\text{?}\)
    Solution.
    The domain of \(f\) is the set \(\{1, 2, 3, 4, 5\}\) and the codomain of \(f\) is the set \(\{a,b,c,d\}\text{.}\)
  3. Find an integer \(n\) in \(\{1,2,3,4,5\}\) such that \(f(n) = a\text{.}\) How many input values of \(n\) have \(f(n) = a\text{?}\)
    Solution.
    Note that \(f(1) = a\) and so \(n=1\) is one such value. Another such value is \(n=3\) because \(f(3)=a\) as well. There are two values of \(n\) for which \(f(n) = a\text{.}\)
  4. What is the image of \(f\text{?}\)
    Solution.
    The actual outputs are \(a\text{,}\) \(c\text{,}\) and \(d\) and so the image is the set \(\{a,c,d\}\text{.}\)
  5. Does there exist an integer \(n\) in \(\{1,2,3,4,5\}\) with \(f(n) = b\text{?}\) Explain.
    Solution.
    No, the image is \(\{a,c,d\}\) so \(b\) is not in the image.
Try working with piecewise-defined functions

Activity 6.1.C Piecewise-defined functions.

Β 
  1. The function \(f:\mathbb{Z} \to \mathbb{Z}\) is defined by
    \begin{equation*} f(n) = \left\{ \begin{array}{rl} 2 \amp \text{ if } n \text{ is positive } \\ 1 \amp \text{ if } n=0 \\ 0 \amp \text{ if } n \text{ is negative } \end{array} \right.\text{.} \end{equation*}
    Evaluate \(f(5)\text{,}\) \(f(2)\text{,}\) \(f(-4)\text{,}\) and \(f(0)\text{.}\)
  2. What is the image of the function \(f\text{?}\)
  3. In ActivityΒ 6.1.B we saw the function \(\fn{alt}: \mathbb{N} \to \mathbb{Z}\) defined by \(\fn{alt}(n) = (-1)^n\text{.}\) Evaluate \(\fn{alt}(0)\text{,}\) \(\fn{alt}(1)\text{,}\) \(\fn{alt}(2)\text{,}\) \(\fn{alt}(3)\text{,}\) and \(\fn{alt}(4)\text{.}\) What do you notice?
  4. Write a piecewise-defined definition for \(\fn{alt}\) that does not involve powers.

Subsection 6.1.D Dot Diagrams and Graphs of Functions

How can we visually represent a function? When the domain and the codomain are subsets of \(\mathbb{R}\text{,}\) we can draw a graph of the function on the \(xy\)-plane. You have seen graphs of these types of functions in algebra or calculus. When the domain and codomain are finite sets or subsets of \(\mathbb{Z}\text{,}\) we can represent the function using a dot diagram. Let’s begin with graphs in the \(xy\)-plane.

Definition 6.1.22 Graph of function where the domain and codomain are subsets of \(\mathbb{R}\).

Consider a function \(f: X \to Y\) where \(X\) and \(Y\) are subsets of \(\mathbb{R}\text{.}\) The graph of the function \(f\) is the set of points \((x,y)\) on the \(xy\)-plane such that \(y=f(x)\text{.}\) Note that each point on the graph is of the form \((x,f(x))\text{.}\) For example, if \(f:\mathbb{R} \to \mathbb{R}\) is a function with \(f(2)=5\text{,}\) then the point \((2,5)\) is on the graph of \(f\text{.}\)
Here is an example that shows how the domain of the function can influence the graph.

Example 6.1.23 Graphs of the function in the \(xy\)-plane.

Β 
  1. Consider the function \(f: \mathbb{R} \to \mathbb{R}\) is defined by \(f(x) = 10x + 1\text{.}\) Draw the graph of the function \(f\) on the \(xy\)-plane.
    Solution.
    We can make a small table of values of the function and corresponding points on the graph.
    Table 6.1.24. Evaluating the function \(f:\mathbb{R} \to\mathbb{R}\) defined by \(f(x) = 10x+1\)
    \(x\) \(f(x)=10x+1\) point
    \(-3\) \(-29\) \((-3,-29)\)
    \(-2\) \(-19\) \((-2,-19)\)
    \(-1\) \(-9\) \((-1,-9)\)
    \(0\) \(1\) \((0,1)\)
    \(1\) \(11\) \((1,11)\)
    \(2\) \(21\) \((2,21)\)
    \(3\) \(31\) \((3,31)\)
    Since \(f\) accepts all real numbers as input values, there are many more points on the graph of \(f\) in between the points listed in the table. For example \(f(.1) = 2\) and so the point \((.1,2)\) is also on the graph of \(f\text{.}\) When we include all possible points, we get all of the points on the line, as shown in FigureΒ 6.1.25. The equation of the line is \(y=f(x)\) or, equivalently, \(y=10x+1\text{.}\)
    Figure 6.1.25. Graph of the function \(g: \mathbb{R} \to \mathbb{R}\) defined by \(f(x) = 10x + 1\text{.}\)
  2. Consider the function \(g: \mathbb{N} \to \mathbb{N}\) defined by \(g(n) = 10n+1\text{.}\) Draw the graph of the function \(g\) on the \(xy\)-plane.
    Solution.
    Now the only acceptable input values for \(g\) are nonnegagtive integers, so there are no points on the graph of \(g\) in between the points in TableΒ 6.1.24. FigureΒ 6.1.26 shows the graph of \(g\text{.}\) We can see that the points fall on the line \(y = 10x+1\text{.}\)
    Figure 6.1.26. Graph of the function \(f: \mathbb{N} \to \mathbb{N}\) defined by \(g(n) = 10n+1\text{.}\)
You can use the free graphing software DESMOSβ„’ to help you draw graphs of functions in the \(xy\)-plane.
When the domain and codomain are finite sets or subsets of \(\mathbb{Z}\text{,}\) we can draw a different representation.

Definition 6.1.27 Dot diagram for finite or discrete functions.

Consider a function \(f: X \to Y\) where \(X\) and \(Y\) are finite sets or subsets of \(\mathbb{Z}\text{.}\) The dot diagram for \(f\) has a line of points labeled by the elements of \(X\) and another line of points labeled by the elements of \(Y\text{.}\) If either set is infinite, then we include … at one or both ends of the line of points. For each element \(x\) in the domain, we draw an arrow from the point labeled \(x\) to the point labeled \(f(x)\text{.}\) For example, we draw the dot diagram for the function from ExampleΒ 6.1.20 in FigureΒ 6.1.28.
Figure 6.1.28. The dot diagram of the function from ExampleΒ 6.1.20.
Let’s look at a dot diagram for a function where the domain and codomain are infinite sets.

Example 6.1.29 Dot diagram for \(\fn{lshift}\).

Draw the dot diagram for the function \(\fn{lshift}: \mathbb{Z} \to \mathbb{Z}\) defined by \(\fn{lshift}(m) = m-1\text{.}\)
Solution.
Since the domain and codomain are the set \(\mathbb{Z}\) which is infinite, let’s draw the points in two horizontal lines. FigureΒ 6.1.30 shows a portion of the dot diagram, along with … on each end to indicate that the pattern continues in both directions. We have drawn arrows from each integer \(m\) to \(\fn{lshift}(m)\text{,}\) that is from \(m\) to \(m-1\text{.}\) Many arrows are missing. For example, the diagram does not show the arrow from -3 in the top row to -4 in the bottom row and does not show the arrow from 4 in the top row to 3 in the bottom row.
Figure 6.1.30. The dot diagram of the function from ExampleΒ 6.1.29.
Practice drawing dot diagrams.

Activity 6.1.D Dot diagrams of functions.

Β 
  1. The function \(s: \{1,2,3\} \to \{1,2,3\}\) is defined by \(s(1) = 2\text{,}\) \(s(2) = 3\text{,}\) and \(s(3) = 1\text{.}\) Draw the dot diagram for \(s\text{.}\)
  2. The function \(f: \mathbb{N} \to \mathbb{N}\) defined by \(f(n) = 2^n\text{.}\) Draw the dot diagram for \(f\) as in FigureΒ 6.1.30. Note that the domain and codomain are \(\mathbb{N}\text{,}\) so there will only be … on the right.
  3. Draw the dot diagram of the constant function \(h:\{1,2\} \to \{1,2\}\) defined by \(h(n)=2\text{.}\)
  4. Draw the dot diagram of the identity function \(i:\{1,2\} \to \{1,2\}\text{.}\)
  5. We just drew the dot diagram of two functions from \(\{1,2\}\) to \(\{1,2\}\text{.}\) How many other functions \(k:\{1,2\} \to \{1,2\}\) are there? Draw the dot diagram each of the other functions.
  6. How many functions \(k: \{1,2\} \to \{1,2,3,4,5\}\) are there? Explain how to count. Hint: in Step 1 decide on the value of \(k(1)\) and then in Step 2 decide on the value of \(k(2)\text{.}\)
  7. How many functions \(k: \{1,2\} \to \{1,2,3,\ldots, n\}\) are there? State your answer as a conjecture involving \(n\text{.}\)

Subsection 6.1.E Exercises

Subsubsection Exercises for 6.1.A Infinite sets of numbers

2. Practice.

Β 
  1. Write the interval \([0,2.3]\) using inequality notation. Is 0 in the interval? Is 2.3 in the interval? Is 5 in the interval?
  2. Write the unbounded interval \((2.3,\infty)\) using inequality notation. Is 0 in the interval? Is 2.3 in the interval? Is 5 in the interval?
  3. Write the interval \((1,5)\) using inequality notation. Is 0 in the interval? Is 2.3 in the interval? Is 5 in the interval?
  4. Which integers are in the interval \((1,5)\text{?}\)
  5. Write the interval \(x \le 2.3\) in interval notation. Is 0 in the interval? Is 2.3 in the interval? Is 5 in the interval?
Check.
  1. \(0 \le x \le 2.3\text{,}\) yes, yes, no.
  2. \(x > 2.3\text{,}\) no, no, yes.
  3. Hint: answer should involve \(\lt\text{.}\)
  4. Hint: three integers.
  5. Hint: the answer involves \(-\infty\text{.}\)

Subsubsection Exercises for 6.1.B Function Notation and Vocabulary

5. Practice.

The function \(f: \mathbb{Z} \to \mathbb{Z}\) is defined by \(f(n) = \frac{n(n+1)}{2}\text{.}\) Recall from TheoremΒ 1.1.4 that \(f(n)\) counts the number of handshakes in a group of \(n+1\) people and so \(f(n)\) is an integer.
  1. Identify the domain and codomain of \(f\text{.}\)
  2. Evaluate \(f(5)\) and \(f(6)\text{.}\)
  3. Does there exist a value of \(n\) such that \(f(n) =6\text{?}\) Explain.
  4. Does there exist a value of \(n\) such that \(f(n) = 5\text{?}\) Explain.
  5. What is the image of the function \(f\text{?}\)

6. Understand.

Consider the function \(g: \mathbb{N} \to \mathbb{Z}\) defined by \(g(n) = (-1)^nn!\) where, as usual \(n!\) denotes the factorial DefinitionΒ 2.2.19.
  1. Identify the domain and codomain of \(g\text{.}\)
  2. Evaluate \(g(4)\) and \(g(5)\text{.}\)
  3. Could we have said that the codomain of \(g\) is \(\mathbb{N}\text{?}\) Explain.
  4. Since 0 is a natural number, \(g(0)\) is defined. Evaluate \(g(0)\text{.}\)
Check.
  1. \(\mathbb{N}\text{,}\) \(\mathbb{Z}\)
  2. -24, 120 (Show work.)
  3. Hint: no
  4. Hint: \((-1)^0=1\) and \(0!=1\text{.}\)

7. Understand.

Recall that \(a \fn{ mod } n\) is the remainder when \(a\) is divided by n, as introduced in DefinitionΒ 4.2.3.
  1. Consider the function \(t: \mathbb{Z} \to \mathbb{Z}\) defined by \(t(a) = a \fn{ mod } 3\text{.}\) Evaluate \(t(5)\text{,}\) \(t(6)\text{,}\) and \(t(7)\text{.}\) What is the image of \(t\text{?}\)
  2. Consider the function \(f: \mathbb{Z} \to \mathbb{Z}\) defined by \(f(a) = a \fn{ mod } 4\text{.}\) Evaluate \(f(5)\text{,}\) \(f(6)\text{,}\) and \(f(7)\text{.}\) What is the image of \(f\text{?}\) Be careful.
  3. Fix an integer \(n \ge 2\) and consider the function \(h: \mathbb{Z} \to \mathbb{Z}\) defined by \(g(a) = a \fn{ mod } n\text{.}\) What is the image of \(h\text{?}\)
Check.
  1. 2, 0, 1, \(\{0,1,2\}\)
  2. Hint: evaluate \(f(8)\) too
  3. Hint: what are the possible values of \(a \fn{ mod } n\text{?}\)

8. Understand.

Recall that \(\binom{n}{k}\) is the number of ways to choose a subset of \(k\) objects from a set of \(n\) objects, as defined in DefinitionΒ 2.3.5. Consider the function \(\fn{choosethree}: \mathbb{N} \to \mathbb{Z}\) defined by \(\fn{choosethree}(n) = \binom{n+3}{3}\text{.}\)
  1. Identify the domain and codomain of \(\str{choosethree}\text{.}\)
  2. Evaluate \(\fn{choosethree}(0)\text{,}\) \(\fn{choosethree}{1}\text{,}\) and \(\fn{choosethree}{2}\text{.}\)
Check.
  1. \(\mathbb{N}\text{,}\) \(\mathbb{Z}\)
  2. Hint: \(\binom{5}{3}=10\)

9. Understand.

Recall that \(\fn{gcd}(a,b)\) is the greatest common divisor of \(a\) and \(b\text{,}\) as defined in DefinitionΒ 4.5.1. Consider the function \(f: \mathbb{N} \to \mathbb{N}\) defined by \(f(n) = \fn{gcd}(n,15)\text{.}\)
  1. Evaluate \(f(24)\text{,}\) \(f(10)\text{,}\) and \(f(7)\text{.}\)
  2. Give an example of three different integers with \(f(n) = 1\text{.}\)
  3. Describe the image of \(f\text{.}\)
Check.
  1. Hint: The answers in some order are 1, 3, 5.
  2. Hint: Make sure none of your examples are divisible by three or divisible by five
  3. Hint: What are the divisors of 15?

10. Understand.

Each of the following statements is false. Find a counterexample.
  1. Every function \(f: \mathbb{Z} \to \mathbb{Z}\) has \(f(0)=0\text{.}\)
  2. The function \(f: \mathbb{Z} \to \mathbb{Z}\) defined by \(f(n)=n+3\) has no value of \(n\) for which \(f(n) = 0\text{.}\)

11. Understand.

Decide if each statement is true or false. If true, briefly explain why. If false, give a counterexample.
  1. No function \(f\) has \(f(0)=1\) and \(f(0)=-1\text{.}\)
  2. No function \(f\) has \(f(1)=0\) and \(f(-1)=0\text{.}\)

12. Understand.

DefinitionΒ 6.1.17 defines a fixed point of a function. Find a fixed point of each function.
  1. The function \(q: \mathbb{R} \to \mathbb{R}\) is defined by \(q(x) = 1-x\text{.}\)
  2. The constant function \(c: \mathbb{Z} \to \mathbb{Z}\) is defined by \(c(n) = 3\text{.}\)
  3. The function \(f: \mathbb{Z} \to \mathbb{Z}\) is defined by \(f(a) = a \fn{ mod } 4\) from Exercise 7.

13. Recap.

Do you know …
  1. What the three parts of the definition of a function are? Hint: two are sets.
  2. What the domain, codomain, and image of a function mean in terms of input and output values?
  3. How to identify the domain and codomain of a function from \(f: X \to Y\) notation?
  4. How to find the image of a function?
  5. How to pronounce β€œ\(f(x)\)” when \(f\) is a function?
  6. Why we make a distinction between \(f\) and \(f(x)\text{?}\)
  7. How to evaluate a function?
  8. What the difference is between \(f(2)\) and \(f(x)=2\text{?}\)
  9. How to evaluate a constant function?
  10. What the rule for the identity function is?
  11. What a fixed point of a function is?

14. Explore.

Consider the function \(q: \mathbb{N} \to \mathbb{N}\) defined by \(q(n) = n^2+n+41\text{.}\)
  1. Check that \(q(0)\text{,}\) \(q(1)\text{,}\) \(q(2)\text{,}\) \(q(3)\text{,}\) \(q(4)\text{,}\) \(q(5)\text{,}\) \(q(6)\text{,}\) and \(q(7)\) are each prime. You may consult the list we created in ExampleΒ 4.4.5.
  2. Find a positive integer \(n\) such that \(q(n)\) is composite. Hint: Note that \(q(n) = n(n+1)+41\text{.}\) Can you see a value of \(n\) where \(n\) or \((n+1)\) might factor out? You may use computational technology, but do not just look up the answer.

15. Explore.

The function \(f: \mathbb{Z}^+ \to \mathbb{Q}\) is defined by \(f(n) = \frac{n+1}{n}\text{.}\)
  1. Identify the domain and codomain of the function \(f\text{.}\)
  2. Evaluate \(f(1)\text{,}\) \(f(2)\text{,}\) and \(f(4)\text{.}\)
  3. What happens if you try to use the rule for \(f\) to evaluate \(f(0)\text{?}\) Why should we not be concerned about what happens?
  4. Evaluate \(f(10)\text{,}\) \(f(100)\text{,}\) and \(f(1,000 )\text{.}\) Write your answers in decimal format.
  5. Make a conjecture about the image of \(f\text{.}\) Write your answer as an inequality.

16. Explore.

Prove that the fraction \(\frac{n(n+1)}{2}\) is always an integer. Hint: consider cases. This proof justifies that the function \(f: \mathbb{Z} \to \mathbb{Z}\) defined by \(f(n) = \frac{n(n+1)}{2}\) from Exercise 5 always produces output values in the codomain \(\mathbb{Z}\text{.}\)

17. Explore.

Recall that \(a \fn{ mod } 10\) is the remainder when \(a\) is divided by 10, as introduced in DefinitionΒ 4.2.3. In SectionΒ 4.3, we introduced the set
\begin{equation*} \mathbb{Z}_{10}= \{0,1,2,3,4,5,6,7,8,9\} \end{equation*}
where addition was defined by \(a \oplus b = a + b \fn{ mod } 10\) and multiplication was defined by \(a \otimes b = ab \fn{ mod } 10\text{.}\)
  1. Consider the function \(g: \mathbb{Z}_{10} \to \mathbb{Z}_{10}\) defined by \(g(a) = 3 \oplus a\text{.}\) What are the domain and codomain of \(g\text{?}\) Evaluate \(g(4)\text{.}\) Give an example of an element \(a\) of \(\mathbb{Z}_{10}\) such that \(g(a) =1\text{.}\)
  2. Consider the function \(h: \mathbb{Z}_{10} \to \mathbb{Z}_{10}\) defined by \(h(a) = 3 \otimes a\text{.}\) What are the domain and codomain of \(h\text{?}\) Evaluate \(h(4)\text{.}\) Give an example of an element \(a\) of \(\mathbb{Z}_{10}\) such that \(h(a) =1\text{.}\)
Check.
  1. \(\mathbb{Z}_{10}\text{,}\) \(\mathbb{Z}_{10}\text{,}\) 7, 8
  2. Hint: \(3 \otimes 4 = 2\)

18. Explore.

Consider a function \(f: X \to Y\) where \(X\) and \(Y\) are subsets of \(\mathbb{R}\text{.}\) The function \(f\) is increasing if for every number \(a\) and \(b\text{,}\) if \(a \lt b\text{,}\) then \(f(a) \lt f(b)\text{.}\)
  1. Use TheoremΒ 5.3.13 to prove that the function \(f: \mathbb{Z} \to \mathbb{Z}\) defined by \(f(n) = 3n\) is increasing.
  2. Give a counterexample to show that the function \(g: \mathbb{R} \to \mathbb{R}\) defined by \(g(x) = x^2\) is not increasing.
Check.
  1. Hint: Your proof should begin ``Proof. Let \(a\) and \(b\) be integers. Assume \(a \lt b\text{.}\)
  2. Hint: Find real numbers \(a\) and \(b\) where \(a \lt b\) but \(a^2 \ge b^2\text{.}\) Consider negatives.

Subsubsection Exercises for 6.1.C Piecewise-defined Functions

19. Practice.

The Collatz function \(c: \mathbb{Z} \to \mathbb{Z}\) defined by
\begin{equation*} c(n) = \left\{ \begin{array}{cl} \frac{n}{2} \amp \text{ if } n \text{ is even } \\ 3n+1 \amp \text{ if } n \text{ is odd } \end{array} \right. \end{equation*}
  1. Evaluate \(c(3)\) and \(c(4)\text{.}\)
  2. How many values of \(n\) have \(c(n) = 10\text{?}\) Explain.
  3. How many values of \(n\) have \(c(n) = 11\text{?}\) Explain.

20. Practice.

The function \(\fn{abs}: \mathbb{Z} \to \mathbb{Z}\) is defined by
\begin{equation*} \fn{abs}(n)= \left\{ \begin{array}{rl} n \amp \text{ if } n \text{ is non-negative } \\ -n \amp \text{ if } n \text{ is negative } \end{array} \right. \end{equation*}
  1. Evaluate \(\fn{abs}(4)\text{,}\) \(\fn{abs}(0)\text{,}\) and \(\fn{abs}(-4)\text{.}\)
  2. Explain why \(\fn{abs}(n)\) is always non-negative.
  3. Identify the domain, codomain, and image of \(\fn{abs}\text{.}\)
Note: \(\fn{abs}(n)\) is often denoted \(|n|\text{.}\) These absolute value symbols (\(|\)) are at the same priority in the order of operations DefinitionΒ 2.1.20 as parentheses.
Check.
  1. Hint: The answers are 0 and 4.
  2. Hint: Consider two cases.
  3. Hint: For the image consider (b).

22. Explore.

In Exercise 19 we saw the Collatz function \(c: \mathbb{Z} \to \mathbb{Z}\) defined by
\begin{equation*} c(n) = \left\{ \begin{array}{cl} \frac{n}{2} \amp \text{ if } n \text{ is even } \\ 3n+1 \amp \text{ if } n \text{ is odd } \end{array} \right. \end{equation*}
In this exercise, we are going iterate the function \(c\text{,}\) meaning we complete \(c(n)\text{,}\) then evaluate \(c\) at the answer to get \(c(c(n))\text{,}\) then evaluate \(c\) at the answer to get \(c(c(c(n)))\text{,}\) and so on.
  1. Starting with \(n=6\text{,}\) iterate the function \(c\text{.}\) This means evaluate \(c(6)\text{,}\) then \(c(c(6))\text{,}\) then \(c(c(c(6)))\text{,}\) and so on. You may stop when the pattern becomes obvious. Write down the list of values you get starting with 6.
  2. Repeat for \(n=7\text{.}\)
  3. What do you notice? State your answer as a conjecture. This conjecture is known as the Collatz conjecture.
You may read more about the Collatz conjecture online, but wait until after you finished the parts of this exercise so you don’t spoil the surprise.
Check.
  1. 3, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, …
  2. Hint: It should end the same way.
  3. It always hits 1 and then repeats.

23. Explore.

Consider the piecewise defined function
\begin{equation*} p(n) = \left\{ \begin{array}{cc} n+1 \amp \text{ if \(n\) is even } \\ 2n \amp \text{ if \(n\) is odd } \end{array} \right.\text{.} \end{equation*}
Write a formal proof that \(p(n) \neq 8\) for all integers \(n\text{.}\) Hints: Use a proof by contradiction TheoremΒ 5.1.24. Within that proof, use proof by case SubsectionΒ 4.2.C. See ExampleΒ 6.1.19 (c) for more detail.

Subsubsection Exercises for 6.1.D Dot Diagrams and Graphs of Functions

24. Practice.

Identify the domain and codomain for each finite function and draw its dot diagram.
  1. \(f: \{1, 2, 3, 4\} \to \{a, b, c\}\) defined by \(f(1) = a, f(2) = b, f(3) = a, f(4) = c\)
  2. \(g: \{1, 2, 3, 4\} \to \{a, b, c, d\}\) defined by \(g(1) = a, g(2) = b, g(3) = a, g(4) = c\)
  3. \(h: \{1, 2, 3, 4\} \to \{1,2,3,4\}\) defined by \(h(1) = 2, h(2) = 3, h(3) = 4, h(4) = 1\)
  4. \(k: \{1, 2, 3, 4\} \to \{1,2,3,4\}\) defined by \(k(1) = 3, k(2) = 3, k(3) = 3, k(4) =3\)
Check.
  1. The domain is \(\{1,2,3,4\}\text{.}\) The codomain is \(\{a,b,c\}\text{,}\) and the dot diagram is shown in FigureΒ 6.1.56.
    Figure 6.1.56. The dot diagram for Exercise 24 24.(a)
  2. Hint: Note that \(d\) is in the codomain although no arrow points into it.
  3. The domain and codomain are \(\{1,2,3,4\}\text{.}\) The dot diagram is shown in FigureΒ 6.1.57.
    Figure 6.1.57. The dot diagram for Exercise 24 24.(c)
  4. Hint: All arrows should point to 3.

25. Practice.

The function \(g: \mathbb{Z} \to \mathbb{Z}\) is defined by \(g(n) = 3n\text{.}\)
  1. Evaluate \(g(6)\) and \(g(1)\text{.}\)
  2. Does there exist a value of \(n\) such that \(g(n)=6\text{?}\) Explain.
  3. Does there exist a value of \(n\) such that \(g(n)=1\text{?}\) Explain.
  4. What is the image of the function \(g\text{?}\)
  5. Draw the dot diagram of \(g\) including \(n=-3,-2,-1,0,1,2,3\text{.}\)
Check.
  1. 18, 3
  2. Hint: yes
  3. Hint: no
  4. The multiples of three.
  5. Hint: The domain and codomain are \(\mathbb{Z}\) so there should be … on the left and right for each row.

26. Practice.

Consider the function \(g: \mathbb{R} \to \mathbb{R}\) defined by \(g(x) = 1-x\text{.}\)
  1. Identify the domain of \(g\) and the codomain of \(g\text{.}\)
  2. Evaluate \(g(0)\text{,}\) \(g(0.5)\text{,}\) \(g(2)\text{,}\) and \(g(-2)\text{.}\)
  3. Find a real number \(x\) with \(g(x) = 2\text{.}\) How many real numbers \(x\) have \(g(x) = 2\text{?}\)
  4. Draw the graph of \(g\) on the \(xy\)-plane by hand.
  5. For what values of \(x\) is \(g(x) \ge 0\text{.}\) Answer using an inequality.
Check.
  1. \(\mathbb{R}\text{,}\) \(\mathbb{R}\)
  2. Hint: The answers in some order are \(-1, 0.5, 1, 3\text{.}\)
  3. Hint: Solve \(1-x=2\text{.}\) There is one solution.
  4. Hint: The graph is a line of slope -1 with \(y\)-intercept 1 and \(x\)-intercept 1.
  5. \(\displaystyle x \le 1\)

27. Understand.

Pay careful attention to the domain and codomain when drawing dot diagrams.
  1. Draw the dot diagram for the function \(t: \mathbb{Z} \to \mathbb{Z}\) defined by \(t(a) = a \fn{ mod } 3\) from Exercise 7.
  2. Draw the dot diagram for the function \(\fn{choosethree}: \mathbb{N} \to \mathbb{Z}\) defined by \(\fn{choosethree}(n) = \binom{n+3}{3}\) from Exercise 8.
  3. Draw the dot diagram for the function \(f: \mathbb{N} \to \mathbb{N}\) defined by \(f(n) = \fn{gcd}(n,15)\) from Exercise 9.
Check.
  1. Hint: All arrows should point to 0, 1, or 2.
  2. Hint: The domain is \(\mathbb{N}\) so the dot diagram has \(\ldots\) on the right, but the codomain is \(\mathbb{Z}\) so the dot diagram has \(\ldots\) on the left and right. There should be an arrow from 0 to 1 and an arrow from 1 to 4.
  3. Hint: The domain and codomain are \(\mathbb{N}\) so the dot diagram has \(\ldots\) on the right. Every arrow points to 1, 3, 5, or 15.

28. Understand.

We defined the identity function in DefinitionΒ 6.1.17.
  1. Draw the dot diagram of the identity function \(i:\{1,2,3,4\} \to \{1,2,3,4\}\text{.}\)
  2. Draw the dot diagram of the identity function \(i: \mathbb{Z} \to \mathbb{Z}\text{.}\)
  3. Draw the graph on the \(xy\)-plane of the identity function \(i: \mathbb{R} \to \mathbb{R}\text{.}\)
  4. Draw the graph on the \(xy\)-plane of the identity function \(i: \mathbb{Z} \to \mathbb{Z}\text{.}\)
Check.
  1. Hint: All arrows should point horizontally.
  2. Hint: All arrows should point vertically.
  3. Hint: The graph is the line \(y=x\text{.}\)
  4. Hint: The graph consists of isolated points on the line \(y=x\text{.}\)

29. Understand.

We defined a constant function in DefinitionΒ 6.1.17.
  1. Draw the dot diagram of the constant function \(c:\{1,2,3,4\} \to \{1,2,3,4\}\) defined by \(c(n)=2\text{.}\)
  2. Draw the dot diagram of the constant function \(c:\mathbb{Z} \to \mathbb{Z}\) defined by \(c(n)=2\text{.}\)
  3. Draw the graph on the \(xy\)-plane of the constant function \(c: \mathbb{R} \to \mathbb{R}\) defined by \(c(x)=2\text{.}\)
  4. Draw the graph on the \(xy\)-plane of the constant function \(c: \mathbb{Z} \to \mathbb{Z}\) defined by \(c(x)=2\text{.}\)
Check.
  1. Hint: All arrows should point into 2.
  2. Hint: All arrows should point into 2.
  3. Hint: The graph is a horizontal line.
  4. Hint: The graph consists of isolated dots along that horizontal line.

30. Recap.

Do you know …
  1. How to draw the dot diagram for a function when the domain and codomain are finite?
  2. How to draw the dot diagram for a function when the domain and codomain are (possibly infinite) subsets of \(\mathbb{Z}\text{.}\)
  3. How to draw the graph of a function when the domain and codomain are subsets of \(\mathbb{R}\text{?}\) For any complicated rule, you are welcome to use DESMOSβ„’.
  4. How are \(x\) and \(y\) related if the point \((x,y)\) is on the graph of the function \(f\text{?}\)
  5. Why some graphs of functions in the \(xy\)-plane consist of separate points while other graphs have continuous lines or curves?

31. Explore.

The first three parts of this exercise duplicate our work in ActivityΒ 6.1.D. Hint: A question beginning β€œhow many” asks you to count. For example, you can use that steps multiply TheoremΒ 2.2.3.
  1. How many functions \(f:\{1,2\} \to \{1,2\}\) are there?
  2. How many functions \(f:\{1,2\} \to \{1,2,3\}\) are there? Explain how to count using steps.
  3. How many functions \(f:\{1,2\} \to \{1,2,3, \ldots n\}\) are there? State your answer as a conjecture involving a function of \(n\text{.}\)
  4. How many functions \(f:\{1,2,3\} \to \{1,2\}\) are there? Explain how to count using steps.
  5. How many functions \(f:\{1,2,3, \ldots n\} \to \{1,2\}\) are there? State your answer as a conjecture involving a function of \(n\text{.}\)

32. Explore.

In each part of this exercise, use DESMOSβ„’ to graph the functions \(y =f(x)\) on the same set of axes for \(-5 \le x \le 5\) and \(-15 \le x \le 15\text{.}\) Some properties that could be similar or different: is/is not a line, having the same/different slope (rise over run), having the same/different \(y\)-intercept (point where the graph crosses the \(y\)-axis), being increasing (uphill as move left to right)/decreasing (downhill as move left to right).
  1. Compare the graphs of \(y=x\) and \(y = -x\) by saying what is similar and different.
  2. Compare the graphs \(y = x+1\) and \(y = 1-x\) by saying what is similar and different.
  3. Compare the graphs of \(y=x\text{,}\) \(y=2x\text{,}\) and \(y=3x\) by saying what is similar and different.
  4. Compare the graphs of \(y = x+1\text{,}\) \(y = x+2\text{,}\) and \(y = x+3\) by saying what is similar and different.
  5. Compare the graphs of \(y=x+1\) and \(y = x^2+1\) by saying what is similar and different.