Discrete Mathematics Lecture 5 Harper Langston New York University

Preview:

Citation preview

Discrete MathematicsLecture 5

Harper Langston

New York University

Empty Set

• S = {x R, x2 = -1}• X = {1, 3}, Y = {2, 4}, C = X Y

(X and Y are disjoint)• Empty set has no elements • Empty set is a subset of any set• There is exactly one empty set• Properties of empty set:

– A = A, A = – A Ac = , A Ac = U– Uc = , c = U

Set Partitioning

• Two sets are called disjoint if they have no elements in common

• Theorem: A – B and B are disjoint• A collection of sets A1, A2, …, An is called

mutually disjoint when any pair of sets from this collection is disjoint

• A collection of non-empty sets {A1, A2, …, An} is called a partition of a set A when the union of these sets is A and this collection consists of mutually disjoint sets

Power Set

• Power set of A is the set of all subsets of A

• Example on board

• Theorem: if A B, then P(A) P(B)

• Theorem: If set X has n elements, then P(X) has 2n elements (proof in Section 5.3 – will show if have time)

Cartesian Products

• Ordered n-tuple is a set of ordered n elements. Equality of n-tuples

• Cartesian product of n sets is a set of n-tuples, where each element in the n-tuple belongs to the respective set participating in the product

Set Properties

• Inclusion of Intersection:A B A and A B B

• Inclusion in Union:A A B and B A B

• Transitivity of Inclusion:(A B B C) A C

• Set Definitions:x X Y x X y Yx X Y x X y Yx X – Y x X y Yx Xc x X(x, y) X Y x X y Y

Set Identities

• Commutative Laws: A B = A B and A B = B A

• Associative Laws: (A B) C = A (B C) and (A B) C = A (B C)

• Distributive Laws:

A (B C) = (A B) (A C) and A (B C) = (A B) (A C)

• Intersection and Union with universal set: A U = A and A U = U

• Double Complement Law: (Ac)c = A

• Idempotent Laws: A A = A and A A = A

• De Morgan’s Laws: (A B)c = Ac Bc and (A B)c = Ac Bc

• Absorption Laws: A (A B) = A and A (A B) = A

• Alternate Representation for Difference: A – B = A Bc

• Intersection and Union with a subset: if A B, then A B = A and A B = B

Proving Equality

• First show that one set is a subset of another (what we did with examples before)

• To show this, choose an arbitrary particular element as with direct proofs (call it x), and show that if x is in A then x is in B to show that A is a subset of B

• Example (step through all cases)

Disproofs, Counterexamples and Algebraic Proofs

• Is is true that (A – B) (B – C) = A – C?(No via counterexample)

• Show that (A B) – C = (A – C) (B – C)(Can do with an algebraic proof, slightly different)

Boolean Algebra

• A Boolean Algebra is a set of elements together with two operations denoted as + and * and satisfying the following properties:Commutative: a + b = b + a, a * b = b * a

Associative: (a + b) + c = a + (b + c), (a * b) *c = a * (b * c)

Distributive: a + (b * c) = (a + b) * (a + c), a * (b + c) = (a * b) + (a * c)

Identity: a + 0 = a, a * 1 = a for some distinct unique 0 and 1

Complement: a + ã = 1, a * ã = 0

Russell’s Paradox

• Set of all integers, set of all abstract ideas• Consider S = {A, A is a set and A A}• Is S an element of S?• Barber puzzle: a male barber shaves all those men who

do not shave themselves. Does the barber shave himself?

• Consider S = {A U, A A}. Is S S?• Godel: No way to rigorously prove that mathematics is

free of contradictions. (“This statement is not provable” is true but not provable) (consistency of an axiomatic system is not provable within that system)

Halting Problem

• There is no computer algorithm that will accept any algorithm X and data set D as input and then will output “halts” or “loops forever” to indicate whether X terminates in a finite number of steps when X is run with data set D.

• Proof is by contradiction

Counting and Probability

• Coin tossing• Random process• Sample space is the set of all possible outcomes

of a random process. An event is a subset of a sample space

• Probability of an event is the ratio between the number of outcomes that satisfy the event to the total number of possible outcomesP(E) = N(E)/N(S) for event E and sample space S

• Rolling a pair of dice and card deck as sample random processes

Possibility Trees

• Teams A and B are to play each other repeatedly until one wins two games in a row or a total three games.– What is the probability that five games will be

needed to determine the winner?

• Suppose there are 4 I/O units and 3 CPUs. In how many ways can I/Os and CPUs be attached to each other when there are no restrictions?

Multiplication Rule

• Multiplication rule: if an operation consists of k steps each of which can be performed in ni ways (i = 1, 2, …, k), then the entire operation can be performed in ni ways.

• Number of PINs• Number of elements in a Cartesian product• Number of PINs without repetition• Number of Input/Output tables for a circuit with n

input signals• Number of iterations in nested loops

Multiplication Rule

• Three officers – a president, a treasurer and a secretary are to be chosen from four people: Alice, Bob, Cindy and Dan. Alice cannot be a president, Either Cindy or Dan must be a secretary. How many ways can the officers be chosen?

Permutations

• A permutation of a set of objects is an ordering of these objects

• The number of permutations of a set of n objects is n! (Examples)

• An r-permutation of a set of n elements is an ordered selection of r elements taken from a set of n elements: P(n, r) (Examples)

• P(n, r) = n! / (n – r)!• Show that P(n, 2) + P(n, 1) = n2

Addition Rule

• If a finite set A is a union of k mutually disjoint sets A1, A2, …, Ak, then n(A) = n(Ai)

• Number of words of length no more than 3• Number of 3-digit integers divisible by 5

Difference Rule

• If A is a finite set and B is its subset, then n(A – B) = n(A) – n(B)

• How many PINS contain repeated symbols?• So, P(Ac) = 1 – P(A) (Example for PINS)• How many students are needed so that the

probability of two of them having the same birthday equals 0.5?

Inclusion/Exclusion Rule

• Page 327 for 2 sets• 3 sets

Combinations

• An r-combination of a set of n elements is a subset of r elements: C(n, r)

• Permutation is an ordered selection, combination is an unordered selection

• Quantitative relationship between permutations and combinations: P(n, r) = C(n, r) * r!

• Permutations of a set with repeated elements• Double counting

Team Selection Problems

• There are 12 people, 5 men and 7 women, to work on a project:– How many 5-person teams can be chosen?– If two people insist on working together (or not working

at all), how many 5-person teams can be chosen?– If two people insist on not working together, how many

5-person teams can be chosen?– How many 5-person teams consist of 3 men and 2

women?– How many 5-person teams contain at least 1 man?– How many 5-person teams contain at most 1 man?

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)akbn-k

• Show that C(n, k) = 2n

• Show that (-1)kC(n, k) = 0

• Express kC(n, k)3k in the closed form

Recommended