SetsWe will cover the topics:
Defining SetsFor now, it is convenient to assume that there is a universe of elements. Set
A set is any collection of elements from a universe . The concept of a set is so basic in mathematics that it defies an easy definition. Most definitions just devolve to a set is a set :-). Elements of a Set
The contents of a set are called its elements. For an element , we say if belongs to the set . The negation is written as or often as . There are two ways to define a set:
For now, whenever we are discussing sets, the universe needs to be made clear. Naive Set TheoryThe notion of set theory that we are studying in this lecture is called naive set theory. The reason, we call it naive is the assumption of the universal set . Before the 20th century, mathematicians and philosophers imagined a collection of all possible entities and called it the universal set. This set has literally everything one can imagine: goats, ants, Higgs Bosons, tables, chairs, numbers, groups and all that. Think of it, and presto!, the universal set has it. But the work of mathematicians such as Cantor and Bertrand Russell in the early 20th century proved that the universal set cannot exist, since it existence leads to paradoxes or contradictions. Nonexistence of the Universal Set
The universal set containing everything does not exist. Therefore, we will continue to describe a version in this notes that we will call informally ‘‘semi-naive’’ (Note that this is our own invention and not a standard term in mathematics). Wherever possible, we will note the changes needed due to the non-existence of an universal set. Example 1: IntegersWe assume that the universe is restricted the set of all integers . What do the following sets define:
Note that restricting our universe to the set of integers, poses no contradiction or paradox in the definitions above. Example 2: AnimalsLet the universe be all the animal species on planet earth.
Note that restricting the universe to that of all animal species on the planet earth makes the sets above well defined and free of contradictions. Empty/Universal SetsEmpty Set
The set with no elements is called the empty set. It is written or . We will use the latter. Naive set theory often adds a special universal set . As noted earlier, the universal set does not exist, and will need to be unlearned. However, in many contexts, we will specifically name a set such as (the set of all real numbers) to be a restricted universe. Since is a well-defined set, it is fine to assume such a set as a restricted universe. Union, Intersection, Difference and Complement.Let denote sets drawn from a restricted universe .
The operation of complementation is defined in naive set theory.
If we operate inside a restricted universe , then . Otherwise, does not exist, strictly speaking, because the universal set containing everything does not exist. Example 1Let be the restricted universe given by set of all integers . Let be the set of all odd integers, be the set of all even integers, be the set of all prime integers and be the set of all composite numbers ( are neither prime nor composite). What are the sets?
Example-2Is the same as ? What about ?
Is the same as ? Give a simple example.
Finite Vs. Infinite SetsFinite sets are those that have finitely many elements. Infinite sets, on the other hand, have infinitely many elements. We will define infinite sets and deal with infinite sets in a lot of detail soon. Venn DiagramsVenn Diagrams are easy diagrammatic ways of visualizing sets and operations between them. We assume that you already know a lot about these (this is high school material, really). We will do some quick recap in class. On the other hand, Venn diagrams are nothing to sneeze at. The wikipedia article on Venn diagrams or this site has a lot of interesting information. We can use Venn diagrams to prove certain properties of sets.
CardinalityThe cardinality of a set is the number of elements in it. For now, it makes sense to talk of cardinality just for finite sets. We will discuss the issue of infinite sets and cardinality after we have covered relations and functions. The cardinality of the empty set is, of course, zero. The cardinality of a set can never be negative. What is the cardinality of the following sets:
The cardinality of a set is denoted or sometimes by . We will use . Notice the following interesting fact: . Why is this true? Using a Venn diagram, we can derive that The relation above is called the inclusion exclusion principle. We can extend it to three sets : Notice the curious sign change!! Example-1Let and . Verify the inclusion-exclusion principle for ? We see that . We can also see this using the inclusion exclusion principle: Example-2If we look at all numbers from to . How many numbers contain a ? Off the top of our head, this kind of calculation is tricky. We have numbers with in the second digit () and numbers with a in the first digit . Therefore, there are total of numbers with a in them. However, note that has been counted twice. So the answer should be . Using inclusion-exclusion: Let be the set of all numbers with in the seond digit and be all numbers with in the first (most-significant) digit. Our argument above is using the inclusion exclusion principle: Example -3How many numbers between and are divisible by or by or by ? Let us fix the universe to be . Let . Similarly, let be the numbers divisible by and be the numbers divisible by . We seek . We have
Overall = = . (I could be off in my calculations, please check). General Inclusion Exclusion PrincipleWe have seen inclusion exclusion for cardinality of . Suppose we have sets , we can generalize this to Puzzle (Counting Prime Numbers)Given a list of prime numbers from to , show how the list can be used to count the number of primes from to using inclusion exclusion. Let us try a simpler case of counting primes from . Instead of primes, we will count composites. Once we count composites, we can immediately conclude how many primes there are. The universal set is . Let us define the set . We omit since it is neither prime nor composite. We take our seed set of prime numbers to be . Theorem Every composite number from is divisible by or . In other words, every composite number has or as one of their prime factor. Proof
Proof is by contradiction. Let be a composite number such that and does not have as a prime factor. Therefore, can be factored as a product of prime numbers , wherein, . In other words, we conclude that . But we assumed that , yielding a contradiction. In other words, we will first count using the inclusion exclusion principle. This will give us the count of composites with a caveat. includes , and . So whatever the cardinality of their union is, we need to subtract from them to obtain numbers that are truly composite. We write We note that is just . We know because there are numbers that are divisible by . Therefore, The number of composites is therefore (why did we subtract ?) The number of primes will be (why from ? why not here?). Check that there are indeed primes from to : . The same calculation can be carried out for all primes upto . For that we get: Using this, number of composites is . Therefore, we conclude that primes exist. The additional four primes beyond are . There is a very close connection between this way of counting and Eratosthenes Sieve for enumerating all primes. Therefore, inclusion-exclusion principle is often called the sieve principle. As a fun exercise: implement a counter to solve the puzzle. You will definitely need to write a program rather than attempt this by hand. Cartesian Products and Power SetsWe will now look at two other operations over sets:
Cartesian ProductTake sets and over some universe . The Cartesian product of is defined as In other words, we build the set of all 2-tuples where the first component is from set and second component is from set . We can extend Cartesian product to more than sets: Here we take Cartesian product of sets and the resulting product is a set of 3-tuples. Example-1If is the set of all real numbers represented by the real line, what is the set ? Answer: consists of all tuples of reals of the form where and are reals. In other words, we have moved from a single number to -dimensional co-ordinates. For simplicity, the product of a set with itself is written . What is ? Example-2: Empty SetWhat is the Cartesian product of the empty set with a set ? Answer: The empty set. Cardinality of Cartesian ProductsThe rule for Cartesian product is that We can convince ourselves by drawing a table of all entries. Let us assume and .
Order of Cartesian Product MattersIf for sets , we note that will not equal . In other words, it matters in a tuple that comes first and comes second. For example, if I asked you to draw a pixel at it is not the same as drawing one at , right? If , however, it is trivial that are all the same thing. ExampleWhat is the size of cartesian product if ? SubsetSet is a subset of written iff every element of is also an element of . Examples
Answers: yes, no, yes, no, yes! |