8. Functions

CAUTION - CHAPTER UNDER CONSTRUCTION!

This chapter was last updated on March 11, 2025.
Contents locked until 11:59 p.m. Pacific Standard Time on May 23, 2025.

Informally, a function \(f\) from set D to set C is a rule that assigns to each input element in D exactly one output element from C. The set D is called the domain of the function, and the set C is called the codomain of the function. This informal definition was given in the chapter Introducing Discrete Mathematics.

The informal definition implies that every element in the domain D is an "input" that is assigned an output value in the codomain C. The informal definition does not imply that every element in the codomain C is an output for some input in the domain D. The highlighted sentence may seem unimportant since you usually only care about the outputs you can actually get from a function, but the example presented in the next section shows why it is important to be precise about what set the codomain is. A formal definition of function is introduced in this chapter to address this need for precision.

Key terms and concepts covered in this chapter:

  • Functions

    • Domain

    • Codomain

    • Range

  • Properties of functions (injectivity, surjectivity, bijectivity)

    • A bijective function is the same as a one-to-one correspondence

    • An injective function is one that assigns every pair of different inputs to a pair of different outputs

    • A surjective function is one whose range is equal to its codomain (that is, every element of the codomain is an output assigned to one or more inputs)

    • A bijective function is both injective and surjective

  • Inverse functions

  • Composition of functions

8.1. Why Specifying the Codomain is Important

The following example compares two implementations, in different programming languages, of the "same" function: The input values are the same, and the rule that assigns to each input its one and only output is the same. However, the two implementations use different codomains which effects how the output values can be used.

Example 1 - The floor() functions in Python and Java

In computing, integer data types are used to represent loop counters or indices into arrays, while floating-point data types are used to represent real numbers (like decimals) in scientific or financial calculations. In general, a number that can be stored using an integer type can also be stored using a floating-point type, but the ways in which that number can be used will depend on the data type. The following code examples show why it is important to keep this in mind when coding.

First, recall that the floor of x , written as \(\lfloor x \rfloor,\) is the greatest integer less than or equal to the real number x. The floor() function is available in both Python and Java as an implementation of \(\lfloor x \rfloor.\) In both programming languages floor() takes a double precision floating-point number as its input, but Python floor() returns a value of integer data type while Java floor() function returns a value of floating-point data type.

More detail about floating point
On most hardware, both Python’s float data type and Java’s double data type are implementations of IEEE 754 double precision 64-bit floating-point numbers. For example, the decimal number 1.4 is encoded by the bitstring \[001111111111011001100110011001100110011001100110011001100110011\] of length 64 whether you use a Python float with value 1.4 or a Java double with value 1.4. The underlying bitstring used for the encoding 1.4 is the same in both languages.
The floor() function in Python takes a float as input and returns an int
The floor() function in Java takes a double as input and returns a double.
This means that the floor() functions in Python and Java have the same domain and use, essentially, the same rule to compute output values, but have different codomains (that are represented by different data types in the two languages.)

Notice that in the Python code below, the return value from the floor() function is an int which we can then use as an index into list L.

To step through the code, click on the "Next" button.

Now notice that in the Java code below, that the return value from the floor() function is a double which we cannot use as an index into array L without error. We must use a composition of functions (Java’s floor() function followed by the function that casts an input of type double to an output of type int ) to get the correct data type for an array index.

To step through the code, click on the "Next" button.

The formal definition given in the next section will let us distinguish between two functions that use the same rule and have the same domain but have different codomains.

8.2. A Formal Definition Of Function

Definition

A function \(f\) from set \(A\) to set \(B\) is an ordered triple \((f,\, A,\, B)\) consisting of sets \(f,\) \(A,\) and \(B\) such that

  • \(f\) is a subset of the Cartesian product \(A \times B\) and

  • each element of \(A\) appears as the first coordinate of exactly one pair \(( a, \, b) \in f.\)

That is, \(f \subseteq A \times B\) and for each element \(a \in A\) there is exactly one \(b \in B\) such that \((a,\, b) \in f\). The set \(f\) of ordered pairs is called the graph of the function. The set \(A\) is called the domain of the function and the set \(B\) is called the codomain of the function.
Note: This definition of a function as an ordered triple is based on the Bourbaki definition in the 1970 book Théorie des ensembles.

