Please elaborate with your own illustrations!

Slides:



Advertisements
Similar presentations
Counting. Counting = Determining the number of elements of a finite set.
Advertisements

More Set Definitions and Proofs 1.6, 1.7. Ordered n-tuple The ordered n-tuple (a1,a2,…an) is the ordered collection that has a1 as its first element,
Chapter 2 Concepts of Prob. Theory
Sets Lecture 11: Oct 24 AB C. This Lecture We will first introduce some basic set theory before we do counting. Basic Definitions Operations on Sets Set.
Chapter 2 Probability. 2.1 Sample Spaces and Events.
Week 21 Basic Set Theory A set is a collection of elements. Use capital letters, A, B, C to denotes sets and small letters a 1, a 2, … to denote the elements.
Discrete Structures & Algorithms More Counting. + + ( ) + ( ) = ? Counting II: Recurring Problems and Correspondences.
Lecture 19 Exam: Tuesday June14 4-6pm Overview. Disclaimer The following is a only study guide. You need to know all the material treated in class.
Set, Combinatorics, Probability & Number Theory Mathematical Structures for Computer Science Chapter 3 Copyright © 2006 W.H. Freeman & Co.MSCS Slides Set,
Operations on Sets – Page 1CSCI 1900 – Discrete Structures CSCI 1900 Discrete Structures Operations on Sets Reading: Kolman, Section 1.2.
CompSci 102 Discrete Math for Computer Science March 22, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
©1999 Indiana University Trustees Basic Set Theory Definitions A set is a collection of objects or elements An element is an object that make up a set.
Copyright (c) 2004 Brooks/Cole, a division of Thomson Learning, Inc. Chapter 2 Probability.
How many ways are there to pass through city A where the arrows represent one-way streets? Answer: mn ways The counting principal: Suppose two experiments.
Set theory Sets: Powerful tool in computer science to solve real world problems. A set is a collection of distinct objects called elements. Traditionally,
Topics to be covered: Produce all combinations and permutations of sets. Calculate the number of combinations and permutations of sets of m items taken.
Probability Theory 1.Basic concepts 2.Probability 3.Permutations 4.Combinations.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
CPSC 531: Probability Review1 CPSC 531:Probability & Statistics: Review Instructor: Anirban Mahanti Office: ICT Class.
Probability I. Sample Spaces Sample space: The set of possible outcomes for a question or experiment Experiment: Flip a two sided coin Question: Did the.
COMPSCI 102 Discrete Mathematics for Computer Science.
Discrete Mathematics for Computer Science. + + ( ) + ( ) = ? Counting II: Recurring Problems and Correspondences Chapter 9 slides 1-54.
Great Theoretical Ideas in Computer Science.
Week 11 What is Probability? Quantification of uncertainty. Mathematical model for things that occur randomly. Random – not haphazard, don’t know what.
CS201: Data Structures and Discrete Mathematics I
Mathematical Preliminaries
확률및공학통계 (Probability and Engineering Statistics) 이시웅.
UNIT VOCABULARY Functions. Closed Form of a Sequence (This is also known as the explicit form of a sequence.) For an arithmetic sequence, use a n = a.
Some other set notation We will use the notation to mean that e is an element of A. We will use the notation to mean that e is not an element of A.
Basic probability Sep. 16, Introduction Our formal study of probability will base on Set theory Axiomatic approach (base for all our further studies.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Basic Probability. Introduction Our formal study of probability will base on Set theory Axiomatic approach (base for all our further studies of probability)
Algebra 2 Chapter 12 Venn Diagrams, Permutations, and Combinations Lesson 12.2.
CPCS 222 Discrete Structures I
Methods in Combinatorics. Finite, Countable, Discrete. Enumerating objects which satisfy a condition. In short: Counting Stuff → Balls & Urns.
Principle of Inclusion and Exclusion
Chapter 4 Introduction to Set Theory
Probability Theory Basic concepts Probability Permutations
Unions and Intersections of Sets
Introduction to Discrete Mathematics
CSC 321: Data Structures Fall 2015 Counting and problem solving
Copyright © Zeph Grunschlag,
Discrete Structures for Computer Science
Set, Combinatorics, Probability & Number Theory
JA Ritcey EE Please elaborate with your own illustrations!
Week 7 - Monday CS322.
What is Probability? Quantification of uncertainty.
Copyright © Zeph Grunschlag,
Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103 Chapter 2 Sets Slides are adopted from “Discrete.
Cardinality of Sets Section 2.5.
Set Operations Section 2.2.
Set, Combinatorics, Probability & Number Theory
Counting I: Bijection and Choice Trees
Counting I: One-To-One Correspondence and Choice Trees
Basic Counting.
Advanced Algorithms Analysis and Design
Combinatorics.
Discrete Mathematics CS 2610
The aim of education is to teach students how to think rather than what to think. Sets The set is the fundamental discrete structure on which all other.
2 Chapter Numeration Systems and Sets
Counting Discrete Mathematics.
Basic Counting Lecture 9: Nov 5, 6.
Chapter 6: Probability: What are the Chances?
Counting II: Recurring Problems And Correspondences
Lecture Sets 2.2 Set Operations.
Copyright © Zeph Grunschlag,
Copyright © Zeph Grunschlag,
Counting II: Recurring Problems And Correspondences
Counting I: Choice Trees and Correspondences
Probability Notes Math 309.
Presentation transcript:

Please elaborate with your own illustrations! Sets and Counting JA Ritcey EE 416 Revised Oct 5 2009 Please elaborate with your own illustrations!

Elementary Set Theory Universe – superset containing any element of interest. This is the complement of the empty set. Subset – collection of none, some, or all elements Set operations – complement, union, intersection Cardinality – the number of elements in a set, size Cardinality can be finite, countable, or uncountable Venn diagrams are useful pictorial representations Set operations can be carried out in MATLAB!

Set Operations U = { u_1, … , u_N } with card(U) = N Count by placing elements of U in one-to-one correspondence with the natural numbers You should be able to carry out set operations by taking unions, intersections, and complements. You should be able to handle both lists and geometric regions.

Disjoint or Mutually Exclusive Sets 2 sets a disjoint or mutually exclusive if they have no common elements disjoint means the intersection is the empty set Disjoint sets are simpler than those with overlap A collection of sets is mutually disjoint if no two intersect. Together they partition the union. Partition – a collection of disjoint subsets that is complete and together yields the entirety

Partitions A set S is partitioned by a collection of disjoint subsets that together encompass all of S The days of the week are partitioned into work days and weekend The numbers {1,2,3, …} are partitioned into odd and even Partitions are used to when something is held invariant over each subset

Sensor Nodes Partitioned by Radius from Acces Point

Cartesian Products Given 2 sets A = { a_i } B = { b_j } create the Ordered pair c = (a_i, b_j ) C = AxB is called the Cartesian product |C| = |AxB| = |A|x|B| . This is called the multplication principle in counting (combinatorics) Select one from column A and 1 from column B This can be extended to ordered J-tuples C= A_1 x … x A_J the J-fold product A vector can be created this way

Power Sets Power Set Pwr(S) is the set of all subsets of any S If a set S is finite, say |S| = N, then |Pwr(S)| = 2^N To see this equate each member of Pwr(S) with the binary string (b_1, b_2, … , b_N ). The b_i in (0,1) label whether element s_i is in the particular subset. There are 2^N binary strings of length N If the cardinality, or size, of A is countable, the power set has uncountable cardinality

Properties of the Power Set Pwr(S) has some closure properties A collection of sets C is closed under set operations: (1) If A in C, A^c in C (closed under complements) (2) If A_1, …A_N in C, their union is in C Often this last property is extended to countable unions. If A_1, A_2,… in C, their union is in C Collections of sets with this property are called algebras and sigma-algebras. When S is uncountable Pwr(S) is too big to assign probabilities to everything – a subtle point

Generating some small power sets function powerset(n); %function powerset(n); n1=n-1; for knt = 0:2^n1-1 C= bitget(knt,n1:-1:1); disp([knt C]) end 0 0 0 0 0 1 0 0 0 1 2 0 0 1 0 3 0 0 1 1 4 0 1 0 0 5 0 1 0 1 6 0 1 1 0 7 0 1 1 1 8 1 0 0 0 9 1 0 0 1 10 1 0 1 0 11 1 0 1 1 12 1 1 0 0 13 1 1 0 1 14 1 1 1 0 15 1 1 1 1

Counting Finite Sets We have already done some counting, using the Multiplications Principle Cartesian product card |C| = |AxB| = |A| |B| All pairs must be possible The size of A and B can be different, but finite There are 52 = 4x13 cards in a deck There are 100 = 2x50 US Senators Lets call a set S an N-set when |S|=N

Ordered Selection w/ Repetition Given a base N-set S In how many ways can we select k objects Assume an ordered selected With replacement. So that repetition is possible We can do this is N^k ways by the multiplication principle Just equate the selection of an object with an ordered k-tuple The elements are independently selected and each drawn from an N-set (repetitions)

Tabular View Repetition With Without W/ Order N^k N!/(N-k)! WO/ Order (N+k-1)!/ (N-1)! k! N!/(N-k)!k! (N+k-1 choose k) (N choose k) It is easier to remember these, when they are considered as a group

Ordered Selection W/Replacement Each Selection is a row Possible Choices along columns 7^12 = 7 x7 …x7 Cartesian Product Illustrates the Multiplication Principle 1 2 3 4 5 6 7 8 9 10 11 12

Examples Cards = 4 suits x 13 face values = 52 cards You can place r balls into n cells in n^r ways n^r = n x n … x n Harder: How many ways can r flags be put on n flagpoles? Ans: n x (n+1) x (n+2) x … x (n+r-1) Why: The second flag can be put above or below the first. So the number of choices increases

Ordered Selection wo/ Repetition Given a base N-set S In how many ways can we select k objects Assume an ordered selected without replacement. So that repetition is not possible We can do this is (N)_k = N(N-1) …(N-k+1) ways, again by the multiplication principle Just equate the selection of an object with an ordered k-tuple The elements are each drawn from sets of decreasing size When k=N, we can select in N! ways

Tabular View Repetition With Without W/ Order N^k N!/(N-k)! WO/ Order (N+k-1)!/ (N-1)! k! N!/(N-k)!k! (N+k-1 choose k) (N choose k) It is easier to remember these, when they are considered as a group

Factorial Interpretation The factorial n! = n(n-1)(n-2) …(3)(2)(1) 0!=1 It gets very big very fast, n! asy sqrt(2pi)n^(n+1/2)exp(-n) Then (N)(N-1)…(N-k+1) = N! / (N-k)! Best ways to compute the factorial is through the Gamma Function (gamma.m) More later. You can permute (reorder) an N-tuple in N! ways

Factorial Growth

Stirling’s Formula

Matlab M-File functioncompareGamma(M); m = [1:M]';half=1/2; fact = gamma(m+1); plot( m, fact, 'b*-');grid title('m! = Gamma(m+1) - Grows very fast'); xlabel('m');ylabel('G(m)'); %try logs to compress the dynamic range figure(2) subplot(121); stir = sqrt(2*pi).*m.^(m+half).*exp(-m); semilogy( m, fact, 'b*-',m,stir,'ro');grid subplot(122); RE = abs(stir-fact)./fact; semilogy(m,RE,'r*');grid title('Relative Error'); figure(1)

Unordered selection wo/ Repetition What if we select without regard to the order. Solve this by reconsidering ordered selection wo/ replacement of k objects from N-set Each such selection resulted a k-tuple that indexed the selection a_i is that object selected on the i^th turn But a k-tuple can be reordered (permuted) in k! ways Therefore we need to reduce our result to N(N-1)…(N-k+1)/k! = N! / (N-k)! K! Combinations - binomial coefficient ( N choose k )

Tabular View Repetition With Without W/ Order N^k N!/(N-k)! WO/ Order (N+k-1)!/ (N-1)! k! N!/(N-k)!k! (N+k-1 choose k) (N choose k) It is easier to remember these, when they are considered as a group

Computing Binomial Coefficient { n choose k } = n! / (n-k)! k! But n! = gamma(n+1) = G(n+1) (gamma.m) { n choose k } = G(n+1)/G(n+1-k) G(k+1) Even better to use loggamma = log(Gamma(m)) { n choose k } = exp( gammln(n+1) -gammaln(n+1-k) -gammaln(k+1) )

More Binomial Coefficient binomialcoef(n) Think (1+x)^n. The coefficients: 1 1 1 2 1 1 3 3 1 1 3 5 3 1 1 4 9 9 4 1 1 6 15 19 15 6 1 Computation – recursion, approximate, logGamma

Matlab Code function binomialcoef(n); %generates an array of binomial coefficients k = [0:n]; lgGn = gammaln(n+1); lgGnk = gammaln(n+1-k); lgGk = gammaln(k+1); bico = exp( lgGn -lgGnk -lgGk ); bico = floor(bico); fprintf('%5.0f', bico);

Unordered w/ Repetition This is the most complicated situation so far Thinks for a long time, then come up with a Clever way to represent a selection bars & balls 4 objects choose 2  o||o| select object 1 and 3 Another choice is |||oo select object 4 twice To select k objects from N-set Use N-1 bars and k balls  string of |||oo But these can be drawn in ( N+k-1 choose k) ways (N+k-1)!/(N-1)!k!

Tabular View Repetition With Without W/ Order N^k N!/(N-k)! WO/ Order (N+k-1)!/ (N-1)! k! N!/(N-k)!k! (N+k-1 choose k) (N choose k) It is easier to remember these, when they are considered as a group