Chapter 5 Sets, Study notes of Algebra

Set builder notation has two parts separated with a vertical bar or a colon. The first part names a variable (in this case x) that ranges over all objects in ...

Typology: Study notes

2022/2023

Uploaded on 03/01/2023

eekanath
eekanath 🇺🇸

4.7

(18)

270 documents

1 / 15

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter 5
Sets
So far, we’ve been assuming only a basic understanding of sets. It’s time to
discuss sets systematically, including a useful range of constructions, opera-
tions, notation, and special cases. We’ll also see how to compute the sizes of
sets and prove claims involving sets.
5.1 Sets
Sets are an extremely general concept, defined as follows:
Definition: A set is an unordered collection of objects.
For example, the natural numbers are a set. So are the integers between
3 and 7 (inclusive). So are all the planets in this solar system or all the
programs written by students in CS 225 in the last three years. The objects
in a set can be anything you want.
The items in the set are called its elements or members. We’ve already
seen the notation for this: xAmeans that xis a member of the set A.
There’s three basic ways to define a set:
describe its contents in mathematical English, e.g. “the integers be-
tween 3 and 7, inclusive.”
52
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Chapter 5 Sets and more Study notes Algebra in PDF only on Docsity!

Chapter 5

Sets

So far, we’ve been assuming only a basic understanding of sets. It’s time to discuss sets systematically, including a useful range of constructions, opera- tions, notation, and special cases. We’ll also see how to compute the sizes of sets and prove claims involving sets.

5.1 Sets

Sets are an extremely general concept, defined as follows:

Definition: A set is an unordered collection of objects.

For example, the natural numbers are a set. So are the integers between 3 and 7 (inclusive). So are all the planets in this solar system or all the programs written by students in CS 225 in the last three years. The objects in a set can be anything you want.

The items in the set are called its elements or members. We’ve already seen the notation for this: x ∈ A means that x is a member of the set A.

There’s three basic ways to define a set:

  • describe its contents in mathematical English, e.g. “the integers be- tween 3 and 7, inclusive.”
  • list all its members, e.g. { 3 , 4 , 5 , 6 , 7 }
  • use so-called set builder notation, e.g. {x ∈ Z | 3 ≤ x ≤ 7 }

Set builder notation has two parts separated with a vertical bar or a colon. The first part names a variable (in this case x) that ranges over all objects in the set. The second part gives one or more constraints that these objects must satisfy, e.g. 3 ≤ x ≤ 7. The type of the variable (integer in our example) can be specified either before or after the vertical bar. The separator (| or :) is often read “such that.”

Here’s an example of a set containing an infinite number of objects

  • “multiples of 7”
  • {... − 14 , − 7 , 0 , 7 , 14 , 21 , 28 ,.. .}
  • {x ∈ Z | x is a multiple of 7}

We couldn’t list all the elements, so we had to use “.. .”. This is only a good idea if the pattern will be clear to your reader. If you aren’t sure, use one of the other methods.

If we wanted to use shorthand for “multiple of”, it might be confusing to have | used for two different purposes. So it would probably be best to use the colon variant of set builder notation:

{x ∈ Z : 7 | x}

The notation can be used on sets containing non-numerical objects. For example, suppose that A = {dog, cat, tree}. Then the set {αs : α ∈ A} contains the strings dogs, cats, and trees.

5.2 Things to be careful about

A set is an unordered collection. So { 1 , 2 , 3 } and { 2 , 3 , 1 } are two names for the same set. Each element occurs only once in a set. Or, alternatively, it doesn’t matter how many times you write it. So { 1 , 2 , 3 } and { 1 , 2 , 3 , 2 } also name the same set.

of A. For example, |{a, b, 3 }| = 3. And |{a, b, a, 3 }| is also 3, because we count a group of identical objects only once. The notation of cardinality also extends to sets with infinitely many members (“infinite sets”) such as the integers, but we won’t get into the details of that right now.

Notice that the notation |A| might mean set cardinality or it might be the more familiar absolute value. To tell which, figure out what type of object A is. If it’s a set, the author meant cardinality. If it’s a number, the author meant absolute value.