Why would we need such a highly technical formal definition? The reason why the ordered triple is used in the definition is that we need to be able to distinguish two functions that have the same graph, as a set of ordered pairs, but different codomains. Two functions can have different codomains even if their graphs, as sets of ordered pairs, are the same set (Notice that if two functions have the same graph then they must have the same domain.) If this is not clear, see the example "Three closely-related functions, no two of which are equal," which comes after the definitions listed below.

  • We write \(f : A \rightarrow B\) to state that \(f\) is a function from set \(A\) to set \(B.\)

  • We often refer to the ordered triple as " f " without explicitly mentioning the other two members of the ordered triple. That is, we refer to the function as its set of ordered pairs \(f\), but it is very important to remember that the actual definition includes the domain and codomain, too.

  • It is important to note that the graph of \(f\) is the set of ordered pairs which we often represent by plotting points, but that plot is only a representation of the graph (in the same way that "five" and "cinco" are verbal representations of a number but are not the number itself.)

  • We write \(f(a)=b\) instead of \((a,\, b) \in f\). The value \(b = f(a)\) is called the image of \(a\) assigned by \(f,\) and \(a\) is called the pre-image of \(b.\)

  • The range of \(f\) is the set \(\{ f(a) : a \in A \}\), that is, the set of all images (output values) assigned by \(f.\) The range is the set of \(b \in B\) such that there is at least one ordered pair \(( a, \, b) \in f.\)

  • Two functions are equal if they have the same graph, the same domain, and the same codomain. That is, the functions \((f,\, A,\, B)\) and \((g,\, S,\, T)\) are equal if they are identical as ordered triples: \(f = g\) and \(A = S\) and \(B = T.\) We can also simply say that "\(f\) and \(g\) are the same function."

  • Notice that the graph \(f\) in the formal definition replaces the rule used in the informal definition. Given the graph, which is the set of ordered pairs, we can state a rule as "given an input \(a \in A,\) the output is the one \(b \in B\) such that \((a,\, b) \in f.\)" This is exactly how you would use a table of values to represent a function: Find the row with the input value then choose the value in the output column

The graph (i.e., the set of ordered pairs), the domain, and the codomain determine the function, NOT the formula, words, table, plot, or code used to describe a rule for the function.

The graph of a function determines how to assign each input to its output. For example, the functions \(f: \mathbb{R} \rightarrow \mathbb{R}\) and \(g: \mathbb{R} \rightarrow \mathbb{R}\) defined by the formulae \(f(x) = |x|\) and \(g(x) = \sqrt(x^{2})\) are equal, and in fact are one and the same function, because \(f = g\) as sets, so the "two" functions have the same graph, the same domain, and the same codomain. The "two" functions are just two ways of describing the same ordered triple.

Example 2 - Three closely-related functions, no two of which are equal.

Consider functions \(f\), \(g\), and \(h\) defined as follows:

\(f : \mathbb{R} \rightarrow \mathbb{R}\) is defined by \(f = \{ (x,\,x^{2}) \mid x \in \mathbb{R} \}.\)

\(g : \mathbb{R} \rightarrow \mathbb R_{\ge 0}\) is defined by \(g = \{ (x,\,x^{2}) \mid x \in \mathbb{R} \}.\)

\(h : \mathbb{N} \rightarrow \mathbb{N}\) is defined by \(h = \{ (x,\,x^{2}) \mid x \in \mathbb{N} \}.\)

No two of these functions are equal even though they can all be described by the rule "the output is the square of the input" and have identical formulas: \(f(x) = x^{2},\) \(g(x) = x^{2},\) and \(h(x) = x^{2}.\) Each of the functions is defined for a different domain and/or codomain than the other two. In particular, \(f\) and \(g\) are not equal because they have different codomains, even though the two functions have the same graph and the same domain.

8.3. Properties of Functions

In this subsection you will learn about several properties of functions.

8.3.1. Injective Functions

A function \(f : A \rightarrow B\) is injective if distinct elements of the domain \(A\) are mapped to distinct elements of the range. That is, for all \(a_1\) and \(a_2\) in \(A,\) if \(a_1 \neq a_2\) then \(f(a_1) \neq f(a_2).\) Using the contrapositive, this can be stated as: For all \(a_1\) and \(a_2\) in \(A,\) if \(f(a_1) = f(a_2)\) then \(a_1 = a_2.\)
Note: Injective functions are also called one to one functions. The Remix avoids this term because it is easy to confuse "one to one function" with "one-to-one correspondence."

