maths.free › Discrete Math & Logic › 6. Discrete Structures Revisited › Sets
Sets
Note that this section contains a lot of detail on what we can say about sets. If you have never seen anything about unions or Venn diagrams, it is worth reading this carefully.
Sets
Note that this section contains a lot of detail on what we can say about sets. If you have never seen anything about unions or Venn diagrams, it is worth reading this carefully.
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 an 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 \in \{a, b, c\}\].
The symbol \(\in\) 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 \not\in \{a, b, c\}\].
Be warned: We write \(x \in 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\}, \emptyset\}\].
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 \(\emptyset = \{ \}\), 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 \notin A\). Similarly, consider the set \(B = \{1,b\}\). Even though the elements of \(B\) are elements of \(A\), we cannot say that the set \(B\) is one of the elements of \(A\). Therefore \(B \notin 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, \ldots\}\], but this is a little imprecise. A better way would be \[A = \{x \in \N \st \text{ there exists }n \in \N \text{ such that } x = 2 n\}\].
Note: Sometimes mathematicians use \(|\) or \(\backepsilon\) for the such that symbol instead of the colon. Also, there is a fairly even split between mathematicians about whether \(0\) is an element of the natural numbers, so be careful there.
Condensed — the full section is in Levin, Discrete Mathematics: An Open Introduction.
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 \ne 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 \subset B\) or \(A \subseteq 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 \(\subseteq\). This is analogous to the difference between \(\lt\) and \(\le\).
Example
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.
- \(A \subset B\)
- \(B \subset A\)
- \(B \in C\)
- \(\emptyset \in A\)
- \(\emptyset \subset A\)
- \(A \lt D\)
- \(3 \in C\)
- \(3 \subset C\)
- \(\{3\} \subset C\)
Solution
False. For example, \(1\in A\) but \(1 \notin B\).
True. Every element in \(B\) is an element in \(A\).
False. The elements in \(C\) are 1, 2, and 3. The set \(B\) is not equal to 1, 2, or 3.
False. \(A\) has exactly 6 elements, and none of them are the empty set.
True. Everything in the empty set (nothing) is also an element of \(A\). Notice that the empty set is a subset of every set.
Meaningless. A set cannot be less than another set.
True. \(3\) is one of the elements of the set \(C\).
Meaningless. \(3\) is not a set, so it cannot be a subset of another set.
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\).
Condensed — the full section is in Levin, Discrete Mathematics: An Open Introduction.
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 \cup B\], read, \(C\) is the union of \(A\) and \(B\), means that the elements of \(C\) are exactly the elements that 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 \cup B = \{1, 2, 3, 4\}\).
The other common operation on sets is intersection. We write, \[C = A \cap 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 \cap 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 that are not in a particular set. We say \(B\) is the complement of \(A\), and write, \[B = \bar A\] when \(B\) contains every element not contained in \(A\). So, if our universe is \(\{1, 2,\ldots, 9, 10\}\), and \(A = \{2, 3, 5, 7\}\), then \(\bar A = \{1, 4, 6, 8, 9,10\}\).
Of course we can perform more than one operation at a time. For example, consider \[A \cap \bar B\].
This is the set of all elements that 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 that were in \(B\). Another way to write this is the set difference: \[A \cap \bar B = A \setminus 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 \cap B\) is a set, while \(A \subseteq B\) is true or false. This is the same difference as between \(3 + 2\) (which is a number) and \(3 \le 2\) (which is false).
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.
Condensed — the full section is in Levin, Discrete Mathematics: An Open Introduction.
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 also represent the cardinality of a particular set by putting the number in the corresponding region.
Each circle represents a set. The rectangle containing the circles represents the universe. To represent combinations of these sets, we shade the corresponding region. For example, we could draw \(A \cap B\) as:
Here is a representation of \(A \cap \bar B\), or equivalently \(A \setminus B\):
A more complicated example is \((B \cap C) \cup (C \cap \bar A)\), as seen below.
Notice that the shaded regions above could also be arrived at in another way. We could have started with all of \(C\) and then excluded the region where \(C\) and \(A\) overlap outside of \(B\). That region is \((A \cap C) \cap \bar B\). So the above Venn diagram also represents \(C \cap \bar{\left((A\cap C)\cap \bar B\right)}\). So using just the picture, we have determined that \[(B \cap C) \cup (C \cap \bar A) = C \cap \bar{\left((A\cap C)\cap \bar B\right)}\].
Practice (19)
Try each one on paper first. Reveal the answer to check; verified ones can be opened in the solver for every step.
-
Let \(A = \{x \in \mathbb{N} : 3 \le x \le 13\}\), \(B = \{x \in \mathbb{N} : x \mbox{ is even} \}\), and \(C = \{x \in \mathbb{N} : x \mbox{ is odd} \}\).
Find \(A \cap B\).
Find \(A \cup B\).
Find \(B \cap C\).
Find \(B \cup C\).
-
Find an example of sets \(A\) and \(B\) such that \(A\cap B = \{3, 5\}\) and \(A \cup B = \{2, 3, 5, 7, 8\}\).
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
For example, \(A = \{2,3,5,7,8\}\) and \(B = \{3,5\}\) .
-
Find an example of sets \(A\) and \(B\) such that \(A \subseteq B\) and \(A \in B\).
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
For example, \(A = \{1,2,3\}\) and \(B = \{1,2,3,4,5,\{1,2,3\}\}\)
-
Recall \(\Z = \{\ldots,-2,-1,0, 1,2,\ldots\}\) (the integers). Let \(\Z^+ = \{1, 2, 3, \ldots\}\) be the positive integers. Let \(2\Z\) be the even integers, \(3\Z\) be the multiples of 3, and so on.
Is \(\Z^+ \subseteq 2\Z\)? Explain.
Is \(2\Z \subseteq \Z^+\)? Explain.
Find \(2\Z \cap 3\Z\). Describe the set in words, and using set notation.
Express \(\{x \in \Z \st \exists y\in \Z (x = 2y \vee x = 3y)\}\) as a union or intersection of two sets already described in this problem.
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
No.
No.
- \(2\Z \cap 3\Z\)\(2\Z \cap 3\Z = \{x \in \Z \st \exists y\in \Z(x = 6y)\}\)
- \(2\Z \cup 3\Z\)
-
Let \(A_2\) be the set of all multiples of 2 except for \(2\). Let \(A_3\) 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 \ge 2\). Describe (in words) the set \(\bar{A_2 \cup A_3 \cup A_4 \cup \cdots}\).
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
Hint:
It might help to think about what the union \(A_2 \cup A_3\) is first. Then think about what numbers are not in that union. What will happen when you also include \(A_5\)?
-
Draw a Venn diagram to represent each of the following:
- \(A \cup \bar B\)
- \(\bar{(A \cup B)}\)
- \(A \cap (B \cup C)\)
- \((A \cap B) \cup C\)
- \(\bar A \cap B \cap \bar C\)
- \((A \cup B) \setminus C\)
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
\(A \cup \bar B\):
\(\bar{(A \cup B)}\):
\(A \cap (B \cup C)\):
\((A \cap B) \cup C\):
\(\bar A \cap B \cap \bar C\):
\((A \cup B) \setminus C\):
-
Describe a set in terms of \(A\) and \(B\) (using set notation) which has the following Venn diagram:
-
Let \(A = \{a, b, c, d\}\). Find \(\pow(A)\).
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
Hint:
We are looking for a set containing 16 sets.
\[\begin{aligned}\pow(A) = \{\amp \emptyset, \{a\}, \{b\}, \{c\}, \{d\}, \{a,b\}, \{a,c\}, \{a,d\}, \{b,c\}, \{b,d\}, \\ \amp \{c,d\} \{a,b,c\}, \{a,b,d\}, \{a,c,d\}, \{b,c,d\}, \{a,b,c,d\}\}\end{aligned}\].
-
Let \(A = \{1,2,3,4,5,6\}\). Find all sets \(B \in \pow(A)\) which have the property \(\{2,3,5\} \subseteq B\).
-
Find an example of sets \(A\) and \(B\) such that \(|A| = 4\), \(|B| = 5\), and \(|A \cup B| = 9\).
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
For example, \(A = \{1,2,3,4\}\) and \(B = \{5,6,7,8,9\}\) gives \(A \cup B = \{1,2,3,4,5,6,7,8,9\}\).
-
Find an example of sets \(A\) and \(B\) such that \(|A| = 3\), \(|B| = 4\), and \(|A \cup B| = 5\).
-
Are there sets \(A\) and \(B\) such that \(|A| = |B|\), \(|A\cup B| = 10\), and \(|A\cap B| = 5\)? Explain.
-
Let \(X = \{n \in \N \st 10 \le n \lt 20\}\). Find examples of sets with the properties below and very briefly explain why your examples work.
A set \(A \subseteq \N\) with \(|A| = 10\) such that \(X \setminus A = \{10, 12, 14\}\).
A set \(B \in \pow(X)\) with \(|B| = 5\).
A set \(C \subseteq \pow(X)\) with \(|C| = 5\).
A set \(D \subseteq X \times X\) with \(|D| = 5\)
A set \(E \subseteq X\) such that \(|E| \in E\).
-
Let \(A\), \(B\), and \(C\) be sets.
Suppose that \(A \subseteq B\) and \(B \subseteq C\). Does this mean that \(A \subseteq C\)? Prove your answer. Hint: To prove that \(A \subseteq C\), you must prove the implication, For all \(x\), if \(x \in A\), then \(x \in C\).
Suppose that \(A \in B\) and \(B \in C\). Does this mean that \(A \in 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\).
-
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.
-
Find an example of a set \(A\) with \(|A| = 3\) which contains only other sets and has the following property: For all sets \(B \in A\), we also have \(B \subseteq A\). Explain why your example works. (FYI: Sets that have this property are called transitive.)
-
Consider the sets \(A\) and \(B\), where \(A = \{3, |B|\}\) and \(B = \{1, |A|, |B|\}\). What are the sets?
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
We need to be a little careful here. If \(B\) contains 3 elements, then \(A\) contains just the number 3 (listed twice). So that would make \(|A| = 1\), which would make \(B = \{1, 3\}\), which only has 2 elements. Thus \(|B| \ne 3\). This means that \(|A| = 2\), so \(B\) contains at least the elements 1 and 2. Since \(\card{B} \ne 3\), we must have \(\card{B} = 2\), which agrees with the definition of \(B\).
Therefore it must be that \(A = \{2,3\}\) and \(B = \{1, 2\}\)
-
Explain why there is no set \(A\) which satisfies \(A = \{2, \card{A}\}\).
ଉତ୍ତରକୁ ଖୋଲନ୍ତୁ
Hint:
It looks like you should be able to define the set \(A\) like this. But consider the two possible values for \(\card{A}\).
-
Find all sets \(A\), \(B\), and \(C\) which satisfy the following. \[\begin{aligned}A = \amp \{1, \card{B}, \card{C}\} \\ B = \amp \{2, \card{A}, \card{C}\} \\ C = \amp \{1, 2, \card{A}, \card{B}\}\end{aligned}\] .
Symbols used here
x belongs to A; every element of A is in B.
In either; in both; in A but not B.
Quantifiers: every x; at least one x.
Logical connectives.
Inequalities that allow equality; < and > exclude it.
The two sides are different.
n × (n−1) × … × 1; the number of orderings of n things. 0! = 1.
Number of k-element subsets of n things: n!/(k!(n−k)!).
Add a_k for k = 1 up to n.
The set with no elements; the number of elements of A.
Marks the point where the statement has been established.
n divides a − b; a and b have the same remainder.
Grows no faster than n² (up to a constant), for large n.
What is left after dividing a by n.
Questions people ask
What makes mathematics "discrete"?
It deals with separate, countable objects — integers, graphs, statements — rather than continuous quantities. No limits, no infinitesimals; instead induction, counting and logic.
How does a proof by induction work?
Show the statement for the first case, then show that whenever it holds for n it holds for n + 1. Like dominoes: the first falls, and each knocks over the next.
ନିଜେ ଚେଷ୍ଟାକରନ୍ତୁ
Parts of this page are adapted from Levin, Discrete Mathematics: An Open Introduction (CC BY-SA 4.0). Condensed and re-explained here; errors are ours.
ଅଧିକ Discrete Math & Logic
Truth tablesSums and inductionProof by inductionAlgorithms and growth of functions