JA Ritcey EE Please elaborate with your own illustrations!

Slides:



Advertisements
Similar presentations
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,
Advertisements

Chapter 2 Concepts of Prob. Theory
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.
©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
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)
Virtual University of Pakistan Lecture No. 16 Statistics and Probability Miss Saleha Naghmi Habibullah.
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.
Sets, Permutations, and Combinations. Lecture 4-1: Sets Sets: Powerful tool in computer science to solve real world problems. A set is a collection of.
Principle of Inclusion and Exclusion
Chapter 4 Introduction to Set Theory
Probability Theory Basic concepts Probability Permutations
Please elaborate with your own illustrations!
Unions and Intersections of Sets
Introduction to Discrete Mathematics
CSC 321: Data Structures Fall 2015 Counting and problem solving
10.7: Probability of Compound Events Test : Thursday, 1/16
Copyright © Zeph Grunschlag,
Discrete Structures for Computer Science
Set, Combinatorics, Probability & Number Theory
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.
CS201: Data Structures and Discrete Mathematics I
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
SEVENTH EDITION and EXPANDED SEVENTH EDITION
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.
Counting II: Recurring Problems And Correspondences
Lecture Sets 2.2 Set Operations.
Sets & 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:

JA Ritcey EE416-2013 Please elaborate with your own illustrations! Sets and Counting JA Ritcey EE416-2013 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. Often simpler using indicator functions I_A (x) 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

Selection w/ Replacement Given a base N-set S In how many ways can we select k objects Assume a selection With Replacement. So that repetition is possible. We can do this is N^k ways by the multiplication principle N^k = NxNx…xN k-times 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)

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

Selection WO/ Replacement Given a base N-set S In how many ways can we select k objects Assume a Selection 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

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)

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 )

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 (1+x)^3 = 1x^0 + 3x^1 +3x^2 +1x^3 for example 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 Think, 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! = ( N+k-1 choose N-1)

Tabular View Repetition With Without W/ Order N^k (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