Example 3 - Injective Functions

Consider the functions
\(f : \mathbb{Z} \rightarrow \mathbb{Q}\) defined by \(f(n) = 2^{n}\)
\(g : \mathbb{Z} \rightarrow \mathbb{Z}\) defined by \(g(n) = n^{2},\) and
\(h : \mathbb{Z} \rightarrow \mathbb{Z}\) defined by \(h(n) = n + 2,\) and
\(k : \mathbb{Z} \rightarrow \mathbb{Z}\) defined by \(k(n) = \frac{1}{4}((-1)^n (2n+1) - 1).\)

\(f\) is injective because different input values must be mapped to different output values. Notice that \(f(a) = f(c)\) means that \(2^{a} = 2^{c}\) from which \(2^{a} / 2^{c} = 1 = 2^{a-c}\) must be True, so \(a-c = 0\) must be True, that is, \(a = c.\)

\(g\) is not injective because the input values \(2\) and \(-2\) are mapped to the same output value: \((2)^2 = 4\) and \((-2)^2 = 4.\)

\(h\) is injective because \(h(a) = h(c)\) means that \(a+2 = c+2,\) which means that \(a=c.\)

\(k\) is not injective because the input values \(-1\) and \(0\) are mapped to the same output value, 0.

8.3.2. Surjective Functions

A function \(f\) from the set \(A\) to the set \(B\) is surjective if the image set of \(A\) is the entire set \(B\). This means than for each element \(b\) in the codomain \(B,\) there is some element \(a \in A\) with \(f(a)=b\).
Note: Surjective functions are also called onto functions.

Example 4 - Surjective Functions

Consider the functions
\(f : \mathbb{Z} \rightarrow \mathbb{Q}\) defined by \(f(n) = 2^{n}\)
\(g : \mathbb{Z} \rightarrow \mathbb{Z}\) defined by \(g(n) = n^{2},\) and
\(h : \mathbb{Z} \rightarrow \mathbb{Z}\) defined by \(h(n) = n + 2,\) and
\(k : \mathbb{Z} \rightarrow \mathbb{Z}\) defined by \(k(n) = \frac{1}{4}((-1)^n (2n+1) - 1).\)

\(f\) is not surjective since it is not possible for \(2^{n}\) to have a value that is less than or equal to 0.

\(g\) is not surjective because is not possible for \(n^{2}\) to have a value that is less than 0.

\(h\) is surjective because every \(b\) in the codomain \(\mathbb{Z}\) is an output for some input: Notice that \(h(b-2) = (b-2+2) = 2.\)

\(k\) is surjective because every \(b\) in the codomain \(\mathbb{Z}\) is an output for some nonnegative input - for inputs \(n \geq 0,\) the outputs \(k(n)\) are shown in the lower row of the image.

NtoZ

Notice that whether a function is surjective depends on what the function’s codomain. This is, again, why the formal definition of function is needed.

8.3.3. Bijective Functions

A function \(f\) is bijective if it is both injective and surjective.

Example 5 - Verifying a function is bijective

Verify that the function \(f\left(x\right)=3x+5\), from \(f:R\rightarrow R\), is bijective.

Solution

For injectivity, suppose \(f\left(m\right)=f(n)\). We want to show \(m=n\).

\(f\left(m\right)=f(n)\)

\(3m+5=3n+5\)

Subtracting 5 from both sides gives \(3m=3n\), and then multiplying both sides by \(\frac{1}{3}\) gives \(m=n\).

To show that \(f\left(x\right)\) is surjective we need to show that any \(c\in R\) can be reached by \(f\left(x\right)\). Specifically, to show that \(f\left(x\right)\) is surjective, we need to show that for any \(c\in R\), there is a corresponding \(x\) for which \(f\left(x\right)=c\). To show this consider \(f\left(x\right)=3x+5\). Equate to \(c\) and solve for \(x\).

\(f\left(x\right)=3x+5=c\)

Well, \(3x+5=c\) gives \(3x=c-5\) or \( x=\frac{c-5}{3}\). So, for any \(c\), there is an \(x\), namely \(x=\frac{c-5}{3}\), for which \(f\left(x\right)=c\).

