Sets 1 Where does mathematics start? What are the ideas which come first, in a logical sense, and form the foundation for everything else? Can we get a very small number of basic ideas? Can we reduce it to just one thing? For a long time the basic idea was though to be number. We now see a set as the single starting point. A set in mathematics is a very simple idea - a collection of things. The word 'set' is also used in everyday English, but a maths set is different. A set of cutlery has 'slots' or 'roles', such as knife, fork, soup spoon, desert spoon. A set of golf clubs also has standard slots, such as a driver, a putter and a wedge. These things in maths terms would be called tuples. But a mathematical set is more general than this, and there is no need for slots with fixed purposes. A set is just any collection of anything, with the things not being in order, and with no duplicates. Because sets are the foundation of mathematics, we should have a formal logical basis for them. We outline that later - including more precision as to what the 'things' in a set can be. We start off informally. Set notation For example we could have S1 = { A, B, C } which means that the set S1 is made of the elements A B and C. What kind of thing are A B and C? At the moment, anything. So we might have { red, green blue } a set of colours, { Paris, New York, Chicago } a set of cities { 1,2,3,4,5 } a set of numbers The elements of a set The things in a set are called the elements of it. If x is an element of the set S, we say x S read as 'x is an element of S' For example 2 { 1,2,3} Or maybe x is not an element of S: x S such as 4 {1,2,3} Equality of sets Two sets are equal if they contain exactly the same things. So A = B if and only if every element of A is an element of B, and vice versa. In other words, if x is in A, x is in B, and also the other way round: if x is in B, x is in A For example { 1,2,3 } = {1,2,3}
{1,2,3 } = {3,2,1}.. order does not matter {1,2,3 } {2,3} { 1,2 } {1,2,3} Conversely, if A is not equal to B, there must be an x in A not in B, or an x in B not in A. 'Being equal' might be thought to be a simple obvious idea - but it is not. For example, how does 'being equal' relate to 'being the same'? For example, if we say x=y, is that just a way of saying that x and y are different names for the same thing? If so - consider 5 = 3+2. Does that mean 3+2 is the same thing as 5? EXERCISE 1 An equivalence relation must satisfy 3 properties: A~A (reflexive) if A~B and B~C then A~C (transitive) if A~B then B~A (symmetric) Are these true for set equality? In other words, is set equality an equivalence relation? We study relations and equivalence relations later. Sets of Sets We have not discussed what type of thing we can have in a set - this is discussed later. In the meantime we will just call them a b and c and so on, without saying what a and b and c are. But we can have sets of sets - for example S1 = { a,b,c } S2 = { p, q ] S3 = { S1, S2 } S1 has three elements in it. S3 has just two elements - S1 and S2 (not the five elements a b c p and q ) You have to think very carefully about this. Suppose A = { x, y, z } Is A the same as { A }? No. The set A has three elements, x y and z. But { A } has just one element, which is A. The null set The set with no elements, the empty set, is denoted by Φ Φ = { } The null set is unique - there is only one null set. Suppose S6 and S7 were both null sets, and S6 S7 then there must be an element of S6 not in S7, or one in S7 not in S6. But there are no such elements, so S6 S7 is false. Are you sure this is valid logic? The null set might be thought just a curious thing - in fact it is going to be of fundamental importance. Subsets A subset of a set is a selection of the elements of a set. So if S = {A,B,C,D,E}, then {A,C,E} is a subset of S. This is written So {A,C,E} { A,B,C,D,E} The definition is : A B if x A implies x B In other words one set is a subset of another if, when we pick one of its elements (any one), it will also be an element of the other set.
That means a set is a subset of itself, since every element of A is in A. Also the null set is a subset of every set. A proper subset excludes the set itself, and the null set. Since A A is true for all A, subsets (set inclusion) is reflexive If A B and B C, then A C, and so set inclusion is transitive If A and B are distinct and not null, then A B implies B A, so set inclusion is anti-symmetric The Power Set What about all the subsets of a set? All the subsets of { 1,2,3} are: {1,2,3} {2,3} {1,3} {1,2} {1} {2} {3} {} (the null set Φ ) The set of all subsets is called the power set. How many elements are in the power set? How many subsets does a set have? Suppose the set is S={A,B,C...N} Some subsets contain A - the rest do not. Those two groups can be combined with those that contain B, and those that do not. That's 2 X 2 sets. Combine those with those that contain C, and those that do not - that's 2 X 2 X 2. Clearly we have a total of 2 n. Or, we can represent each subset as a binary number, like 11000.. would be the subset that contains A and B but no others. The subsets are then 000..0 (n bits) to 1111..1. That's 2 n subsets. Venn diagrams One way of visualizing sets is through the use of these diagrams. For example if X = { a, b, c, d } and Y = { b, c } X this diagram shows the situation. Y a b c d Usually we do not write in the elements, and just show the set boundaries. Intersection The intersection of two sets is another set, containing all the elements which are common to both sets. The intersection of A and B is written A B So if A ={ W,X,Y} and B = {X,Y,Z} then A B = { X,Y} if x A B, then x A and x B X Y Intersection
Intersection corresponds to the logical connective AND - the intersection is the set of those elements in one set AND the other. EXERCISE 3 1. What is A Φ? 2. What is A A? 3. Is A B = B A true? Union The union of two sets is another set, containing everything which is in one set, or the other (or both) The union of A and B is written A B So if A ={ W,X,Y} and B = {X,Y,Z} then A B = { W,X,Y,Z } ( remember sets do not contain duplicate elements ) if x A B, then x A, or x B, or both. X Union Y EXERCISE 4 1. What is A Φ? 2. What is A A? Difference This is like 'subtracting' one set from another. The difference of two sets A and B, written A - B, contains those elements in A but not in B So if A ={ S, T, U} and B = {T,U,V} then A - B = { S} EXERCISE 5 1. What is A - A? 2. A - Φ? 3. If A - B = A what can you say about B? 4. If A - B = Φ what can you say? 5. If A - B = B? Complement and Universe The complement of a set are the things not in it. The complement is a set X is usually written X' X A X - Y A - B B Y C C - D D But what then is the complement of {X, Y}? Everything except X and Y, but that is rather vague, as regards what 'everything' is. So we have the idea of the universal set, which is the set of everything we are talking about. For example if the universe is { A, B, C, D, E, F} and S = {A, B, C} then S' = { D, E, F }
So the complement of a set is the difference between the universal set and the given set. Cartesian Product If we have 2 sets A and B, we can form a new set, containing all pairs, one from A and one from B. For example, if A = { C, D} and B={E, F} then the Cartesian Product of A and B is { {C,E}, {C,F}, {D,E}, {D,F} } This is written A X B We modify this idea slightly in the chapter about ordered pairs. Set builder notation As well as listing elements, we can also form a set by giving a rule to decide if something is a member. For example S = { x : x > 0 and x < 5 } which could be read as S is the set of x, where x is greater than 0 and less than 5 - in other words S = { 1, 2, 3, 4 } And we could have T = { x : x is even } - which is an infinite set. Then S T = { 2,4 } The number sets The natural numbers are 1,2,3,4.. The set of all natural numbers is usually written N ( N if fancy letters are not available. The set of signed integers..-2, -1, 0, +1, +2.. is written Z (from the German Zahlen, number) A rational number is one that can be written as a/b where a and b are signed integers. So 1/9, 5/4, -7/22 are all rational numbers. The set of all rationals is written Q Irrational numbers are numbers which cannot be written as a/b. Examples are 2, π and e. The real numbers are rationals and irrationals - all numbers. The set of reals is written R. There is no standard symbol for the irrationals. It can be written R - Q - that is, the reals without the rationals. The set of complex numbers is written C.
Cardinality of a set This is how many elements there are in a set. So the cardinality of {6,7,8,9} is 4. The cardinality of a set S is written S So {5,4,3} is 3. This seems to be a very simple idea. But not always. For example, what is N? Is Q smaller than R? EXERCISE 6 1. Does A X B = B X A? ANSWERS 1. Yes. A=B iff x A implies x B and x B implies x A Clearly x A implies x A so A=A If A=B and B=C then x A implies x B and x B implies x C, so x A implies x C, so A=C If A=B then x B implies x A so B=A 3.1 Φ 3.2 A 3.3 Yes. The elements which are in A and B are the same as the ones in B and A. 4.2 A 4.3 A 5.1 Φ 5.2 A 5.3 There are no elements in B which are in A. In other words A B = Φ. This might be because B = Φ 5.4 A = B 5.5. If you remove the elements of B from A, you get the elements of B. That is impossible, unless B has no elements - so the same for A. So A = B = Φ 6.1 Yes. The elements of A X B are all of {x,y} where x A and y B The elements of B X A are all {y,x} But sets are not ordered, so {x,y} = {y,x}. So A X B = B X A DEFINITIONS OF AND A = B C iff x A x B x C
A = B C iff x A x B x C DEFINITION OF = A = B iff x A x B COMMUTATIVITY OF = Axiom : A = B definition of = x A x B x B x A reflexivity of iff Conclusion: B = A definition of = So if A=B, B=A TRANSITIVITY OF = Axiom 1: A = B Axiom 2: B = C x A x B definition of = and axiom 1 x B x C definition of = and axiom 2 x A x C transitivity of iff Conclusion : A = C transitivity of = so if A=B and B=C, A=C COMMUTATIVITY OF Axiom: A = B C x A x B x C definition of x A x C x B transitivity of iff 2 A = C B definition of 3 B C = A commutativity of =, from axiom so A B = B A B C = C B commutativity of =, from 3 and 2 ASSOCIATIVITY OF Axiom X = ( A B) C x X x ( A B) C definition of = x ( A B) x C definition of ( x A x B ) x C definition of x A ( x B x C) associativity of
x A (B C) definition of, twice Conclusion ( A B) C = A (B C) definition of = with axiom so ( A B) C = A (B C) ASSOCIATIVITY OF Axiom X = ( A B) C x X x ( A B) C definition of = x ( A B) x C definition of ( x A x B ) x C definition of x A ( x B x C) associativity of x A (B C) definition of, twice Conclusion ( A B) C = A (B C) definition of = with axiom so ( A B) C = A (B C)