0% found this document useful (0 votes)
246 views

Introduction and Preliminaries - Sets and Functions

This document introduces some fundamental concepts of set theory, including: - A set is an unordered collection of objects. Two sets are equal if they contain the exact same elements. - Common notation includes using curly braces { } to enclose set elements, ∈ to mean "is an element of", and ⊆ to mean "is a subset of". - Sets can be defined using set builder notation, writing conditions elements must satisfy like {x: x is even}. This defines the set of all even numbers. - Relationships between sets include being equal, one being a subset of another, and their intersection/union.

Uploaded by

Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
246 views

Introduction and Preliminaries - Sets and Functions

This document introduces some fundamental concepts of set theory, including: - A set is an unordered collection of objects. Two sets are equal if they contain the exact same elements. - Common notation includes using curly braces { } to enclose set elements, ∈ to mean "is an element of", and ⊆ to mean "is a subset of". - Sets can be defined using set builder notation, writing conditions elements must satisfy like {x: x is even}. This defines the set of all even numbers. - Relationships between sets include being equal, one being a subset of another, and their intersection/union.

Uploaded by

Ahmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

24 0.

Introduction and Preliminaries

0.3 Sets
The most fundamental objects we will use in our studies (and really in
all of math) are sets. Much of what follows might be review, but it is
very important that you are fluent in the language of set theory. Most of
the notation we use below is standard, although some might be a little
different than what you have seen before.
For us, a set will simply be an unordered collection of objects. Two
examples: we could consider the set of all actors who have played The
Doctor on Doctor Who, or the set of natural numbers between 1 and 10
inclusive. In the first case, Tom Baker is a element (or member) of the set,
while Idris Elba, among many others, is not an element of the set. Also,
the two examples are of different sets. Two sets are equal exactly if they
contain the exact same elements. For example, the set containing all of
the vowels in the declaration of independence is precisely the same set as
the set of vowels in the word “questionably” (namely, all of them); we do
not care about order or repetitions, just whether the element is in the set
or not.

Notation
We need some notation to make talking about sets easier. Consider,

A  {1, 2, 3}.

This is read, “A is the set containing the elements 1, 2 and 3.” We use
curly braces “{, }” to enclose elements of a set. Some more notation:

a ∈ {a, b, c}.

The symbol “∈” is read “is in” or “is an element of.” Thus the above
means that a is an element of the set containing the letters a, b, and c.
Note that this is a true statement. It would also be true to say that d is not
in that set:
d < {a, b, c}.
Be warned: we write “x ∈ A” when we wish to express that one of the
elements of the set A is x. For example, consider the set,

A  {1, b, {x, y, z}, ∅}.

This is a strange set, to be sure. It contains four elements: the number


1, the letter b, the set {x, y, z}, and the empty set ∅  {}, the set containing
no elements. Is x in A? The answer is no. None of the four elements in
A are the letter x, so we must conclude that x < A. Similarly, consider
the set B  {1, b}. Even though the elements of B are elements of A, we
0.3. Sets 25

cannot say that the set B is one of the elements of A. Therefore B < A.
(Soon we will see that B is a subset of A, but this is different from being an
element of A.)
We have described the sets above by listing their elements. Sometimes
this is hard to do, especially when there are a lot of elements in the set
(perhaps infinitely many). For instance, if we want A to be the set of all
even natural numbers, would could write,

A  {0, 2, 4, 6, . . .},

but this is a little imprecise. A better way would be

A  {x ∈ N : ∃n ∈ N(x  2n)}.

Let’s look at this carefully. First, there are some new symbols to digest:
“N” is the symbol usually used to denote that natural numbers, which
we will take to be the set {0, 1, 2, 3, . . .}. Next, the colon, “:”, is read such
that; it separates the elements that are in the set from the condition that
the elements in the set must satisfy. So putting this all together, we would
read the set as, “the set of all x in the natural numbers, such that there
exists some n in the natural numbers for which x is twice n.” In other
words, the set of all natural numbers, that are even. Here is another way
to write the same set.

A  {x ∈ N : x is even}.

Note: Sometimes mathematicians use | or ϶ for the “such that” symbol


instead of the colon. Also, there is a fairly even split between mathemati-
cians about whether 0 is an element of the natural numbers, so be careful
there.
This notation is usually called set builder notation. It tells use how
to build a set by telling us precisely the condition elements must meet to
gain access (the condition is the logical statement after the “:” symbol).
Reading and comprehending sets written in this way takes practice. Here
are some more examples:

Example 0.3.1

Describe each of the following sets both in words and by listing out
enough elements to see the pattern.

1. {x : x + 3 ∈ N}.
2. {x ∈ N : x + 3 ∈ N}.
3. {x : x ∈ N ∨ −x ∈ N}.
26 0. Introduction and Preliminaries

4. {x : x ∈ N ∧ −x ∈ N}.

Solution.

1. This is the set of all numbers which are 3 less than a natural
number (i.e., that if you add 3 to them, you get a natural num-
ber). The set could also be written as {−3, −2, −1, 0, 1, 2, . . .}
(note that 0 is a natural number, so −3 is in this set because
−3 + 3  0).
2. This is the set of all natural numbers which are 3 less than a
natural number. So here we just have {0, 1, 2, 3 . . .}.
3. This is the set of all integers (positive and negative whole
numbers, written Z). In other words, {. . . , −2, −1, 0, 1, 2, . . .}.
4. Here we want all numbers x such that x and −x are natural
numbers. There is only one: 0. So we have the set {0}.

There is also a subtle variation on set builder notation. While the


condition is generally given after the “such that”, sometimes it is hidden
in the first part. Here is an example.

Example 0.3.2

List a few elements in the sets below and describe them in words.
The set Z is the set of integers; positive and negative whole num-
bers.
1. A  {x ∈ Z : x 2 ∈ N}
2. B  {x 2 : x ∈ N}

Solution.

1. The set of integers that pass the condition that their square
is a natural number. Well, every integer, when you square it,
gives you a non-negative integer, so a natural number. Thus
A  Z  {. . . , −2, −1, 0, 1, 2, 3, . . .}.
2. Here we are looking for the set of all x 2 s where x is a natural
number. So this set is simply the set of perfect squares. B 
{0, 1, 4, 9, 16, . . .}.
Another way we could have written this set, using more
strict set builder notation, would be as B  {x ∈ N : x 
n 2 for some n ∈ N}.
0.3. Sets 27

We already have a lot of notation, and there is more yet. Below is a


handy chart of symbols. Some of these will be discussed in greater detail
as we move forward.
Special sets.

∅ The empty set is the set which contains no elements.


U The universe set is the set of all elements.
N The set of natural numbers. That is, N  {0, 1, 2, 3 . . .}.
Z The set of integers. That is, Z  {. . . , −2, −1, 0, 1, 2, 3, . . .}.
Q The set of rational numbers.
R The set of real numbers.
P(A) The power set of any set A is the set of all subsets of A.

Set Theory Notation.

{, } We use these braces to enclose the elements of a set. So