8.4. Inverse Functions

Informally, a function \(f\) is invertible if each \(b\) in the codomain \(B\) is assigned to exactly one input \(a\) in the domain \(A.\)

Formally, a function \(f : A \rightarrow B\) is invertible if the ordered triple \((\{(b, a) \, | \, (a, b) \in f \},\, B,\, A)\) is a function.

The set \(\{(b, a) \, | \, (a, b) \in f \}\) is usually denoted by \(f^{-1}\) even in cases when \(f\) is not invertible.

For example if \((a,b)\), corresponds to \(f(a)=b\) , then \( f^{-1}: B \rightarrow A\), corresponds to \( f^{-1}(b)=a\).

The following theorem shows that invertibility of a function is equivalent to bijectivity, or a function being both injective and surjective.

Theorem on Invertibility

A function \(f: A \rightarrow B\) is invertible if and only if \(f\) is bijective.

Being able to solve an equation, amounts to being able to invert a function. Notationally, solving \(f(x) =b\) means solving for \(x\).

Using inverses \(f(x) =b\) is solved \(x=f^{-1}\left(b\right)\).

Consider, for example, \(f\left(x\right)=x^3\) we know

\$ f^{\left(-1\right)}\left(x\right)=root(3)(x)\$

Solving \(f\left(x\right)=2\) means solving \(x^3=2\). To solve \(f\left(x\right)=2\), we use \(x=f^{-1}\left(8\right)\), which in this case means,

\$ x=f^{-1}\left(8\right)=root(3)(8) = 2\$

An easy check \( f\left(2\right)=2^3=8\) and

\$ f^{-1}\left(8\right)=root(3)(8) = 2\$

Functions can, in many cases, be visualized graphically. For example when mapping from the real line \(\mathbb{R}\) to the real line such maps are viewed on a Cartesian plane.

In Appendix: Library of Functions , several functions and their plots are shown to illustrate the important concepts of functions, including domain, codomain, range, and invertibility.

8.5. The Algebra of Functions

If two functions \(f\left(x\right)\) and \(g\left(x\right)\) have the same domain \(A\) and same codomain \(\mathbb{R},\) then you can combine these functions using the operations addition, subtraction, multiplication, and division.

The Algebra of Functions
  1. \(\left(f+g\right)\left(x\right)=f\left(x\right)+g\left(x\right)\)

  2. \(\left(f-g\right)\left(x\right)=f\left(x\right)-g\left(x\right)\)

  3. \(\left(f\cdot\ g\right)\left(x\right)=f\left(x\right)\cdot\ g\left(x\right)\)

  4. \(\left(\frac{f}{g}\right)\left(x\right)=\frac{f\left(x\right)}{g\left(x\right)},\ \ g\left(x\right)\neq0\)

Example 6

Consider \(f\left(x\right)=x^2+1\) and \(g\left(x\right)=\sqrt x\) defined on \(f,\ g: \mathbb{R}_{\geq0} \rightarrow \mathbb{R}\). Find the rules for the functions \(\left(f+g\right)\), \(\left(f-g\right)\), \(\left(f\cdot\ g\right)\), and \(\left(\frac{f}{g}\right)?\)

Solution

The common domain is \(\mathbb{R}_{\geq0}\), since the square root is real valued only for \(\ x\ \geq0\).

\(\left(f+g\right)\left(x\right)=f\left(x\right)+g\left(x\right)=x^2+1+\sqrt x\) , for \( x ≥ 0\)

\(\left(f-g\right)\left(x\right)=f\left(x\right)-g\left(x\right)=x^2+1- \sqrt x\) , for \( x ≥ 0\)

\(\left(f\cdot\ g\right)\left(x\right)=f\left(x\right)\cdot\ g\left(x\right)=\left(x^2+1\right)\cdot\ \sqrt x\), for \( x ≥ 0\)

\(\left(\frac{f}{g}\right)\left(x\right)=\frac{f\left(x\right)}{g\left(x\right)}=\frac{x^2+1\cdot\ }{\ \sqrt x}\), for \( x > 0\).

Notice that the domain of \(\frac{f}{g}\) is \(x>0\), because \(g\left(0\right)=\sqrt0=0\), and division by \(0\) is not defined.

