Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sets CSLU 1100.003 Fall 2007 Cameron McInally Fordham University.

Similar presentations


Presentation on theme: "Sets CSLU 1100.003 Fall 2007 Cameron McInally Fordham University."— Presentation transcript:

1 Sets CSLU 1100.003 Fall 2007 Cameron McInally cameron.mcinally@nyu.edu Fordham University

2 Sets When Georg Cantor invented sets he described them as... “By a set we understand any collection S of definite, distinct objects s of our perception or of our thought into a whole.” What that means… “A set is a group of objects, with no duplicates.”

3 Sets Set basics: – Sets are always enclosed in curly brackets. E.g. {a} – Objects in sets are separated by commas. E.g. {a,b,c,apple,e} – Sets can contain other sets. E.g. {a,b,{joe,d},e} – Sets can be empty. E.g. {}

4 Sets 2 major rules: 1.Don’t list any object more than once in a set 2.The order of a set does not matter

5 Sets 1) Don’t list any object more than once: {a,b,d,d,e} {a,b,c,d,e} {a,b,c,b,b}

6 Sets 2) The order of a set does not matter: {a,b,c,d,e} != {e,d,c,a,f} {a,b,c,d,e} == {e,d,c,b,a} {a,b,c,d,e} == {b,e,d,a,c}

7 Sets To represent a set as a whole, we use capital letter names. E.g. A = {x,y,z} So, we can say that set A contains elements x, y and z.

8 Sets Cardinality – Cardinality is the size of a set. – If set A contains 3 elements, we can write… |A| = 3

9 Sets What is the size of each of these sets? A = {a,b,c,d,e,f,g} B = {x,y,z} C = {{},{},10,11} D = {} E = {{a,b},{c,d}} |A| = 7 |B| = 3 |C| = Not a Set!! |D| = 0 |E| = 2

10 Sets Infinite Sets – “N” is the natural numbers {0, 1, 2, 3, 4, 5, …} – “Z” is the set of integers {…-2,-1,0,1,2,…} – “Q” is the set of rational numbers (any number that can be written as a fraction – “R” is the set of real numbers (all the numbers/fractions/decimals that you can imagine

11 Sets What is the cardinality? – A = {alpha, beta, gamma} – B = {-5,0,5,10} – C = {{a,{b}},{c,d}} – D = {{},{},10,11} – E = {} |A| = |B| + |C| = |D| + |E| - |A| = |B| + |D| = 3 6 1 7

12 Sets Set Builder Notation – How do we represent the elements in a set, without specifically writing them out. – This is read, “x, such that x is an element of N”. In general; – “:” means “such that” – “Є“ means “element of” – Here, N is the set of Natural Numbers.

13 Sets Two symbols that we will need: – Is a subset of: – Is an element of:

14 Sets Element of and Subset of…

15 Sets Set builder notation: – Everything before the “:” gives a description of what values we want to include in our set – Everything after the “:” places constraints on which of the values mentioned in the first half we will actually use.

16 Sets Examples of Set Builder Notation

17 Sets Understanding Set Builder Notation – http://storm.cis.fordham.edu/~kinley/classes/sum mer06/cseu1100/flash/ch3/sec3_1/setNotation.ht ml

18 Sets Union ( ) – This creates a new set from the elements in A and B. Duplicates are discarded.

19 Sets

20 Intersection ( ) – This creates a new set that contains the elements that both A and B have in common. Other elements are discarded.

21 Sets

22 Difference (-) – This creates a new set that contains the elements of set A without any element in set B.

23 Sets

24 Practice – Set Operations Set Operations http://storm.cis.fordham.edu/~kinley/classes/summer0 6/cseu1100/flash/ch3/sec3_1/setoperations.html

25 Sets Power Set (2 S ) – Given a set S, this creates a set which contains all the subsets of S. – Power Sets include the empty set. – Power Sets include the set S. – Power Sets are represented by 2 S – Power Sets can also be written as P(S)

26 Sets Power Set For A = {1,2,3} 2 a = P(A)= {{},{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}} For B = {a,b,c,d} 2 B = P(B) = {{},a,b,c,d,{a,b}, {a,c}, {a,d}, {b,c}, {b,d}, {c,d},{a,b,c}, {a,b,d}, {a,c,d}, {b,c,d}, {a,b,c,d}}

27 Sets Cartesian Product (X) – Creates a set consisting of all coordinate pairs. Coordinate Pairs from a Cartesian Product – Every combination of one element from the first set with one element from the second set.

28 Sets Cartesian Product

29 Always Due in One Week Homework (Always Due in One Week) Read Section 2.1-2.3 Complete Section 2.5 pages 24-26 : 1, 2(a-d), 3, 4, 5, 6, 7, 8 Sets


Download ppt "Sets CSLU 1100.003 Fall 2007 Cameron McInally Fordham University."

Similar presentations


Ads by Google