If A and B are sets, then A is a subset of B (written A ⊆ B) if every element of A is also in B. Or, if you want it formally: ∀x, x ∈ A → x ∈ B. For example, Q ⊆ R, because every member of the rationals is also a member of the reals.

The notion of subset allows the two sets to be equal. So A ⊆ A is true for any set A. So ⊆ is like ≤. If you want to force the two sets to be different (i.e. like <), you must say that A is a proper subset of B, written A ⊂ B. You’ll occasionally see reversed versions of these symbols to indicate the opposite relation, e.g. B ⊇ A means the same as A ⊆ B.

5.4 Vacuous truth

If we have a set A, an interesting question is whether the empty set should be considered a subset of A. To answer this, let’s first back up and look at one subtlety of mathematical logic.

Consider the following claim:

Claim 26 For all natural numbers n, if 14 + n < 10 , then n wood elves will attack Siebel Center tomorrow.

I claim this is true, a fact which most students find counter-intuitive. In fact, it wouldn’t be true if n was declared to be an integer.

Notice that this statement has the form ∀n, P (n) → Q(n), where P (n) is the predicate 14 + n < 10. Because n is declared to be a natural number, n is never negative, so n + 14 will always be at least 14. So P (n) is always false.

Therefore, our conventions about the truth values for conditional statements imply that P (n) → Q(n) is true. This argument works for any choice of n. So ∀n, P (n) → Q(n) is true.

Because even mathematicians find such statements a bit wierd, they typ- ically say that such a claim is vacuously true, to emphasize to the reader that it is only true because of this strange convention about the meaning of conditionals. Vacuously true statements typically occur when you are trying to apply a definition or theorem to a special case involving an abnormally small or simple object, such as the empty set or zero or a graph with no arrows at all.

In particular, this means that the empty set is a subset of any set A. For ∅ to be a subset of A, the definition of “subset” requires that for every object x, if x is an element of the empty set, then x is an element of A. But this if/then statement is considered true because its hypothesis is always false.

5.5 Set operations

Given two sets A and B, the intersection of A and B (A ∩ B) is the set containing all objects that are in both A and B. In set builder notation:

A ∩ B = {S | S ∈ A and S ∈ B}

Let’s set up some sample sets:

  • M = {egg, bread, milk}
  • P = {milk, egg, flour}

Then M ∩ P is {milk, egg}. If the intersection of two sets A and B is the empty set, i.e. the two sets have no elements in common, then A and B are said to be disjoint.

The union of sets A and B (A ∪ B) is the set containing all objects that are in one (or both) of A and B. So M ∪ P is {milk, egg, bread, flour}.

A×B×C == {(a, 1 , p), (a, 1 , q), (a, 2 , p), (a, 2 , q), (b, 1 , p), (b, 1 , q), (b, 2 , p), (b, 2 , q)}

5.6 Set identities

It’s easy to find (e.g. on the net), long lists of identities showing when two sequences of set operations yield the same output set. For example:

DeMorgan’s Law: A ∪ B = A ∩ B

I won’t go through these in detail because they are largely identical to the identities you saw for logical operations, if you make the following corre- spondences:

  • ∪ is like ∨
  • ∩ is like ∧
  • A is like ¬P
  • ∅ (the empty set) is like F
  • U (the universal set) is like T

The two systems aren’t exactly the same. E.g. set theory doesn’t use a close analog of the → operator. But they are very similar.

5.7 Size of set union

Many applications require that we calculate^3 the size of the set created by applying set operations. These sets are often sets of options for some task.

(^3) Or sometimes just estimate.

If two sets A and B don’t intersect, then the size of their union is just the sum of their sizes. That is: |A ∪ B| = |A| + |B|. For example, suppose that it’s late evening and you want to watch a movie. You have 37 movies on cable, 57 DVD’s on the shelf, and 12 movies stored in I-tunes. If these three sets of movies don’t intersect, you have a total of 37 + 57 + 12 = 106 movies.