8.6. Composition of Functions

Suppose \(g:A\rightarrow B\) and \(f:B\rightarrow C\), then the functions \( f\) and \(g\), can be composed to obtain a function \(h:A\rightarrow C\), denoted as follows,

\(h\left(x\right)=\left(f\circ g\right)\left(x\right)=f\left(g\left(x\right)\right)\) provided \(x\ \in\ A\) and \(g\left(x\right)\in B\).

Example 7

Consider \(f\left(x\right)=\frac{1}{x}\) and \(g\left(x\right)=2x-3\), defined on \(f,g:R\rightarrow R\). Notice that \(g\left(x\right)\) is defined for all real \(x\) and \(f\left(x\right)\) is defined for all real \(x\ \neq0\). Form the compositions, \(h\left(x\right)=\left(f \circ g\right)\left(x\right)\), and \(k\left(x\right)=\left(g \circ f\right)\left(x\right)\). Also determine their respective domains.

Solution

\(h\left(x\right)=\left(f \circ g\right)\left(x\right)=f\left(g\left(x\right)\right)=f\left(2x-3\right)=\frac{1}{2x-3}\). Here \(x\) needs to be in the domain of \(g\left(x\right)\), or all real \(x\), and \(g\left(x\right)\) needs to be in the domain of \(f\left(x\right)\). In particular \(g\left(x\right)\neq 0\), or \(2x-3\ \neq 0\), or \(x\ \neq\frac{3}{2}\).

By contrast, \(k\left(x\right)=\left(g\circ f\right)\left(x\right)=g\left(f\left(x\right)\right)=g\left(\frac{1}{x}\right)=2\left(\frac{1}{x}\right)-3=\frac{2}{x}-3\). Here \(x\) needs to be in the domain of \(f\left(x\right)\), or \(x\ \neq 0\), and \(f\left(x\right)\) needs to be in the domain of \(g\left(x\right)\), or \(f\left(x\right)\) can be any real number.

Example 8 - composing inverse functions

Consider \(f\left(x\right)=x^3+1\) and \$g(x) =root(3)(x-1)\$ defined on on \(f,g:R\rightarrow R\). Show that \(\left(g \circ f\right)\left(1\right)=1, \left(g \circ f\right)\left(2\right)=2, \left(g\circ f\right)\left(3\right)=3\), and \(\left(g\circ f\right)\left(x\right)=x\)

Solution

\(f\left(1\right)=1^3+1=2\)

\(f\left(2\right)=2^3+1=9\)

\(f\left(3\right)=3^3+1=28\)

\(f\left(x\right)=x^3+1\)

Therefore,

\( \left(g\circ f\right)\left(1\right)=g\left(f\left(1\right)\right)=g\left(2\right)=\) \$ root(3)(2-1)= root(3)(1)=1\$

\(\left(g\circ f\right)\left(2\right)=g\left(f\left(2\right)\right)=g\left(9\right)=\) \$ root(3)(9-1)= root(3)(8)=2\$

\(\left(g\circ f\right)\left(3\right)=g\left(f\left(3\right)\right)=g\left(28\right)=\) \$ root(3)(28-1)= root(3)(27)=3\$

\(\left(g\circ f\right)\left(x\right)=g\left(f\left(x\right)\right)=g\left(x^3+1\ \right)=\)\$ root(3)(x^3 +1 -1)= root(3)(x^3 )=x\$

Notice, in the last example, that \(g\left(x\right)\) undoes \(f\left(x\right)\), in the following sense:

\(f:1\rightarrow 2\) and \(g:2\rightarrow 1\), or the ordered pair \(\left(1,2\right)\) in \(f\), corresponds to \(\left(2,1\right)\) for \(g\).

\(f:2\rightarrow 9\) and \(g:9\rightarrow 2\), or the ordered pair \(\left(2,9\right)\), in \(f\), corresponds to \(\left(9,2\right)\) for \(g\).

\(f:3\rightarrow 28\) and \(g:28\rightarrow 3\), or the ordered pair \(\left(3,28\right)\), in \(f\), corresponds to \(\left(28,3\right)\) for \(g\).

\(f:x\rightarrow x^3+1\) and \(g:x^3+1\rightarrow x\), or the ordered pair \(\left(x,x^3+1\right)\), in \(f\), corresponds to \(\left(x^3+1,x\right)\) for \(g\).

