Sets

A set is a very basic structure in maths, similar to lists or arrays in a programming language. To talk about sets we use a specific language with many different symbols. It is important for you to understand this language. So, what is a set? A set is a list or collection of things. These things are called elements. For example, let's say I have a coin, a key and a hanky in my pocket. The list

{coin, key, hanky}\{\text{coin, key, hanky}\}

forms a set with the elements coin, key, and hanky. As you can see above, we use curly braces around the list of elements. This is important for saying "we treat this list as a set".

If we want to give the set a name, like AA, we write

A={coin, key, hanky}A = \{\text{coin, key, hanky}\}

(say: AA is the set with the elements coin, key and hanky) and if we want to represent the set with a picture, we use a Venn-diagram, which simply is a circle which includes the elements in the list:

Sets have two important properties:

Definition 1
  1. The order of the elements is not important: so we regard the two sets {coin, key, hanky}\{\text{coin, key, hanky}\} and {key, hanky, coin}\{\text{key, hanky, coin}\} as equal. They are the same set.
  2. The number of times an element occurs is also not important. So we regard the two sets {coin, key, hanky}\{\text{coin, key, hanky}\} and {key, coin, coin, key, key, hanky, coin}\{\text{key, coin, coin, key, key, hanky, coin}\} as equal. They are the same set. If two sets AA and BB are equal, we write A=B\boxed{A=B}
Exercise 1

Which sets are equal, that is, A=BA=B?

  1. A={1,4,5,4},B={5,4,2}A=\{1,4,5,4\}, B=\{5,4,2\}

  2. A={red,2,big,house},B={house,big,2,2,2}A=\{\text{red},-2,\text{big}, \text{house}\}, B=\{\text{house}, \text{big}, -2, -2, -2\}

  3. A={1,4,5,4},B={1,1,4,5,5,5}A=\{1,4,5,4\}, B=\{1,1,4,5,5,5\}

Solution
  1. no
  2. no
  3. yes
Note 1

In Maths, we are also using lists where the order is important. Such lists are called tuples, and round brackets (...) are used. For example, the location of a point in the plane are described using a tuple of coordinates, e.g.

(1,2)(1,2)

Clearly, the location (2,1)(2,1) is different from (1,2)(1,2), so we cannot use the set {1,2}\{1,2\} to describe the location of the point.

Universal sets and the empty set

A set always lives in a 'universe' of things. For example, the set

A={1,2,3}A=\{1,2,3\}

lives in the universe of natural numbers

{1,2,3,4,5,...}\{1,2,3,4,5,...\}

and the set

{coin, key, hanky}\{\text{coin, key, hanky}\}

lives in the universe of 'objects we often carry with us'. These 'universes' are also sets, which we call universal sets, and is typically denoted by UU. In a Venn-diagram, the universal set is drawn as a rectangle

The diagram above shows the set A={1,2,3}A=\{1,2,3\} which lives in the universal set U={1,2,3,4,5,6,7,8,9}U=\{1,2,3,4,5,6,7,8,9\}. Note that set AA can live in many possible universal sets, for example U={1,2,3,4,5,6}U=\{1,2,3,4,5,6\} is another one. Which one we choose is often not important, and if it is, we have to specify exactly which one we mean. Later on, this will hopefully become more clear.

The empty set is the set that contains no elements, and we write

{} or ϕ\boxed{\{\} \text{ or }\phi}

Is element of

Consider a set AA which lives in some universe UU, and some element uu which is in UU. Now, uu either is in AA, or not. If it is in AA, we write

uA\boxed{u \isin A}

(say: uu is an element of AA). If uu is not in AA, we write

uA\boxed{u \notin A}

(say: uu is not an element of AA).

Exercise 2

Which of these statements are correct? Assume that the universal set is

U={1,2,3,4,5,6,7,8,9}U=\{1,2,3,4,5,6,7,8,9\}

(but this is not really important here).

  1. 1{2,3,4}1\in \{2,3,4\}

  2. 3{4,3,3,2,1}3\in \{4,3,3,2,1\}

  3. {3}{1,2,3,4,5}\{3\} \in \{1,2,3,4,5\}

Solution
  1. no
  2. yes
  3. no, because {3}\{3\} is not in {1,2,3,4,5}\{1,2,3,4,5\}. The element {3}\{3\} is in {1,2,{3},4,5}\{1,2,\{3\},4,5\}.

Ways of defining sets

Basically, there are two methods how we can describe a set. Either we simply write down all the elements in the set - this is called the explicit method. Or we give a rule or description that makes clear which elements have to be in the set - this is called the implicit method.

Here are some examples:

  1. A={1,2,3,5}A=\{1,2,3,5\} is an explicit method
  2. B=B=\, "natural numbers from 11 to 55" is an implicit method.
  3. C=C=\, "the solutions of the equation x2=4x^2=4" is an implicit method.
  4. D={2,4,6,...,10}D=\{2,4,6,...,10\} is an implicit method. "All even numbers from 22 to "10" 10.
  5. E={2,4,6,...}E=\{2,4,6,...\} is an implicit method. "All even numbers from 22 to infinity."

The three dots (......) stand for "and so on". The explicit method is useful for small sets only.

Exercise 3
  1. Consider the set AA=multiples of 33. Which statements are correct?
    1. 4A4\in A
    2. 21∉A21\not\in A
    3. 111A111\in A
  2. Write the explicit form of the sets
    1. A=A=\, "all odd numbers between 00 and 2020 which are also prime numbers"

    2. L=L=\, "the solutions of the equation 3x+15=03x+15=0"

Solution
  1. It is

    1. no
    2. no
    3. yes
  2. A={3,5,7,11,13,17,19}A=\{3,5,7,11,13,17,19\}

  3. L={5}L=\{-5\}

The cardinality of sets

The (minimal) number of elements in a set AA is called the cardinality of AA, and is denoted by

A\boxed{\vert A \vert}
Example 1
  1. A={1,4,6}A=\{1,4,6\}, thus the cardinality is A=3|A|=3
  2. B={1,1,1,4,4,6,6,6,6}B=\{1,1,1,4,4,6,6,6,6\}, thus the cardinality is B=3|B|=3 (because the cardinality is the minimal number of elements in the set, and we can write B={1,4,6}B=\{1,4,6\}
  3. {2,4,6,8,...,20}=10|\{2,4,6,8,...,20\}|=10
  4. {2,4,6,8,...}=|\{2,4,6,8,...\}|=\infty (infinity)

Subsets

Consider two sets AA and BB. We say that AA is a subset of BB, written

AB\boxed{A\subset B}

if every element of AA is also in BB. In other words, AA is 'inside' BB. If AA is not a subset of BB, we write

A⊄B\boxed{A\not\subset B}

In this case not every element of AA is in BB. Clearly, the Venn-diagram for ABA\subset B is as follows:

Example 2
  1. For A={1,2,5}A=\{1,2,5\} and B={1,2,3,4,5}B=\{1,2,3,4,5\} it is ABA\subset B
  2. For A={1,2,2,5,1,5}A=\{1,2,2,5,1,5\} and B={1,2,3,4,5}B=\{1,2,3,4,5\} it is ABA\subset B
  3. For A={1,2,5}A=\{1,2,5\} and B={1,2,6}B=\{1,2,6\} it is A⊄BA\not\subset B

Note the following. It is always correct that

  1. AAA \subset A
  2. {}A\{\} \subset A (there is nothing to check, so the statement "every element of {}\{\} is in AA" is not wrong, so it is correct).
  3. if ABA\subset B and BAB\subset A, then the two sets must have the same elements and are therefore equal, that is, we have A=BA=B.
Exercise 4
  1. Which sets are subsets of each other? A={2}A=\{2\}, BB="all even numbers", CC="all prime numbers", DD="all odd numbers"

  2. Which of the following statements are correct?

    1. 3{1,2,3}3 \in \{1,2,3\}

    2. {3}{1,2,3}\{3\} \in \{1,2,3\}

    3. {3}{1,2,3}\{3\} \subset \{1,2,3\}

Solution
  1. AB,ACA\subset B, A\subset C
  2. It is
    1. yes
    2. no
    3. yes

Set operations

Consider two sets AA and BB. We can form other sets using the following operations:

The intersection of AA and BB

The intersection of AA and BB, written

AB\boxed{A\cap B}

is defined as the set of all elements which are in A and B. Thus, ABA \cap B contains the common elements of AA and BB. In the Venn-diagram, this is the part were AA and BB overlap (below, left):

AA and BB are called disjoint, if AA and BB do not intersect, that is, if AB={}A\cap B=\{\}. In the Venn-digram, AA and BB do not overlap (above, right).

Example 3
  1. For A={2,4,6,8}A=\{2,4,6,8\} and B={3,4,5,6}B=\{3,4,5,6\} it is AB={4,6}A\cap B=\{4,6\} (the common elements of AA and BB).
  2. For A={1,2,3}A=\{1,2,3\} and B={4,5}B=\{4,5\} it is AB={}A\cap B=\{\} (disjoint, no common elements)

The union of AA and BB

The union of AA and BB, written

AB\boxed{A\cup B}

is defined as the set of all elements which are in A or B. Thus, ABA \cup B contains all elements of AA and BB (they are merged). In the Venn-diagram this is the whole area of AA and BB (below, left):

Note that the sentence "Taking an element which is in AA or in BB" can have two meanings. The inclusive meaning is that we take an element which is in AA, in BB or in both. This inclusive 'or' corresponds to the set operation \cup as defined above. The exclusive meaning is that we take an element which is either in AA or in BB, but not in both. The Venn-diagram for this operation (for which we do not introduce a symbol) is shown above (right).

Example 4

For A={2,4,6,8}A=\{2,4,6,8\} and B={3,4,5,6}B=\{3,4,5,6\} it is AB={2,3,4,5,6,8}A\cup B=\{2,3,4,5,6,8\} (all elements of AA and BB).

AA minus BB

The set A minus B, written

AB\boxed{A \setminus B}

is defined as the set of all elements which are in A but not in B. In the Venn-diagram (below, left), this is the part of AA without BB:

Example 5

For A={2,4,6,8}A=\{2,4,6,8\} and B={3,4,5,6}B=\{3,4,5,6\} it is AB={2,8}A\setminus B=\{2,8\} (we take all elements from BB away from AA).

The complement of AA

The complement of AA, written

Ac or A or A\boxed{A^c \text{ or } \overline{A} \text{ or } A^{\prime}}

is the set which contains all elements of the universal set UU which are not in AA. Thus, we can write

Ac=UAA^c=U\setminus A

The Venn-diagram is shown below.

Example 6
  1. For A={2,4,6,8}A=\{2,4,6,8\} and U={1,2,3,4,5,6,7,8,9,10}U=\{1,2,3,4,5,6,7,8,9,10\} it is Ac={1,3,5,7,9,10}A^c=\{1,3,5,7,9,10\}.
  2. For A={2,4,6,8}A=\{2,4,6,8\} and U={2,4,6,8,9}U=\{2,4,6,8,9\} it is Ac={9}A^c=\{9\}.
  3. For A={2,4,6,8}A=\{2,4,6,8\} and U={2,4,6,8}U=\{2,4,6,8\} it is Ac={}A^c=\{\}.

From the example above you see that the complement of AA is strongly dependent on the universal set UU. Indeed, without knowing this set, we cannot form the complement.

Venn-diagrams for three sets

Often we deal with general sets, without knowing what elements they contains. If this is the case, we always have to assume that the sets intersect. This is the general case. Assuming otherwise must be justified, which can only be done if we know more about the sets.

It follows that in a Venn-digram the general sets must be drawn such that they all overlap. In the case of three sets A,bA, b and CC this is still doable (see below). Drawing Venn-diagrams with more than three sets is impractical.

Exercise 5
Q1

List all the subsets of the set AA:

  1. A={1,2}A=\{1,2\}
  2. A={1,2,3}A=\{1,2,3\}

How many subsets can you form if A=n|A|=n ?

Q2

Consider the sets

A="odd numbers smaller than 10"B={4,5,6,7,8}C={1,2,3,4,5}\begin{array}{ll} A &=& \text{"odd numbers smaller than 10"}\\ B &=& \{4,5,6,7,8\}\\ C &=& \{1,2,3,4,5\} \end{array}

The universal set is U={1,2,3,4,5,6,7,8,9,10,11}U=\{1,2,3,4,5,6,7,8,9,10,11\}. Determine the following sets:

  1. ABA\cup B
  2. ABA\cap B
  3. AcA^c
  4. ABA\setminus B
  5. ABCA\cap B\cap C
  6. A(AC)A\cup(A\cap C)
Q3

Consider the sets AA, BB, and CC. Draw the Venn-Diagrams of the following sets:

  1. ABA\cap B
  2. A(BC)A\cap (B\cup C)
  3. AcBcA^c \cap B^c
Q4

Which statements are correct? Argue with the help of Venn-diagrams.

  1. (AB)A(A\cap B)\subset A
  2. A(AB)A\subset (A\cup B)
  3. AAcA\subset A^c
  4. (AB)c=AcBc(A\cup B)^c=A^c\cap B^c
  5. AB=ABcA\setminus B=A\cap B^c
  6. (Ac)c=A(A^c)^c=A
  7. ABA+B|A\cup B|\leq |A|+|B|
Q5

Express the following Venn-Diagrams using only intersection, union, and complement:

Q6

AA and BB have the universal set uu. It is U=10|U|=10, A=3|A|=3, B=4|B|=4, and AB=5|A\cup B|=5. Determine

  1. AB|A\cap B|
  2. BA|B\setminus A|
  3. Ac|A^c|
Q7

Simplify the following expressions:

  1. AAA\cap A
  2. AAA\cup A
  3. AAA\cap \overline{A}
  4. A(AB)A\cup (A\setminus B)
  5. A(AB)A\cap (A\cup B)
  6. (AB)(AB)(A\setminus B)\cap (A\cap B)
Q8

What do you get if you form the union of all the sets (1)-(8) below?

  1. ABCA\cap B\cap C

  2. AcBCA^c\cap B\cap C

  3. ABcCA\cap B^c\cap C

  4. ABCcA\cap B\cap C^c

  5. AcBcCA^c\cap B^c\cap C

  6. AcBCcA^c\cap B\cap C^c

  7. ABcCcA\cap B^c\cap C^c

  8. AcBcCcA^c\cap B^c\cap C^c

Solution
A1
A2
  1. AB={1,3,4,5,6,7,8,9}A\cup B = \{1,3,4,5,6,7,8,9\}
  2. AB={5,7}A\cap B = \{5,7\}
  3. Ac={2,4,6,8,10,11}A^c = \{2,4,6,8,10,11\}
  4. AB={1,3,9}A\setminus B = \{1,3,9\}
  5. ABC={5}A\cap B\cap C = \{5\}
  6. A(AC)={1,3,5,7,9}A\cup(A\cap C) = \{1,3,5,7,9\}
A3
A4
A5
  1. ABA\cap B
  2. (AB)(AB)(A\cup B) \cap (A\cap B)^\prime or (AB)(AB)(A^\prime \cap B)\cup (A\cap B^\prime)
  3. AA
  4. BAB\cap A^\prime
  5. (AB)(A\cup B)^\prime
  6. e.g ((AB)(AC)(BC))(ABC)((A\cap B) \cup (A\cap C) \cup (B\cap C)) \cap (A\cap B\cap C)^\prime
A6
A7
A8

The union is the universal set UU: