15 Functions

We have already seen and worked with functions previously in the Calculus section, but we have never defined what a function is. A function is a special type of relation where for each x in the domain there exists one and only one y in the range that x is related to, which is stated in the second part of the following formal definition from Smith et al. [23].


Definition III.6
A function (or mapping) from A to B is a relation f from A to B such that

  1. the domain of f is A and
  2. if (x,y)\in f and (x,z)\in f, then y=z.

There is more notation and terminology related to functions that Smith et al. provides. f:A\rightarrow B means that “f is a function from A to B” or “f maps A to B.” The codomain of f is B, and f is a function on A if A=B. y=f(x) means that (x,y) is an element of f. y is the image or value of f at x, and x is the pre-image of y [23].

One more thing to note is that the range and codomain are not necessarily equal sets. The range is the set of all y-values such that y=f(x) for some x in the domain. The codomain includes all of the range values but may also include values that are not mapped to from some x in the domain. For example, we can define a function

    \[f:\mathbb{N}\rightarrow \mathbb{Q}\]

    \[f(x)=\frac{1}{x^2}.\]

The codomain is \mathbb{Q}, but the range is much smaller. For instance, the negative rational numbers are all elements of the codomain but are not elements of the range.

The range is always a subset of but is not necessarily equal to the codomain. Later on, we will discuss a special type of function where the range and codomain are equal sets.

Let’s go through an example of how to determine whether a relation is a function. This is a problem that I completed for Calculus I that comes from Larson and Edwards [15].


Example 31
Determine whether f(x)=\pm\sqrt{16-x^2} is a function.

Solution
Suppose that (x,w) and (x,v) are elements of f. According to the definition of a function, w must equal v. So, if we show that w=v, we will have proven that f(x) is a function. We have

    \[w=f(x)=\sqrt{16-x^2}\,\,\text{and}\,\, v=f(x)=-\sqrt{16-x^2}.\]

Thus, we have that (x,\sqrt{16-x^2}) and (x, -\sqrt{16-x^2}) are elements of f. However, because

    \[\sqrt{16-x^2}\neq -\sqrt{16-x^2},\]

w\neq v. Therefore, f(x) is not a function by Definition III.6.

Just as we have different types of relations, we also have different types of functions. These types are one-to-one and onto.

One-to-one

A function is one-to-one if the elements of the domain have a one-to-one correspondence to the elements of the range. When we defined a function, we said that a relation was a function if each value in the domain mapped to one and only one value in the range. That is, if f(x)=y and f(x)=z, then y=z. However, a function does not place any restrictions on how many domain values can map to a single range value. A one-to-one function then is one where each range value is mapped to from one and only one domain value. This can be visualized as follows:


The above diagram is that of the function f(x)=x. The ellipse on the left is the domain, and the one on the right is the codomain. Notice how the elements of the domain have a one-to-one correspondence with the elements of the range. There is not a single point that has two lines coming from it.

Now that we have an idea of what a one-to-one function is, let’s look at the following formal definition provided by Smith et al. [23].


Definition III.7
A function f:A\rightarrow B is one-to-one (or is an injection) if whenever f(x)=f(y), then x=y. When f is an injection, we write f:A\xrightarrow{1-1} B.

So, how do we determine whether a function is one-to-one? According to Smith et al., we could do a direct proof by assuming that f(x)=f(y) and then showing that x=y, or we can prove the contrapositive by assuming x\neq y and then showing that f(x)\neq f(y) [23]. Let’s practice using a homework problem from Smith et al. that I completed for this paper [23].


Example 32
Prove that the function f:\mathbb{R}\rightarrow \mathbb{R} defined as

    \[f(x) = \left\{ \begin{array}{ll} \frac{x-2}{x+4} & \quad x \neq -4\\ 1 & \quad x = -4 \end{array} \right.\]

is one-to-one.

Proof.
We need to show for all x,y\in \mathbb{R} where x,y\neq -4 that if f(x)=f(y), then x=y. Using the direct proof method, suppose that f(x)=f(y), then

    \begin{align*} f(y)&=f(x) \\ \frac{y-2}{y+4}&=\frac{x-2}{x+4}\\ 0&=\frac{x-2}{x+4}-\frac{y-2}{y+4}\\ &=\frac{(x-2)(y+4)}{(x+4)(y+4)}-\frac{(x+4)(y-2)}{(x+4)(y+4)}\\ &=\frac{xy-2y+4x-8-xy+2x-4y+8}{(x+4)(y+4)}\\ &=\frac{6x-6y}{(x+4)(y+4)}\\ &=6x-6y\\ &=x-y\\ y&=x \end{align*}

Since f(-4)=1, we need to show that f(x)\neq 1 for all x\neq -4. We will prove this by contradiction. Suppose that \frac{x-2}{x+4}=1 for some x\in \mathbb{R}.

    \begin{align*} \frac{x-2}{x+4}&=1\\ x-2&=x+4\\ -2&=4 \end{align*}

Since -2\neq 4, we have reached a contradiction and have proven that \frac{x-2}{x+4}\neq 1 for all x\in \mathbb{R}. Thus, f(x)=1 if and only if x=-4. Therefore, f(x) is a one-to-one function.

Onto

A function is onto if the domain maps onto the entire codomain. That is, for each element in the codomain, there exists at least one element in the domain that maps to it. This can be visualized as follows:


The above diagram is that of the function f(x)=x^2. The ellipse on the left is the domain, and the one on the right is the codomain. Notice how the elements of the codomain each have an element of the domain that maps to it. Let’s now look at the formal definition provided by Smith et al. [23].


Definition III.8
A function f:A\rightarrow B is onto B (or is a surjection) if Rng(f)=B. When f is a surjection, we write f:A\xrightarrow{\text{onto}} B.

So, how do we go about showing that the range is equal to the codomain? Recall from chapter 13, that two sets are equal if each is a subset of the other. Since we already know that the range is a subset of the codomain, all we have to show is that the codomain is a subset of the range. That is, we show that if x is an element of the codomain then x must be an element of the range. Let’s practice with a homework problem from Smith et al. that I completed for this paper [23].


Example 33
Prove that the function f:\mathbb{R}\rightarrow \mathbb{R} defined as

    \[f(x) = \left\{ \begin{array}{ll} \frac{x-2}{x+4} & \quad x \neq -4\\ 1 & \quad x = -4 \end{array} \right.\]

is onto.

Proof.
We need to show that every element in the codomain is an element of the range by showing that there exists an x\in \mathbb{R} such that f(x)=y for all y\in\mathbb{R}. We have that

    \begin{align*} y&=f(x)\\ &=\frac{x-2}{x+4}\\ xy+4y&=x-2\\ 4y+2&=(1-y)x\\ \frac{4y+2}{1-y}&=x\\ \end{align*}

Since x= \frac{4y+2}{1-y} is a real number for all real numbers y except y=1, we can find a real number x such that f(x)=y for all y in the codomain except for y=1. But based on how the function is defined, f(-4)=1. Since for all y in the codomain there exists an x in the domain such that f(x)=y, every element in the codomain is also in the range. Thus, the codomain is a subset of the range, and the range and codomain are equal. Therefore, the function is onto.

Not only is it possible for a function to be one-to-one or onto, but it is also possible for a function to be both. In fact, functions that possess both of these characteristics are at the center of what it means for two sets to be equivalent, which in turn lays the foundation for our next topic, cardinality.

License

Portfolio for Bachelor of Science in Mathematics Copyright © by Abigail E. Huettig. All Rights Reserved.

Share This Book