{1, 2, 3} is the set containing 1, 2, and 3.
: {x : x > 2} is the set of all x such that x is greater than 2.
∈ 2 ∈ {1, 2, 3} asserts that 2 is an element of the set {1, 2, 3}.
< 4 < {1, 2, 3} because 4 is not an element of the set {1, 2, 3}.
⊆ A ⊆ B asserts that A is a subset of B: every element of A is
also an element of B.
⊂ A ⊂ B asserts that A is a proper subset of B: every element
of A is also an element of B, but A , B.
∩ A ∩ B is the intersection of A and B: the set containing all
elements which are elements of both A and B.
∪ A ∪ B is the union of A and B: is the set containing all
elements which are elements of A or B or both.
× A × B is the Cartesian product of A and B: the set of all
ordered pairs (a, b) with a ∈ A and b ∈ B.
\ A \ B is A set-minus B: the set containing all elements of A
which are not elements of B.
A The complement of A is the set of everything which is not
an element of A.
|A| The cardinality (or size) of A is the number of elements in
A.
28 0. Introduction and Preliminaries

Investigate!

1. Find the cardinality of each set below.

(a) A  {3, 4, . . . , 15}.


(b) B  {n ∈ N : 2 < n ≤ 200}.
(c) C  {n ≤ 100 : n ∈ N ∧ ∃m ∈ N(n  2m + 1)}.

2. Find two sets A and B for which |A|  5, |B|  6, and


|A ∪ B|  9. What is |A ∩ B|?
3. Find sets A and B with |A|  |B| such that |A ∪ B|  7 and
|A ∩ B|  3. What is |A|?
4. Let A  {1, 2, . . . , 10}. Define B2  {B ⊆ A : |B|  2}. Find
|B2 |.
5. For any sets A and B, define AB  {ab : a ∈ A ∧ b ∈ B}. If
A  {1, 2} and B  {2, 3, 4}, what is |AB|? What is |A × B|?

! Attempt the above activity before proceeding !


Relationships Between Sets
We have already said what it means for two sets to be equal: they have
exactly the same elements. Thus, for example,

{1, 2, 3}  {2, 1, 3}.

(Remember, the order the elements are written down in does not
matter.) Also,

{1, 2, 3}  {1, 1 + 1, 1 + 1 + 1}  {I, II, III}  {1, 2, 3, 1 + 2}

since these are all ways to write the set containing the first three positive
integers (how we write them doesn’t matter, just what they are).
What about the sets A  {1, 2, 3} and B  {1, 2, 3, 4}? Clearly A , B,
but notice that every element of A is also an element of B. Because of this
we say that A is a subset of B, or in symbols A ⊂ B or A ⊆ B. Both symbols
are read “is a subset of.” The difference is that sometimes we want to say
that A is either equal to or is a subset of B, in which case we use ⊆. This
is analogous to the difference between < and ≤.
0.3. Sets 29

Example 0.3.3

Let A  {1, 2, 3, 4, 5, 6}, B  {2, 4, 6}, C  {1, 2, 3} and D  {7, 8, 9}.


Determine which of the following are true, false, or meaningless.

1. A ⊂ B. 4. ∅ ∈ A. 7. 3 ∈ C.
2. B ⊂ A. 5. ∅ ⊂ A. 8. 3 ⊂ C.
3. B ∈ C. 6. A < D. 9. {3} ⊂ C.

Solution.

1. False. For example, 1 ∈ A but 1 < B.


2. True. Every element in B is an element in A.
3. False. The elements in C are 1, 2, and 3. The set B is not equal
to 1, 2, or 3.
4. False. A has exactly 6 elements, and none of them are the
empty set.
5. True. Everything in the empty set (nothing) is also an element
of A. Notice that the empty set is a subset of every set.
6. Meaningless. A set cannot be less than another set.
7. True. 3 is one of the elements of the set C.
8. Meaningless. 3 is not a set, so it cannot be a subset of another
set.
9. True. 3 is the only element of the set {3}, and is an element
of C, so every element in {3} is an element of C.

In the example above, B is a subset of A. You might wonder what


other sets are subsets of A. If you collect all these subsets of A into a new
set, we get a set of sets. We call the set of all subsets of A the power set of
A, and write it P(A).

Example 0.3.4

Let A  {1, 2, 3}. Find P(A).


Solution. P(A) is a set of sets, all of which are subsets of A. So

