Discrete Mathematics Lecture 7 Harper Langston New York University.

Slides:



Advertisements
Similar presentations
COUNTING AND PROBABILITY
Advertisements

Application: The Pigeonhole Principle Lecture 37 Section 7.3 Wed, Apr 4, 2007.
(CSC 102) Lecture 21 Discrete Structures. Previous Lecture Summery  Sum/Difference of Two Functions  Equality of Two Functions  One-to-One Function.
Chapter 2 Probability. 2.1 Sample Spaces and Events.
Functions, Pigeonhole Principle Lecture 14: Nov 4 A B f( ) =
Counting and Probability The outcome of a random process is sure to occur, but impossible to predict. Examples: fair coin tossing, rolling a pair of dice,
Discrete Structures Chapter 5 Pigeonhole Principle Nurul Amelina Nasharuddin Multimedia Department.
Discrete Mathematics Lecture 7 More Probability and Counting Harper Langston New York University.
Discrete Mathematics Lecture 2 Logic of Quantified Statements,
Terminology Domain: set which holds the values to which we apply the function Co-domain: set which holds the possible values (results) of the function.
Discrete Mathematics Lecture 7 Alexander Bukharovich New York University.
Terminology Domain: set which holds the values to which we apply the function Co-domain: set which holds the possible values (results) of the function.
Functions f( ) = A B Lecture 15: Nov 4.
Discrete Mathematics Lecture 5
Pigeonhole.
Discrete Mathematics Lecture 6 Alexander Bukharovich New York University.
1 Section 1.8 Functions. 2 Loose Definition Mapping of each element of one set onto some element of another set –each element of 1st set must map to something,
CS 2210 (22C:019) Discrete Structures Sets and Functions Spring 2015 Sukumar Ghosh.
Week 10 - Monday.  What did we talk about last time?  More permutations  Addition rule  Inclusion and exclusion.
Chapter 7 Functions Dr. Curry Guinn. Outline of Today Section 7.1: Functions Defined on General Sets Section 7.2: One-to-One and Onto Section 7.3: The.
1 CMSC 250 Chapter 7, Functions. 2 CMSC 250 Function terminology l A relationship between elements of two sets such that no element of the first set is.
Functions A B f( ) =. This Lecture We will define a function formally, and then in the next lecture we will use this concept in counting. We will also.
Fall 2015 COMP 2300 Discrete Structures for Computation
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Topics to be covered: Produce all combinations and permutations of sets. Calculate the number of combinations and permutations of sets of m items taken.
Foundations of Discrete Mathematics Chapter 3 By Dr. Dalia M. Gil, Ph.D.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
Lecture 6: Signal Processing III EEN 112: Introduction to Electrical and Computer Engineering Professor Eric Rozier, 2/25/13.
Week 7 - Friday.  What did we talk about last time?  Set disproofs  Russell’s paradox  Function basics.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
March 10, 2015Applied Discrete Mathematics Week 6: Counting 1 Permutations and Combinations How many different sets of 3 people can we pick from a group.
3. Counting Permutations Combinations Pigeonhole principle Elements of Probability Recurrence Relations.
Relations, Functions, and Matrices Mathematical Structures for Computer Science Chapter 4 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesFunctions.
1 CSC 321: Data Structures Fall 2013 Counting and problem solving  mappings, bijection rule  sequences, product rule, sum rule  generalized product.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Copyright  The McGraw-Hill Companies, Inc. Permission required for reproduction.
Week 11 - Wednesday.  What did we talk about last time?  Exam 2 post-mortem  Combinations.
FUNCTIONS.
Week 21 Conditional Probability Idea – have performed a chance experiment but don’t know the outcome (ω), but have some partial information (event A) about.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.1 and 7.2.
Agenda Week 10 Lecture coverage: –Functions –Types of Function –Composite function –Inverse of a function.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 4 Counting methods and the pigeonhole principle.
Discrete Mathematics R. Johnsonbaugh
MATH 224 – Discrete Mathematics
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 6 Counting and Probability Instructor: Hayk Melikyan Today we will review sections 6.6,
Basic Structures: Sets, Functions, Sequences, and Sums.
Sets Definition: A set is an unordered collection of objects, called elements or members of the set. A set is said to contain its elements. We write a.
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 7 Functions Instructor: Hayk Melikyan Today we will review sections 7.3, 7.4 and 7.5.
FUNCTIONS COSC-1321 Discrete Structures 1. Function. Definition Let X and Y be sets. A function f from X to Y is a relation from X to Y with the property.
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Relations and Functions ORDERED PAIRS AND CARTESIAN PRODUCT An ordered pair consists of two elements, say a and b, in which one of them, say a is designated.
Functions CSRU1400 Spring 2008Ellen Zhang 1 CISC1400, Fall 2010 Ellen Zhang.
Pigeonhole Principle. If n pigeons fly into m pigeonholes and n > m, then at least one hole must contain two or more pigeons A function from one finite.
Week 7 - Wednesday.  What did we talk about last time?  Proving the subset relationship  Proving set equality  Set counterexamples  Laws of set algebra.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
Week 10 - Monday.  What did we talk about last time?  Combinations  Binomial theorem.
Week 8 - Wednesday.  What did we talk about last time?  Relations  Properties of relations  Reflexive  Symmetric  Transitive.
Week 9 - Friday.  What did we talk about last time?  Permutations  Counting elements in sets  Brief introduction to combinations.
Discrete Mathematics Lecture 6
Discrete Mathematics Lecture 3 (and 4)
The Pigeonhole Principle
Discrete Mathematics Lecture 8 Probability and Counting
Functions 1.
CS 2210:0001 Discrete Structures Sets and Functions
Discrete Mathematics Lecture 7
What is Probability? Quantification of uncertainty.
9. Counting and Probability 1 Summary
Lecture 7 Functions.
COUNTING AND PROBABILITY
Functions Rosen 2.3, 2.5 f( ) = A B Lecture 5: Oct 1, 2.
Presentation transcript:

Discrete Mathematics Lecture 7 Harper Langston New York University

Poker Problems What is a probability to contain one pair? What is a probability to contain two pairs? What is a probability to contain a triple? What is a probability to contain royal flush? What is a probability to contain straight flush? What is a probability to contain straight? What is a probability to contain flush? What is a probability to contain full house?

Combinations with Repetition An r-combination with repetition allowed is an unordered selection of elements where some elements can be repeated The number of r-combinations with repetition allowed from a set of n elements is C(r + n –1, r) Soft drink example

Algebra of Combinations and Pascal’s Triangle The number of r-combinations from a set of n elements equals the number of (n – r)- combinations from the same set. Pascal’s triangle: C(n + 1, r) = C(n, r – 1) + C(n, r) C(n,r) = C(n,n-r)

Binomial Formula (a + b) n =  C(n, k)a k b n-k Examples Show that  C(n, k) = 2 n Show that  (-1) k C(n, k) = 0 Express  kC(n, k)3 k in the closed form

Probability Axioms P(A c ) = 1 – P(A) P(A  B) = P(A) + P(B) – P(A  B) –What if A and B mutually disjoint? (Then P(A  B) = 0)

Conditional Probability For events A and B in sample space S if P(A)  0, then the probability of B given A is: P(A | B) = P(A  B)/P(A) Example with Urn and Balls: - An urn contains 5 blue and

Conditional Probability Example An urn contains 5 blue and 7 gray balls. 2 are chosen at random. - What is the probability they are blue? - Probability first is not blue but second is? - Probability second ball is blue? - Probability at least one ball is blue? - Probability neither ball is blue?

Conditional Probability Extended Imagine one urn contains 3 blue and 4 gray balls and a second urn contains 5 blue and 3 gray balls Choose an urn randomly and then choose a ball. What is the probability that if the ball is blue that it came from the first urn?