The function \$ g(x))= root(3)(x-1) \$ is said to be the inverse of the function \(f\left(x\right)=x^3+1\). We have shown explicitly that \(\left(g\circ f\right)\left(x\right)=x\).

8.6.1. Inverse Functions and Composition

Notice that if you happen to have two functions \(f : A \rightarrow B\) and \(g : B \rightarrow A\) such that \((g \circ f)(a) = g(f(a)) = a\) for every \(a \in A\) and \((f \circ g)(b) = f(g(b)) = b\) for every \(b \in B,\) then \(f\) and \(g\) are inverse functions.

Example 9 - finding an inverse

Find the inverse \(g\left(x\right)\) of the bijective function \(f\left(x\right)=3x+5\) for \(f,\ g:R\rightarrow R\) . Verify the inverse and show \(\left(f \circ g\right)\left(x\right)=x=\left(g \circ f\right)\left(x\right)\).

Show specifically that \(f\left(2\right)=11\), and \(g\left(11\right)=2\).

Solution

If \(f:x\rightarrow y\) corresponds to \((x,y)\), then the inverse \(g:y\rightarrow x\) corresponds to \((y,x)\). This means that the inverse of the relation \(y=f\left(x\right)=3x+5\), is the relation \(x=f\left(y\right)=3y+5\).

Solving for \(y\) in \(x=f\left(y\right)\), gives \(f^{-1}(x)=y\). Solving for \(y\) in \(x=f\left(y\right)=3y+5\), gives \(x-5=3y\) or \(\frac{x-5}{3}=y=\ f^{-1}(x)=g(x)\).

We now verify that \(\left(f\circ g\right)\left(x\right)=x=\left(g \circ f\right)\left(x\right)\).

\(\left(f\circ g\right)\left(x\right)=f\left(\frac{x-5}{3}\right)=\ 3\left(\frac{x-5}{3}\right)+5=\left(x-5\right)+5=x\),

and \(\left(g \circ f\right)\left(x\right)=g\left(3x+5\right)=\ \frac{(3x+5)-5}{3}=\frac{3x+5-5}{3}=\frac{3x}{3}=x\).

Finally \(f\left(x\right)=3x+5\), and \(f\left(2\right)=3\left(2\right)+5=6+5=11\), or \(f:2\rightarrow 11\)

and \(g\left(x\right)=\frac{x-5}{3}\) and , \(g\left(11\right)=\frac{11-5}{3}=\frac{6}{3}=2\) or \(g:11\rightarrow 2\).

8.7. Exercises