P(A)  {∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.
30 0. Introduction and Preliminaries

Notice that while 2 ∈ A, it is wrong to write 2 ∈ P(A) since


none of the elements in P(A) are numbers! On the other hand, we
do have {2} ∈ P(A) because {2} ⊆ A.
What does a subset of P(A) look like? Notice that {2} ⊈ P(A)
because not everything in {2} is in P(A). But we do have {{2}} ⊆
P(A). The only element of {{2}} is the set {2} which is also an
element of P(A). We could take the collection of all subsets of
P(A) and call that P(P(A)). Or even the power set of that set of
sets of sets.

Another way to compare sets is by their size. Notice that in the example
above, A has 6 elements and B, C, and D all have 3 elements. The size of a
set is called the set’s cardinality . We would write |A|  6, |B|  3, and so
on. For sets that have a finite number of elements, the cardinality of the
set is simply the number of elements in the set. Note that the cardinality
of {1, 2, 3, 2, 1} is 3. We do not count repeats (in fact, {1, 2, 3, 2, 1} is
exactly the same set as {1, 2, 3}). There are sets with infinite cardinality,
such as N, the set of rational numbers (written Q), the set of even natural
numbers, and the set of real numbers (R). It is possible to distinguish
between different infinite cardinalities, but that is beyond the scope of this
text. For us, a set will either be infinite, or finite; if it is finite, the we can
determine its cardinality by counting elements.

Example 0.3.5

1. Find the cardinality of A  {23, 24, . . . , 37, 38}.


2. Find the cardinality of B  {1, {2, 3, 4}, ∅}.
3. If C  {1, 2, 3}, what is the cardinality of P(C)?

Solution.

1. Since 38 − 23  15, we can conclude that the cardinality of the


set is |A|  16 (you need to add one since 23 is included).
2. Here |B|  3. The three elements are the number 1, the set
{2, 3, 4}, and the empty set.
3. We wrote out the elements of the power set P(C) above, and
there are 8 elements (each of which is a set). So |P(C)|  8.
(You might wonder if there is a relationship between |A| and
|P(A)| for all sets A. This is a good question which we will
return to in Chapter 1.)
0.3. Sets 31

Operations On Sets
Is it possible to add two sets? Not really, however there is something
similar. If we want to combine two sets to get the collection of objects that
are in either set, then we can take the union of the two sets. Symbolically,

C  A ∪ B,

read, “C is the union of A and B,” means that the elements of C are exactly
the elements which are either an element of A or an element of B (or an
element of both). For example, if A  {1, 2, 3} and B  {2, 3, 4}, then
A ∪ B  {1, 2, 3, 4}.
The other common operation on sets is intersection. We write,

C A∩B

and say, “C is the intersection of A and B,” when the elements in C are
precisely those both in A and in B. So if A  {1, 2, 3} and B  {2, 3, 4},
then A ∩ B  {2, 3}.
Often when dealing with sets, we will have some understanding as
to what “everything” is. Perhaps we are only concerned with natural
numbers. In this case we would say that our universe is N. Sometimes
we denote this universe by U. Given this context, we might wish to
speak of all the elements which are not in a particular set. We say B is the
complement of A, and write,

BA

when B contains every element not contained in A. So, if our universe is


{1, 2, . . . , 9, 10}, and A  {2, 3, 5, 7}, then A  {1, 4, 6, 8, 9, 10}.
Of course we can perform more than one operation at a time. For
example, consider
A ∩ B.
This is the set of all elements which are both elements of A and not
elements of B. What have we done? We’ve started with A and removed
all of the elements which were in B. Another way to write this is the set
difference:
A ∩ B  A \ B.
It is important to remember that these operations (union, intersection,
complement, and difference) on sets produce other sets. Don’t confuse
these with the symbols from the previous section (element of and subset
of). A ∩ B is a set, while A ⊆ B is true or false. This is the same difference
as between 3 + 2 (which is a number) and 3 ≤ 2 (which is false).
32 0. Introduction and Preliminaries

Example 0.3.6

Let A  {1, 2, 3, 4, 5, 6}, B  {2, 4, 6}, C  {1, 2, 3} and D  {7, 8, 9}.


If the universe is U  {1, 2, . . . , 10}, find:
1. A ∪ B. 4. A ∩ D. 7. (D∩C)∪A ∩ B.
2. A ∩ B. 5. B ∪ C. 8. ∅ ∪ C.
3. B ∩ C. 6. A \ B. 9. ∅ ∩ C.

Solution.

1. A ∪ B  {1, 2, 3, 4, 5, 6}  A since everything in B is already


in A.
2. A ∩ B  {2, 4, 6}  B since everything in B is in A.
3. B ∩ C  {2} as the only element of both B and C is 2.
4. A ∩ D  ∅ since A and D have no common elements.
5. B ∪ C  {5, 7, 8, 9, 10}. First we find that B∪C  {1, 2, 3, 4, 6},
then we take everything not in that set.
6. A \ B  {1, 3, 5} since the elements 1, 3, and 5 are in A but not
in B. This is the same as A ∩ B.
7. (D ∩ C) ∪ A ∩ B  {1, 3, 5, 7, 8, 9, 10}. The set contains all
elements that are either in D but not in C (i.e., {7, 8, 9}), or
not in both A and B (i.e., {1, 3, 5, 7, 8, 9, 10}).
8. ∅ ∪ C  C since nothing is added by the empty set.
9. ∅ ∩ C  ∅ since nothing can be both in a set and in the empty
set.

Having notation like this is useful. We will often want to add or


remove elements from sets, and our notation allows us to do so precisely.

Example 0.3.7

If A  {1, 2, 3}, then we can describe the set we get by adding


the number 4 as A ∪ {4}. If we want to express the set we get by
removing the number 2 from A we can do so by writing A \ {2}.
Careful though. If you add an element to the set, you get a new
set! So you would have B  A ∪ {4} and then correctly say that B
contains 4, but A does not.
0.3. Sets 33

You might notice that the symbols for union and intersection slightly
resemble the logic symbols for “or” and “and.” This is no accident. What
does it mean for x to be an element of A ∪ B? It means that x is an element
of A or x is an element of B (or both). That is,

x ∈A∪B ⇔ x ∈ A ∨ x ∈ B.

Similarly,
x ∈A∩B ⇔ x ∈ A ∧ x ∈ B.
Also,
x∈A ⇔ ¬(x ∈ A).
which says x is an element of the complement of A if x is not an element
of A.
There is one more way to combine sets which will be useful for us: the
Cartesian product, A × B. This sounds fancy but is nothing you haven’t
seen before. When you graph a function in calculus, you graph it in
the Cartesian plane. This is the set of all ordered pairs of real numbers
(x, y). We can do this for any pair of sets, not just the real numbers with
themselves.
Put another way, A × B  {(a, b) : a ∈ A ∧ b ∈ B}. The first coordinate
comes from the first set and the second coordinate comes from the second
set. Sometimes we will want to take the Cartesian product of a set with
itself, and this is fine: A × A  {(a, b) : a, b ∈ A} (we might also write A2
for this set). Notice that in A × A, we still want all ordered pairs, not just
the ones where the first and second coordinate are the same. We can also
take products of 3 or more sets, getting ordered triples, or quadruples,
and so on.

Example 0.3.8

Let A  {1, 2} and B  {3, 4, 5}. Find A × B and A × A. How many


elements do you expect to be in B × B?
Solution. A × B  {(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), (2, 5)}.
A × A  A2  {(1, 1), (1, 2), (2, 1), (2, 2)}.
|B × B|  9. There will be 3 pairs with first coordinate 3, three
more with first coordinate 4, and a final three with first coordinate
5.

Venn Diagrams
There is a very nice visual tool we can use to represent operations on sets.
A Venn diagram displays sets as intersecting circles. We can shade the
region we are talking about when we carry out an operation. We can
34 0. Introduction and Preliminaries

also represent cardinality of a particular set by putting the number in the


corresponding region.

A B A B

C
Each circle represents a set. The rectangle containing the circles rep-
resents the universe. To represent combinations of these sets, we shade
the corresponding region. For example, we could draw A ∩ B as:

A B

Here is a representation of A ∩ B, or equivalently A \ B:

A B

A more complicated example is (B ∩ C) ∪ (C ∩ A), as seen below.


A B

C
Notice that the shaded regions above could also be arrived at in an-
other way. We could have started with all of C, then excluded the region
where C and A overlap outside of B. That region is (A ∩ C) ∩ B. So the
 
above Venn diagram also represents C ∩ (A ∩ C) ∩ B . So using just the
picture, we have determined that
 
(B ∩ C) ∪ (C ∩ A)  C ∩ (A ∩ C) ∩ B .
0.3. Sets 35

Exercises
1. Let A  {1, 4, 9} and B  {1, 3, 6, 10}. Find each of the following sets.
(a) A ∪ B.
(b) A ∩ B.
(c) A \ B.
(d) B \ A.
2. Find the least element of each of the following sets, if there is one.
(a) {n ∈ N : n 2 − 3 ≥ 2}.
(b) {n ∈ N : n 2 − 5 ∈ N}.
(c) {n 2 + 1 : n ∈ N}.
(d) {n ∈ N : n  k 2 + 1 for some k ∈ N}.
3. Find the following cardinalities:
(a) |A| when A  {4, 5, 6, . . . , 37}.
(b) |A| when A  {x ∈ Z : −2 ≤ x ≤ 100}.
(c) |A ∩ B| when A  {x ∈ N : x ≤ 20} and B  {x ∈ N : x is prime}.
4. Find a set of largest possible size that is a subset of both {1, 2, 3, 4, 5}
and {2, 4, 6, 8, 10}.
5. Find a set of smallest possible size that has both {1, 2, 3, 4, 5} and
{2, 4, 6, 8, 10} as subsets.
6. Let A  {n ∈ N : 20 ≤ n < 50} and B  {n ∈ N : 10 < n ≤ 30}.
Suppose C is a set such that C ⊆ A and C ⊆ B. What is the largest
possible cardinality of C?
7. Let A  {1, 2, 3, 4, 5} and B  {2, 3, 4}. How many sets C have the
property that C ⊆ A and B ⊆ C.
8. Let A  {1, 2, 3, 4, 5}, B  {3, 4, 5, 6, 7}, and C  {2, 3, 5}.
(a) Find A ∩ B.
(b) Find A ∪ B.
(c) Find A \ B.
(d) Find A ∩ (B ∪ C).
9. Let A  {x ∈ N : 4 ≤ x < 12} and B  {x ∈ N : x is even}.
(a) Find A ∩ B.
(b) Find A \ B.
36 0. Introduction and Preliminaries

10. Let A  {x ∈ N : 3 ≤ x ≤ 13}, B  {x ∈ N : x is even}, and


C  {x ∈ N : x is odd}.
(a) Find A ∩ B.
(b) Find A ∪ B.
(c) Find B ∩ C.
(d) Find B ∪ C.
11. Find an example of sets A and B such that A ∩ B  {3, 5} and A ∪ B 
{2, 3, 5, 7, 8}.
12. Find an example of sets A and B such that A ⊆ B and A ∈ B.
13. Recall Z  {. . . , −2, −1, 0, 1, 2, . . .} (the integers). Let Z+  {1, 2, 3, . . .}
be the positive integers. Let 2Z be the even integers, 3Z be the multi-
ples of 3, and so on.
(a) Is Z+ ⊆ 2Z? Explain.
(b) Is 2Z ⊆ Z+ ? Explain.
(c) Find 2Z ∩ 3Z. Describe the set in words, and using set notation.
(d) Express {x ∈ Z : ∃y ∈ Z(x  2y ∨ x  3y)} as a union or
intersection of two sets already described in this problem.
14. Let A2 be the set of all multiples of 2 except for 2. Let A3 be the set of
all multiples of 3 except for 3. And so on, so that A n is the set of all
multiples of n except for n, for any n ≥ 2. Describe (in words) the set
A2 ∪ A3 ∪ A4 ∪ · · ·.
15. Draw a Venn diagram to represent each of the following:
(a) A ∪ B
(b) (A ∪ B)
(c) A ∩ (B ∪ C)
(d) (A ∩ B) ∪ C
(e) A ∩ B ∩ C
(f) (A ∪ B) \ C
16. Describe a set in terms of A and B (using set notation) which has the
following Venn diagram:
A B
0.3. Sets 37

17. Let A  {a, b, c, d}. Find P(A).


18. Let A  {1, 2, . . . , 10}. How many subsets of A contain exactly one
element (i.e., how many singleton subsets are there)?
How many doubleton subsets (containing exactly two elements)
are there?
19. Let A  {1, 2, 3, 4, 5, 6}. Find all sets B ∈ P(A) which have the prop-
erty {2, 3, 5} ⊆ B.
20. Find an example of sets A and B such that |A|  4, |B|  5, and
|A ∪ B|  9.
21. Find an example of sets A and B such that |A|  3, |B|  4, and
|A ∪ B|  5.
22. Are there sets A and B such that |A|  |B|, |A∪B|  10, and |A∩B|  5?
Explain.
23. Let A  {2, 4, 6, 8}. Suppose B is a set with |B|  5.
(a) What are the smallest and largest possible values of |A ∪ B|?
Explain.
(b) What are the smallest and largest possible values of |A ∩ B|?
Explain.
(c) What are the smallest and largest possible values of |A × B|?
Explain.
24. Let X  {n ∈ N : 10 ≤ n < 20}. Find examples of sets with the
properties below and very briefly explain why your examples work.
(a) A set A ⊆ N with |A|  10 such that X \ A  {10, 12, 14}.
(b) A set B ∈ P(X) with |B|  5.
(c) A set C ⊆ P(X) with |C|  5.
(d) A set D ⊆ X × X with |D|  5
(e) A set E ⊆ X such that |E| ∈ E.
25. Let A, B and C be sets.
(a) Suppose that A ⊆ B and B ⊆ C. Does this mean that A ⊆ C?
Prove your answer. Hint: to prove that A ⊆ C you must prove
the implication, “for all x, if x ∈ A then x ∈ C.”
(b) Suppose that A ∈ B and B ∈ C. Does this mean that A ∈ C?
Give an example to prove that this does NOT always happen
(and explain why your example works). You should be able to
give an example where |A|  |B|  |C|  2.
38 0. Introduction and Preliminaries

26. In a regular deck of playing cards there are 26 red cards and 12
face cards. Explain, using sets and what you have learned about
cardinalities, why there are only 32 cards which are either red or a
face card.
27. Find an example of a set A with |A|  3 which contains only other
sets and has the following property: for all sets B ∈ A, we also have
B ⊆ A. Explain why your example works. (FYI: sets that have this
property are called transitive.)
28. Consider the sets A and B, where A  {3, |B|} and B  {1, |A|, |B|}.
What are the sets?
29. Explain why there is no set A which satisfies A  {2, |A|}.
30. Find all sets A, B, and C which satisfy the following.

A {1, |B| , |C|}


B {2, |A| , |C|}
C {1, 2, |A| , |B|}.
0.4. Functions 39

0.4 Functions
A function is a rule that assigns each input exactly one output. We call the
output the image of the input. The set of all inputs for a function is called
the domain. The set of all allowable outputs is called the codomain. We
would write f : X → Y to describe a function with name f , domain X and
codomain Y. This does not tell us which function f is though. To define
the function, we must describe the rule. This is often done by giving a
formula to compute the output for any input (although this is certainly
not the only way to describe the rule).
For example, consider the function f : N → N defined by f (x)  x 2 +3.
Here the domain and codomain are the same set (the natural numbers).
The rule is: take your input, multiply it by itself and add 3. This works
because we can apply this rule to every natural number (every element of
the domain) and the result is always a natural number (an element of the
codomain). Notice though that not every natural number is actually an
output (there is no way to get 0, 1, 2, 5, etc.). The set of natural numbers
that are outputs is called the range of the function (in this case, the range
is {3, 4, 7, 12, 19, 28, . . .}, all the natural numbers that are 3 more than a
perfect square).
The key thing that makes a rule a function is that there is exactly one
output for each input. That is, it is important that the rule be a good rule.
What output do we assign to the input 7? There can only be one answer
for any particular function.

Example 0.4.1

The following are all examples of functions:


1. f : Z → Z defined by f (n)  3n. The domain and codomain
are both the set of integers. However, the range is only the
set of integer multiples of 3.
2. g : {1, 2, 3} → {a, b, c} defined by g(1)  c, g(2)  a and
g(3)  a. The domain is the set {1, 2, 3}, the codomain is the
set {a, b, c} and the range is the set {a, c}. Note that g(2) and
g(3) are the same element of the codomain. This is okay since
each element in the domain still has only one output.
3. h : {1, 2, 3, 4} → N defined by the table:
x 1 2 3 4
h(x) 3 6 9 12
Here the domain is the finite set {1, 2, 3, 4} and to codomain
is the set of natural numbers, N. At first you might think this
40 0. Introduction and Preliminaries

function is the same as f defined above. It is absolutely not.


Even though the rule is the same, the domain and codomain
are different, so these are two different functions.

Example 0.4.2

Just because you can describe a rule in the same way you would
write a function, does not mean that the rule is a function. The
following are NOT functions.
1. f : N → N defined by f (n)  n2 . The reason this is not a
function is because not every input has an output. Where
does f send 3? The rule says that f (3)  32 , but 32 is not an
element of the codomain.
2. Consider the rule that matches each person to their phone
number. If you think of the set of people as the domain
and the set of phone numbers as the codomain, then this is
not a function, since some people have two phone numbers.
Switching the domain and codomain sets doesn’t help either,
since some phone numbers belong to multiple people (as-
suming some households still have landlines when you are
reading this).

Describing Functions
It is worth making a distinction between a function and its description.
The function is the abstract mathematical object that in some way exists
whether or not anyone ever talks about it. But when we do want to talk
about the function, we need a way to describe it. A particular function
can be described in multiple ways.
Some calculus textbooks talk about the Rule of Four, that every function
can be described in four ways: algebraically (a formula), numerically (a
table), graphically, or in words. In discrete math, we can still use any of
these to describe functions, but we can also be more specific since we are
primarily concerned with functions that have N or a finite subset of N as
their domain.
Describing a function graphically usually means drawing the graph of
the function: plotting the points on the plane. We can do this, and might
get a graph like the following for a function f : {1, 2, 3} → {1, 2, 3}.
0.4. Functions 41

It would be absolutely WRONG to connect the dots or try to fit them


to some curve. There are only three elements in the domain. A curve
would mean that the domain contains an entire interval of real numbers.
Here is another way to represent that same function:
1 2 3

1 2 3
This shows that the function f sends 1 to 2, 2 to 1 and 3 to 3: just
follow the arrows.
The arrow diagram used to define the function above can be very
helpful in visualizing functions. We will often be working with functions
with finite domains, so this kind of picture is often more useful than a
traditional graph of a function.
Note that for finite domains, finding an algebraic formula that gives
the output for any input is often impossible. Of course we could use a
piecewise defined function, like



 x+1 if x  1


f (x)  x − 1 if x  2 .



x if x  3

This describes exactly the same function as above, but we can all agree is
a ridiculous way of doing so.
Since we will so often use functions with small domains and codomains,
let’s adopt some notation to describe them. All we need is some clear way
of denoting the image of each element in the domain. In fact, writing a
table of values would work perfectly:
x 0 1 2 3 4
f (x) 3 3 2 4 1
We simplify this further by writing this as a matrix with each input
directly over its output:
 
0 1 2 3 4
f  .
3 3 2 4 1
42 0. Introduction and Preliminaries

Note this is just notation and not the same sort of matrix you would find
in a linear algebra class (it does not make sense to do operations with
these matrices, or row reduce them, for example).
One advantage of the two-line notation over the arrow diagrams is
that it is harder to accidentally define a rule that is not a function using
two-line notation.

Example 0.4.3

Which of the following diagrams represent a function? Let X 


{1, 2, 3, 4} and Y  {a, b, c, d}.
f :X→Y g:X→Y h:X→Y
1 2 3 4 1 2 3 4 1 2 3 4

a c a b c d a b c d
b d

Solution. f is a function. So is g. There is no problem with an


element of the codomain not being the image of any input, and
there is no problem with a from the codomain being the image of
both 2 and 3 from the domain. We could use our two-line notation
to write these as
   
1 2 3 4 1 2 3 4
f  g .
d a c b d a a b

However, h is NOT a function. In fact, it fails for two reasons.


First, the element 1 from the domain has not been mapped to any el-
ement from the codomain. Second, the element 2 from the domain
has been mapped to more than one element from the codomain (a
and c). Note that either one of these problems is enough to make a
rule not a function. In general, neither of the following mappings
are functions:

It might also be helpful to think about how you would write


the two-line notation for h. We would have something like:
 
1 2 3 4
h .
a, c? d b

There is nothing under 1 (bad) and we needed to put more than


one thing under 2 (very bad). With a rule that is actually a function,
the two-line notation will always “work”.
0.4. Functions 43

We will also be interested in functions with domain N. Here two-


line notation is no good, but describing the function algebraically is often
possible. Even tables are a little awkward, since they do not describe the
function completely. For example, consider the function f : N → N given
by the table below.
x 0 1 2 3 4 5 ...
f (x) 0 1 4 9 16 25 ...
Have I given you enough entries for you to be able to determine f (6)?
You might guess that f (6)  36, but there is no way for you to know this for
sure. Maybe I am being a jerk and intended f (6)  42. In fact, for every
natural number n, there is a function that agrees with the table above, but
for which f (6)  n.
Okay, suppose I really did mean for f (6)  36, and in fact, for the
rule that you think is governing the function to actually be the rule. Then
I should say what that rule is. f (n)  n 2 . Now there is no confusion
possible.
Giving an explicit formula that calculates the image of any element in
the domain is a great way to describe a function. We will say that these
explicit rules are closed formulas for the function.
There is another very useful way to describe functions whose domain
is N, that rely specifically on the structure of the natural numbers. We can
define a function recursively!

Example 0.4.4

Consider the function f : N → N given by f (0)  0 and f (n + 1) 


f (n) + 2n + 1. Find f (6).
Solution. The rule says that f (6)  f (5) + 11 (we are using 6  n + 1
so n  5). We don’t know what f (5) is though. Well, we know that
f (5)  f (4) + 9. So we need to compute f (4), which will require
knowing f (3), which will require f (2),. . . will it ever end?
Yes! In fact, this process will always end because we have N as
our domain, so there is a least element. And we gave the value of
f (0) explicitly, so we are good. In fact, we might decide to work up
to f (6) instead of working down from f (6):

f (1)  f (0) + 1  0+11


f (2)  f (1) + 3  1+34
f (3)  f (2) + 5  4+59
f (4)  f (3) + 7  9 + 7  16
f (5)  f (4) + 9  16 + 9  25
44 0. Introduction and Preliminaries

f (6)  f (5) + 11  25 + 11  36

It looks that this recursively defined function is the same as the


explicitly defined function f (n)  n 2 . Is it? Later we will prove
that it is.

Recursively defined functions are often easier to create from a “real


world” problem, because they describe how the values of the functions
are changing. However, this comes with a price. It is harder to calculate
the image of a single input, since you need to know the images of other
(previous) elements in the domain.
Recursively Defined Functions.
For a function f : N → N, a recursive definition consists of an
initial condition together with a recurrence relation. The initial
condition is the explicitly given value of f (0). The recurrence re-
lation is a formula for f (n + 1) in terms for f (n) (and possibly n
itself).

Example 0.4.5

Give recursive definitions for the functions described below.


1. f : N → N gives the number of snails in your terrarium n
years after you built it, assuming you started with 3 snails
and the number of snails doubles each year.
2. g : N → N gives the number of push-ups you do n days after
you started your push-ups challenge, assuming you could do
7 push-ups on day 0 and you can do 2 more push-ups each
day.
3. h : N → N defined by f (n)  n!. Recall that n!  1 · 2 · 3 · · · · ·
(n − 1) · n is the product of all numbers from 1 through n. We
also define 0!  1.

Solution.

1. The initial condition is f (0)  3. To get f (n + 1) we would


double the number of snails in the terrarium the previous
year, which is given by f (n). Thus f (n + 1)  2 f (n). The
full recursive definition contains both of these, and would be
written,
f (0)  3; f (n + 1)  2 f (n).
0.4. Functions 45

2. We are told that on day 0 you can do 7 push-ups, so f (0)  7.


The number of push-ups you can do on day n + 1 is 2 more
than the number you can do on day n, which is given by f (n).
Thus
f (0)  7; f (n + 1)  f (n) + 2.

3. Here f (0)  1. To get the recurrence relation, think about


how you can get f (n + 1)  (n + 1)! from f (n)  n!. If you
write out both of these as products, you see that (n + 1)! is
just like n! except you have one more term in the product, an
extra n + 1. So we have,

f (0)  1; f (n + 1)  (n + 1) · f (n).

Surjections, Injections, and Bijections


We now turn to investigating special properties functions might or might
not possess.
In the examples above, you may have noticed that sometimes there
are elements of the codomain which are not in the range. When this sort
of the thing does not happen, (that is, when everything in the codomain
is in the range) we say the function is onto or that the function maps the
domain onto the codomain. This terminology should make sense: the
function puts the domain (entirely) on top of the codomain. The fancy
math term for an onto function is a surjection, and we say that an onto
function is a surjective function.
In pictures:

Surjective Not surjective

Example 0.4.6

Which functions are surjective (i.e., onto)?


1. f : Z → Z defined by f (n)  3n.
 
1 2 3
2. g : {1, 2, 3} → {a, b, c} defined by g  .
c a a
3. h : {1, 2, 3} → {1, 2, 3} defined as follows:
46 0. Introduction and Preliminaries

1 2 3

1 2 3

Solution.

1. f is not surjective. There are elements in the codomain which


are not in the range. For example, no n ∈ Z gets mapped to
the number 1 (the rule would say that 13 would be sent to 1,
but 31 is not in the domain). In fact, the range of the function
is 3Z (the integer multiples of 3), which is not equal to Z.
2. g is not surjective. There is no x ∈ {1, 2, 3} (the domain) for
which g(x)  b, so b, which is in the codomain, is not in the
range. Notice that there is an element from the codomain
“missing” from the bottom row of the matrix.
3. h is surjective. Every element of the codomain is also in the
range. Nothing in the codomain is missed.

To be a function, a rule cannot assign a single element of the domain to


two or more different elements of the codomain. However, we have seen
that the reverse is permissible: a function might assign the same element
of the codomain to two or more different elements of the domain. When
this does not occur (that is, when each element of the codomain is the
image of at most one element of the domain) then we say the function
is one-to-one. Again, this terminology makes sense: we are sending at
most one element from the domain to one element from the codomain.
One input to one output. The fancy math term for a one-to-one function
is an injection. We call one-to-one functions injective functions.
In pictures:

Injective Not injective

Example 0.4.7

Which functions are injective (i.e., one-to-one)?


1. f : Z → Z defined by f (n)  3n.
0.4. Functions 47

 
1 2 3
2. g : {1, 2, 3} → {a, b, c} defined by g  .
c a a
3. h : {1, 2, 3} → {1, 2, 3} defined as follows:
1 2 3

1 2 3

Solution.

1. f is injective. Each element in the codomain is assigned to at


most one element from the domain. If x is a multiple of three,
then only x/3 is mapped to x. If x is not a multiple of 3, then
there is no input corresponding to the output x.
2. g is not injective. Both inputs 2 and 3 are assigned the output
a. Notice that there is an element from the codomain that
appears more than once on the bottom row of the matrix.
3. h is injective. Each output is only an output once.

Be careful: “surjective” and “injective” are NOT opposites. You can


see in the two examples above that there are functions which are surjective
but not injective, injective but not surjective, both, or neither. In the case
when a function is both one-to-one and onto (an injection and surjection),
we say the function is a bijection, or that the function is a bijective
function.
To illustrate the contrast between these two properties, consider a
more formal definition of each, side by side.
Injective vs Surjective.
A function is injective provided every element of the codomain is
the image of at most one element from the domain.
A function is surjective provided every element of the codomain
is the image of at least one element from the domain.

Notice both properties are determined by what happens to elements of


the codomain: they could be repeated as images or they could be “missed”
(not be images). Injective functions do not have repeats but might or might
not miss elements. Surjective functions do not miss elements, but might
48 0. Introduction and Preliminaries

or might not have repeats. The bijective functions are those that do not
have repeats and do not miss elements.

Image and Inverse Image


When discussing functions, we have notation for talking about an element
of the domain (say x) and its corresponding element in the codomain (we
write f (x), which is the image of x). Sometimes we will want to talk about
all the elements that are images of some subset of the domain. It would
also be nice to start with some element of the codomain (say y) and talk
about which element or elements (if any) from the domain it is the image
of. We could write “those x in the domain such that f (x)  y,” but this is
a lot of writing. Here is some notation to make our lives easier.
To address the first situation, what we are after is a way to describe
the set of images of elements in some subset of the domain. Suppose
f : X → Y is a function and that A ⊆ X is some subset of the domain
(possibly all of it). We will use the notation f (A) to denote the image of
A under f , namely the set of elements in Y that are the image of elements
from A. That is, f (A)  { f (a) ∈ Y : a ∈ A}.
We can do this in the other direction as well. We might ask which
elements of the domain get mapped to a particular set in the codomain.
Let f : X → Y be a function and suppose B ⊆ Y is a subset of the
codomain. Then we will write f −1 (B) for the inverse image of B under f ,
namely the set of elements in X whose image are elements in B. In other
words, f −1 (B)  {x ∈ X : f (x) ∈ B}.
Often we are interested in the element(s) whose image is a particular
element y of in the codomain. The notation above works: f −1 ({ y}) is the
set of all elements in the domain that f sends to y. It makes sense to think
of this as a set: there might not be anything sent to y (if y is not in the
range), in which case f −1 ({ y})  ∅. Or f might send multiple elements
to y (if f is not injective). As a notational convenience, we usually drop
the set braces around the y and write f inf(y) instead for this set.
WARNING: f −1 (y) is not an inverse function! Inverse functions only
exist for bijections, but f −1 (y) is defined for any function f . The point:
f −1 (y) is a set, not an element of the domain. This is just sloppy notation
for f −1 ({ y}). To help make this distinction, we would call f −1 (y) the
complete inverse image of y under f . It is not the image of y under f −1
(since the function f −1 might not exist).
0.4. Functions 49

Example 0.4.8

Consider the function f : {1, 2, 3, 4, 5, 6} → {a, b, c, d} given by


 
1 2 3 4 5 6
f  .
a a b b b c

Find f ({1, 2, 3}), f inf({a, b}), and f −1 (d).


Solution. f ({1, 2, 3})  {a, b} since a and b are the elements in the
codomain to which f sends 1 and 2.
f inf({a, b})  {1, 2, 3, 4, 5} since these are exactly the elements
that f sends to a and b.
f inf(d)  ∅ since d is not in the range of f .

Example 0.4.9

Consider the function g : Z → Z defined by g(n)  n 2 + 1. Find


g(1) and g({1}). Then find g −1 (1), g −1 (2), and g −1 (3).
Solution. Note that g(1) , g({1}). The first is an element: g(1)  2.
The second is a set: g({1})  {2}.
To find g −1 (1), we need to find all integers n such that n 2 +1  1.
Clearly only 0 works, so g −1 (1)  {0} (note that even though there
is only one element, we still write it as a set with one element in it).
To find g −1 (2), we need to find all n such that n 2 + 1  2. We
see g −1 (2)  {−1, 1}.
Finally, if n 2 + 1  3, then we are looking for an n such that
n 2  2. There are no such integers so g −1 (3)  ∅.


Since f −1 (y) is a set, it makes sense to ask for f −1 (y) , the number of
elements in the domain which map to y.

Example 0.4.10

Find a function f : {1, 2, 3, 4, 5} → N such that f −1 (7)  5.
Solution. There is only one such function. We need five elements
of the domain to map to the number 7 ∈ N. Since there are only
five elements in the domain, all of them must map to 7. So
 
1 2 3 4 5
f  .
7 7 7 7 7
50 0. Introduction and Preliminaries

Function Definitions.
Here is a summary of all the main concepts and definitions we use when
working with functions.

• A function is a rule that assigns each element of a set, called the


domain, to exactly one element of a second set, called the codomain.
• Notation: f : X → Y is our way of saying that the function is called
f , the domain is the set X, and the codomain is the set Y.
• To specify the rule for a function with small domain, use two-line
notation by writing a matrix with each output directly below its
corresponding input, as in:
 
1 2 3 4
f  .
2 1 3 1

• f (x)  y means the element x of the domain (input) is assigned to


the element y of the codomain. We say y is an output. Alternatively,
we call y the image of x under f .
• The range is a subset of the codomain. It is the set of all elements
which are assigned to at least one element of the domain by the
function. That is, the range is the set of all outputs.
• A function is injective (an injection or one-to-one) if every element
of the codomain is the image of at most one element from the
domain.
• A function is surjective (a surjection or onto) if every element of
the codomain is the image of at least one element from the domain.
• A bijection is a function which is both an injection and surjection.
In other words, if every element of the codomain is the image of
exactly one element from the domain.
• The image of an element x in the domain is the element y in the
codomain that x is mapped to. That is, the image of x under f is
f (x).
• The complete inverse image of an element y in the codomain, writ-
ten f −1 (y), is the set of all elements in the domain which are assigned
to y by the function.
• The image of a subset A of the domain is the set f (A)  { f (a) ∈ Y :
a ∈ A}.
• The inverse image of a a subset B of the codomain is the set f −1 (B) 
{x ∈ X : f (x) ∈ B}.
0.4. Functions 51

Exercises
1. Consider the function f : {1, 2, 3, 4} → {1, 2, 3, 4} given by
 
1 2 3 4
f (n)  .
4 1 3 4

(a) Find f (1).


(b) Find an element n in the domain such that f (n)  1.
(c) Find an element n of the domain such that f (n)  n.
(d) Find an element of the codomain that is not in the range.
2. The following functions all have {1, 2, 3, 4, 5} as both their domain
and codomain. For each, determine whether it is (only) injective,
(only) surjective, bijective, or neither injective nor surjective.
 
1 2 3 4 5
(a) f  .
3 3 3 3 3
 
1 2 3 4 5
(b) f  .
2 3 1 5 4
(c) f (x)  6 − x.
(
x/2 if x is even
(d) f (x)  .
(x + 1)/2 if x is odd

3. The following functions all have domain {1, 2, 3, 4, 5} and codomain


{1, 2, 3}. For each, determine whether it is (only) injective, (only) sur-
jective, bijective, or neither injective nor surjective.
 
1 2 3 4 5
(a) f  .
1 2 1 2 1
 
1 2 3 4 5
(b) f  .
1 2 3 1 2
(
x if x ≤ 3
(c) f (x)  .
x−3 if x > 3

4. The following functions all have domain {1, 2, 3, 4} and codomain


{1, 2, 3, 4, 5}. For each, determine whether it is (only) injective, (only)
surjective, bijective, or neither injective nor surjective.
 
1 2 3 4
(a) f  .
1 2 5 4
52 0. Introduction and Preliminaries

 
1 2 3 4
(b) f  .
1 2 3 2
(c) f (x) gives the number of letters in the English word for the
number x. For example, f (1)  3 since “one” contains three
letters.
5. Write out all functions f : {1, 2, 3} → {a, b} (using two-line notation).
How many functions are there?
How many are injective?
How many are surjective?
How many are bijective?
6. Write out all functions f : {1, 2} → {a, b, c} (in two-line notation).
How many functions are there?
How many are injective?
How many are surjective?
How many are bijective?
7. Consider the function f : {1, 2, 3, 4, 5} → {1, 2, 3, 4} given by the table
below:
x 1 2 3 4 5
f (x) 3 2 4 1 2

(a) Is f injective? Explain.


(b) Is f surjective? Explain.
(c) Write the function using two-line notation.
8. Consider the function f : {1, 2, 3, 4} → {1, 2, 3, 4} given by the graph
below.
f (x)
4

1 2 3 4 x

(a) Is f injective? Explain.


(b) Is f surjective? Explain.
(c) Write the function using two-line notation.
0.4. Functions 53

9. Consider the function f : N → N given recursively by f (0)  1 and


f (n + 1)  2 · f (n). Find f (10).
10. Suppose f : N → N satisfies the recurrence f (n + 1)  f (n) + 3.
Note that this is not enough information to define the function, since
we don’t have an initial condition. For each of the initial conditions
below, find the value of f (5).
(a) f (0)  0.
(b) f (0)  1.
(c) f (0)  2.
(d) f (0)  100.
11. Suppose f : N → N satisfies the recurrence relation
( f (n)
if f (n) is even
f (n + 1)  2
.
3 f (n) + 1 if f (n) is odd

Note that with the initial condition f (0)  1, the values of the function
are: f (1)  4, f (2)  2, f (3)  1, f (4)  4, and so on, the images cy-
cling through those three numbers. Thus f is NOT injective (and also
certainly not surjective). Might it be under other initial conditions?3
(a) If f satisfies the initial condition f (0)  5, is f injective? Explain
why or give a specific example of two elements from the domain
with the same image.
(b) If f satisfies the initial condition f (0)  3, is f injective? Explain
why or give a specific example of two elements from the domain
with the same image.
(c) If f satisfies the initial condition f (0)  27, then it turns out that
f (105)  10 and no two numbers less than 105 have the same
image. Could f be injective? Explain.
(d) Prove that no matter what initial condition you choose, the
function cannot be surjective.

12. For each function given below, determine whether or not the function
is injective and whether or not the function is surjective.
(a) f : N → N given by f (n)  n + 4.
(b) f : Z → Z given by f (n)  n + 4.
3It turns out this is a really hard question to answer in general. The Collatz conjecture is
that no matter what the initial condition is, the function will eventually produce 1 as an
output. This is an open problem in mathematics: nobody knows the answer.
54 0. Introduction and Preliminaries

(c) f : Z → Z given by f (n)  5n − 8.


(
n/2 if n is even
(d) f : Z → Z given by f (n) 
(n + 1)/2 if n is odd.

13. Let A  {1, 2, 3, . . . , 10}. Consider the function f : P(A) → N given


by f (B)  |B|. That is, f takes a subset of A as an input and outputs
the cardinality of that set.
(a) Is f injective? Prove your answer.
(b) Is f surjective? Prove your answer.
(c) Find f −1 (1).
(d) Find f −1 (0).
(e) Find f −1 (12).
14. Let X  {n ∈ N : 0 ≤ n ≤ 999} be the set of all numbers with three
or fewer digits. Define the function f : X → N by f (abc)  a + b + c,
where a, b, and c are the digits of the number in X (write numbers less
than 100 with leading 0’s to make them three digits). For example,
f (253)  2 + 5 + 3  10.
(a) Let A  {n ∈ X : 113 ≤ n ≤ 122}. Find f (A).
(b) Find f −1 ({1, 2})
(c) Find f −1 (3).
(d) Find f −1 (28).
(e) Is f injective? Explain.
(f) Is f surjective? Explain.

15. Consider the set N2  N × N, the set of all ordered pairs (a, b) where
a and b are natural numbers. Consider a function f : N2 → N given
by f ((a, b))  a + b.
(a) Let A  {(a, b) ∈ N2 : a, b ≤ 10}. Find f (A).
(b) Find f −1 (3) and f −1 ({0, 1, 2, 3}).
(c) Give geometric descriptions of f −1 (n) and f −1 ({0, 1, . . . , n}) for
any n ≥ 1.

(d) Find f −1 (8) and f −1 ({0, 1, . . . , 8}) .

16. Let f : X → Y be some function. Suppose 3 ∈ Y. What can you say


about f −1 (3) if you know,
(a) f is injective? Explain.
0.4. Functions 55

(b) f is surjective? Explain.


(c) f is bijective? Explain.

17. Find a set X and a function f : X → N so that f −1 (0) ∪ f −1 (1)  X.


18. What can you deduce about the sets X and Y if you know,
(a) there is an injective function f : X → Y? Explain.
(b) there is a surjective function f : X → Y? Explain.
(c) there is a bijective function f : X → Y? Explain.
19. Suppose f : X → Y is a function. Which of the following are possible?
Explain.
(a) f is injective but not surjective.
(b) f is surjective but not injective.
(c) |X|  |Y| and f is injective but not surjective.
(d) |X|  |Y| and f is surjective but not injective.
(e) |X|  |Y|, X and Y are finite, and f is injective but not surjective.
(f) |X|  |Y|, X and Y are finite, and f is surjective but not injective.
20. Let f : X → Y and g : Y → Z be functions. We can define the
composition of f and g to be the function g ◦ f : X → Z for which
the image of each x ∈ X is g( f (x)). That is, plug x into f , then plug
the result into g (just like composition in algebra and calculus).
(a) If f and g are both injective, must g ◦ f be injective? Explain.
(b) If f and g are both surjective, must g ◦ f be surjective? Explain.
(c) Suppose g ◦ f is injective. What, if anything, can you say about
f and g? Explain.
(d) Suppose g ◦ f is surjective. What, if anything, can you say about
f and g? Explain.
(
n+1 if n is even
21. Consider the function f : Z → Z given by f (n) 
n−3 if n is odd.
(a) Is f injective? Prove your answer.
(b) Is f surjective? Prove your answer.
22. At the end of the semester a teacher assigns letter grades to each of
her students. Is this a function? If so, what sets make up the domain
and codomain, and is the function injective, surjective, bijective, or
neither?
56 0. Introduction and Preliminaries

23. In the game of Hearts, four players are each dealt 13 cards from a
deck of 52. Is this a function? If so, what sets make up the domain
and codomain, and is the function injective, surjective, bijective, or
neither?
24. Seven players are playing 5-card stud. Each player initially receives 5
cards from a deck of 52. Is this a function? If so, what sets make up
the domain and codomain, and is the function injective, surjective,
bijective, or neither?
25. Consider the function f : N → N that gives the number of handshakes
that take place in a room of n people assuming everyone shakes hands
with everyone else. Give a recursive definition for this function.
26. Let f : X → Y be a function and A ⊆ X be a finite subset of the
domain.
What can you say about the relationship between |A| and
f (A) ? Consider both the general case and what happens when you
know f is injective, surjective, or bijective.
27. Let f : X → Y be a function and B ⊆ Y be a finite subset of the
codomain.
What can you say about the relationship between |B| and
f −1 (B) ? Consider both the general case and what happens when you
know f is injective, surjective, or bijective.
28. Let f : X → Y be a function, A ⊆ X and B ⊆ Y.

(a) Is f −1 f (A)  A? Always, sometimes, never? Explain.

(b) Is f f −1 (B)  B? Always, sometimes, never? Explain.
(c) If one or both of the above do not always hold, is there some-
thing else you can say? Will equality always hold for particular
types of functions? Is there some other relationship other than
equality that would always hold? Explore.
29. Let f : X → Y be a function and A, B ⊆ X be subsets of the domain.
(a) Is f (A ∪ B)  f (A) ∪ f (B)? Always, sometimes, or never?
Explain.
(b) Is f (A ∩ B)  f (A) ∩ f (B)? Always, sometimes, or never?
Explain.
30. Let f : X → Y be a function and A, B ⊆ Y be subsets of the codomain.
(a) Is f −1 (A ∪ B)  f −1 (A) ∪ f −1 (B)? Always, sometimes, or never?
Explain.
(b) Is f −1 (A ∩ B)  f −1 (A) ∩ f −1 (B)? Always, sometimes, or never?
Explain.

You might also like