Bayes’ Theorem Extended version of last example. If S, our sample space, is the union of n mutually disjoint events, B1, B2, …, Bn and A is an even in S with P(A)  0 and k is an integer between 1 and n, then: P(Bk | A) = P(A | Bk) * P(Bk). P(A | B1)*P(B1) + … + P(A | Bn)*P(Bn) Application: Medical Tests (false positives, etc.)

Independent Events If A and B are independent events, P(A  B) = P(A)*P(B) If C is also independent of A and B P(A  B  C) = P(A)*P(B)*P(C) Difference from Conditional Probability can be seen via Russian Roulette example.

Generic Functions A function f: X  Y is a relationship between elements of X to elements of Y, when each element from X is related to a unique element from Y X is called domain of f, range of f is a subset of Y so that for each element y of this subset there exists an element x from X such that y = f(x) Sample functions: –f : R  R, f(x) = x 2 –f : Z  Z, f(x) = x + 1 –f : Q  Z, f(x) = 2

Generic Functions Arrow diagrams for functions Non-functions Equality of functions: –f(x) = |x| and g(x) = sqrt(x 2 ) Identity function Logarithmic function

One-to-One Functions Function f : X  Y is called one-to-one (injective) when for all elements x 1 and x 2 from X if f(x 1 ) = f(x 2 ), then x 1 = x 2 Determine whether the following functions are one-to-one: –f : R  R, f(x) = 4x – 1 –g : Z  Z, g(n) = n 2 Hash functions

Onto Functions Function f : X  Y is called onto (surjective) when given any element y from Y, there exists x in X so that f(x) = y Determine whether the following functions are onto: –f : R  R, f(x) = 4x – 1 –f : Z  Z, g(n) = 4n – 1 Bijection is one-to-one and onto Reversing strings function is bijective

Inverse Functions If f : X  Y is a bijective function, then it is possible to define an inverse function f -1 : Y  X so that f -1 (y) = x whenever f(x) = y Find an inverse for the following functions: –String-reverse function –f : R  R, f(x) = 4x – 1 Inverse function of a bijective function is a bijective function itself

Pigeonhole Principle If n pigeons fly into m pigeonholes and n > m, then at least one hole must contain two or more pigeons A function from one finite set to a smaller finite set cannot be one-to-one In a group of 13 people must there be at least two who have birthday in the same month? A drawer contains 10 black and 10 white socks. How many socks need to be picked to ensure that a pair is found? Let A = {1, 2, 3, 4, 5, 6, 7, 8}. If 5 integers are selected must at least one pair have sum of 9?

Pigeonhole Principle Generalized Pigeonhole Principle: For any function f : X  Y acting on finite sets, if n(X) > k * N(Y), then there exists some y from Y so that there are at least k + 1 distinct x’s so that f(x) = y “If n pigeons fly into m pigeonholes, and, for some positive k, m >k*m, then at least one pigeonhole contains k+1 or more pigeons” In a group of 85 people at least 4 must have the same last initial. There are 42 students who are to share 12 computers. Each student uses exactly 1 computer and no computer is used by more than 6 students. Show that at least 5 computers are used by 3 or more students.

Composition of Functions Let f : X  Y and g : Y  Z, let range of f be a subset of the domain of g. The we can define a composition of g o f : X  Z Let f,g : Z  Z, f(n) = n + 1, g(n) = n^2. Find f o g and g o f. Are they equal? Composition with identity function Composition with an inverse function Composition of two one-to-one functions is one- to-one Composition of two onto functions is onto

Cardinality Cardinality refers to the size of the set Finite and infinite sets Two sets have the same cardinality when there is bijective function associating them Cardinality is is reflexive, symmetric and transitive Countable sets: set of all integers, set of even numbers, positive rationals (Cantor diagonalization) Set of real numbers between 0 and 1 has same cardinality as set of all reals Computability of functions