Remixer’s Note: This section is taken from the original “Discrete Math” book with only minor changes.

  1. What can be said about the relation \(f:A\rightarrow B\), if

    1. \(\exists z\in B\forall x\in A,f\left(x\right)\neq z\)

    2. \(\exists x,y \in A, \exists z\in B,\left(x\neq y\right)\bigwedge\left(f\left(x\right)=f\left(y\right)=z\right)\)

    3. \(\forall x,y\in A, \left(f\left(x\right)=f\left(y\right)\right)\ \rightarrow\left(x=y\right)\)

    4. \(\forall x,y\in A,\left(x\neq y\right)\rightarrow\left(f\left(x\right)\neq f\left(y\right)\right)\)

    5. \(\forall z\in B, \exists x,f\left(x\right)=z\)

    6. \(\exists x,y\in A,\left(f\left(x\right)=f\left(y\right)\right)\bigwedge\left(x\ \neq\ y\right)\)

  2. Explain why exponential function \(f(x)=2^x\) is not surjective from \(f: \mathbb{R} \rightarrow \mathbb{R}\), but is in fact a bijection from \(f: \mathbb{R} \rightarrow \mathbb{R}^+\).

  3. Use properties of logarithms to show that \(f\left(x\right)=2^x\) and \(g\left(x\right)=\log_2{x}\), where \(f, g: \mathbb{R} \rightarrow \mathbb{R}\), are inverses by verifying that \(f\left(g\left(x\right)\right)=g\left(f\left(x\right)\right)=x\).

  4. Use properties of logarithms to show that \(f\left(x\right)=10^x\) and \(g\left(x\right)=\log{x}\), where \(f, g: \mathbb{R} \rightarrow \mathbb{R}\), are inverses by verifying that \(f\left(g\left(x\right)\right)=g\left(f\left(x\right)\right)=x\).

  5. Show that the function \(f\left(x\right)=5x-3\), from \(f: \mathbb{R} \rightarrow \mathbb{R}\), is bijective and find its inverse.

  6. Show that the function \(f\left(x\right)=2x^3-1\), from \(f: \mathbb{R} \rightarrow \mathbb{R}\) is bijective and find its inverse.

  7. Consider the function \(f(x) = \left \lceil x \right \rceil\) where \(f:\mathbb{R}\rightarrow\mathbb{Z}\).

    1. Is the function a surjection? Explain.

    2. Is the function an injection? Explain

    3. Is the function a bijection? Explain

    4. Is the inverse mapping a function? Why or why not?

    5. Evaluate

      1. \(f\left(-2.1\right)\)

      2. \(f\left(-1.9\right)\)

      3. \(f\left(1.5\right)\)

      4. \(f\left(1.9\right)\)

      5. \(f\left(2\right)\)

      6. \(f\left(2.3\right) \)

    6. Suppose \(g\left(x\right)=2x\), with \(f\left(x\right)=\left\lceil x\right\rceil\). Evaluate the following:

      1. \(f\left(g\left(2.3\right)\right)\)

      2. \(g\left(f\left(2.3\right)\right)\)

  8. Explain why ceiling function \( \left \lceil x \right \rceil\) is not surjective from \(f: \mathbb{R} \rightarrow \mathbb{R}.\)

  9. Consider the function \(f(x) = \left \lfloor x \right \rfloor\) where \(f:\mathbb{R}\rightarrow\mathbb{Z}\).

    1. Is the function a surjection? Explain.

    2. Is the function an injection? Explain

    3. Is the function a bijection? Explain

    4. Is the inverse mapping a function? Why or why not?

    5. Evaluate

      1. \(f\left(-5.1\right) \)

      2. \(f\left(-3.9\right)\)

      3. \(f\left(-3.2\right)\)

      4. \(f\left(5\right) \)_

      5. \(f\left(5.3\right)\)

    6. Suppose \(g\left(x\right)=3x\), with \(f\left(x\right)=\left\lfloor x\right\rfloor\). Evaluate the following:

      1. \(f\left(g\left(5.3\right)\right)\)

      2. \(g\left(f\left(5.3\right)\right)\)

  10. The absolute value function, denoted \(f(x)=|x|\), where \(f\left(x\right):\mathbb{R} \rightarrow \mathbb{R}\), gives the distance from \(x\) to \(0\). For example, \(f\left(2.5\right)=\left|2.5\right|=2.5\). And \(f\left(-4.5\right)=\left|-4.5\right|=4.5\). Notice that if \(x \geq 0\), then \(\left|x\right|=x\). However if \(x<0\), then \(\left|x\right|=\ -x\). We can state this using the notation for piecewise functions:

    \$f(x) = |x|={( x, if x ≥ 0),(-x,if x < 0):}\$
    1. Graph \(f\left(x\right)=|x|\), for -\(10\ \le x\ \le10\)

    2. Evaluate

      1. \(f(-5)=|-5|\),

      2. \(f(-2.5)=|-2.5|\),

      3. \(f(3.5)=|3.5|\).

    3. Show that \(f\left(x\right)=\left|x\right|\), with \(f:\mathbb{R}\rightarrow \mathbb{R}\), is not injective.

    4. Show that \(f\left(x\right)=\left|x\right|\), with \(f:\mathbb{R}\rightarrow \mathbb{R}\), is not surjective.

    5. Consider \(g\left(x\right)=3x+2\), with \(g:\mathbb{R}\rightarrow \mathbb{R}\), and \(f\left(x\right)=|x|\). Find and simplify the following:

      1. \(\left(g\circ f\right)\left(x\right)\)

      2. \(\left(f\circ g\right)\left(x\right)\)

  11. A real-valued function, \(f: \mathbb{R} \rightarrow \mathbb{R}\), is said to be strictly increasing if whenever \$x<y\$, then \$f(x)<f(y)\$.

    1. State this using logical quantifiers.

    2. State a similar definition for a strictly decreasing function, and then translate using logical quantifiers.