If your input sets do overlap, then adding up their sizes will double-count some of the objects. So, to get the right number for the union, we need to correct for the double-counting. For our movie example, suppose that the only overlap is that 2 movies are on I-tunes and also on DVD. Then you would have (37 + 57 + 12) − 2 = 104 movies to choose from.

The formal name for this correction is the “Inclusion-Exclusion Princi- ple”. Formally, suppose you have two sets A and B. Then

Inclusion-Exclusion Principle: |A ∪ B| = |A| + |B| − |A ∩ B|

We can use this basic 2-set formula to derive the corresponding formula for three sets A, B, and C:

|A ∪ B ∪ C| = |A| + |B ∪ C| − |A ∩ (B ∪ C)|

= |A| + |B| + |C| − |B ∩ C| − |A ∩ (B ∪ C)|

= |A| + |B| + |C| − |B ∩ C| − |(A ∩ B) ∪ (A ∩ C)|

= |A| + |B| + |C| − |B ∩ C| − (|A ∩ B| + |A ∩ C| − |(A ∩ B) ∩ (A ∩ C)|)

= |A| + |B| + |C| − |B ∩ C| − |A ∩ B| − |A ∩ C| + |A ∩ B ∩ C|

In addition to the inclusion-exclusion principle, this derivation uses the distributive law (third step) and the fact that intersection is commutative and associative (last step).

5.8 Product rule

Now, suppose that we form the Cartesian product of two sets A and B, where |A| = n and |B| = q. To form an element (x, y) in the product, we have n

What’s the size of T ∩ R? Numbers in this set start with 2 one’s and end with 2 zeros, so the only choice is the middle digit. So it contains 10 numbers. So

|S| = |T | + |R| − |T ∩ R| = 1000 + 900 − 10 = 1890

5.10 Proving facts about set inclusion

So far in school, most of your proofs or derivations have involved reason- ing about equality. Inequalities (e.g. involving numbers) have been much less common. With sets, the situation is reversed. Proofs typically involve reasoning about subset relations, even when proving two sets to be equal. Proofs that rely primarily on a chain of set equalities do occur, but they are much less common. Even when both approaches are possible, the approach based on subset relations is often easier to write and debug.

As a first example of a typical set proof, let’s suppose that we the following two sets and we’d like to prove that A ⊆ B

A = {λ(2, 3) + (1 − λ)(7, 4) | λ ∈ [0, 1]} B = {(x, y) | x, y ∈ R, x ≥ 0 , and y ≥ 0 }

When presented with a claim like this, you should first take a minute to verify that the claim really is true. Set B is the upper right quadrant of the plane. To understand the definition of set A, remember how to multiply a real number by a vector: a(x, y) = (ax, ay). This definition generates all points of the form λ(2, 3) + (1 − λ)(7, 4) where λ is a real number between 0 and 1. Try putting some sample values of λ into this equation and plotting them in 2D: what geometrical object is this?^4 Make sure you believe that this object does live in the upper right quadrant.

Now, remember our definition of ⊆: a set A is a subset of a set B if and only if, for any object x, x ∈ A implies that x ∈ B. So, to prove our claim, we need to pick a random object x from A and show that it lives in B. So a starting sketch of our proof might look like:

(^4) Hint: use a pencil and paper. Your plot doesn’t need to be neat to see the pattern.

Proof: Let sets A and B be defined as above. Let x be an element of A. [missing details] So x is an element of B. Since x was arbitrarily chosen, we’ve shown that any element of A is also an element of B. So A is a subset of B.

We can now use the definition of A to extend forward from the hypotheses into the missing part. In particular, the definition of A implies that x is a 2D point, so it’s probably helpful to give names to the two coordinates:

Proof: Let sets A and B be defined as above. Let x be an element of A. Then x = μ(2, 3) + (1 − μ)(7, 4) for some μ ∈ [0, 1]. So x = (p, q) where p = 2μ + 7(1 − μ) and q = 3μ + 4(1 − μ) [missing details] So x is an element of B. Since x was arbitrarily chosen, we’ve shown that any element of A is also an element of B. So A is a subset of B.

Notice that the variable λ in the definition of A is local to the definition of A. So when we use this definition to spell out the properties of our element x, we need to introduce a new variable. I’ve used a fresh variable name μ to emphasize that this is a new variable.

At this point, it’s worth looking at the end part of the proof. If x = (p, q) and we’re trying to show that x is in B, then this translates into showing that p and q are both non-negative. So we can expand the end of the proof backwards, narrowing the missing part even further:

Proof: Let sets A and B be defined as above. Let x be an element of A. Then x = μ(2, 3) + (1 − μ)(7, 4) for some μ ∈ [0, 1]. So x = (p, q) where p = 2μ + 7(1 − μ) and q = 3μ + 4(1 − μ) [missing details] So p ≥ 0 and q ≥ 0. This means that x = (p, q) is an element of B.

This property is called “transitivity,” just like similar properties for (say) ≤ on the real numbers. Both ⊆ and ≤ are examples of a general type of object called a partial order, for which transitivity is a key defining property.

Let’s start our proof by gathering up all the given information in the hypothesis of the claim:

Proof: Let A, B, and C be sets and suppose that A ⊆ B and B ⊆ C.

Our ultimate goal is to show that A ⊆ C. This is an if/then statement: for any x, if x ∈ A, then x ∈ C. So we need to pick a representative x and assume the hypothesis is true, then show the conclusion. So our proof continues:

Let x be an element of A. Since A ⊆ B and x ∈ A, then x ∈ B (definition of subset). Similarly, since x ∈ B and B ⊆ C, x ∈ C. So for any x, if x ∈ A, then x ∈ C. So A ⊆ C (definition of subset again). 

5.12 An example with products

Here’s another claim, involving Cartesian products:

Claim 28 For any sets A, B, and C, if A × B ⊆ A × C and A 6 = ∅, then B ⊆ C.

Notice that this claim fails if A = ∅. For example, ∅ × { 1 , 2 , 3 } is a subset of ∅ × {a, b}, because both of these sets are empty. However { 1 , 2 , 3 } is not a subset of {a, b}.

This is like dividing both sides of an algebraic equation by a non-zero number: if xy ≤ xz and x 6 = 0 then y ≤ z. This doesn’t work we allow x to be zero. Set operations don’t always work exactly like operations on real numbers, but the parallelism is strong enough to suggest special cases that ought to be investigated.

A general property of proofs is that the proof should use all the informa- tion in the hypothesis of the claim. If that’s not the case, either the proof has a bug (e.g. on a homework assignment) or the claim could be revised to make it more interesting (e.g. when doing a research problem, or a buggy homework problem). Either way, there’s an important issue to deal with. So, in this case, we need to make sure that our proof does use the fact that A 6 = ∅.

Here’s a draft proof:

Proof draft: Suppose that A, B, and C are sets and suppose that A × B ⊆ A × C and A 6 = ∅. We need to show that B ⊆ C. So let’s choose some x ∈ B....

The main fact we’ve been given is that A × B ⊆ A × C. To use it, we need an element of A × B. Right now, we only have an element of B. We need to find an element of A to pair it with. To do this, we reach blindly into A, pull out some random element, and give it a name. But we have to be careful here: what if A doesn’t contain any elements? So we have to use the assumption that A 6 = ∅.

Proof: Suppose that A, B, and C are sets and suppose that A × B ⊆ A × C and A 6 = ∅. We need to show that B ⊆ C. So let’s choose some x ∈ B. Since A 6 = ∅, we can choose an element t from A. Then (t, x) ∈ A × B by the definition of Cartesian product. Since (t, x) ∈ A × B and A × B ⊆ A × C, we must have that (t, x) ∈ A × C (by the definition of subset). But then (again by the definition of Cartesian product) x ∈ C. So we’ve shown that if x ∈ B, then x ∈ C. So B ⊆ C, which is what we needed to show.

5.13 A proof using sets and contrapositive

Here’s a claim about sets that’s less than obvious: