Counting integral solutions

Similar documents
Counting integral solutions

Reading 14 : Counting

Lecture 18 - Counting

Chapter 5: Probability: What are the Chances? Section 5.2 Probability Rules

MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability (solutions)

Problem Set 8 Solutions R Y G R R G

MATHEMATICS 152, FALL 2004 METHODS OF DISCRETE MATHEMATICS Outline #10 (Sets and Probability)

Problem Set 8 Solutions R Y G R R G

Introduction to probability

8.2 Union, Intersection, and Complement of Events; Odds

CSE 20 DISCRETE MATH. Fall

Cardinality revisited

Jong C. Park Computer Science Division, KAIST

CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions)

Permutation Groups. Every permutation can be written as a product of disjoint cycles. This factorization is unique up to the order of the factors.

Finite and Infinite Sets

Problems from 9th edition of Probability and Statistical Inference by Hogg, Tanis and Zimmerman:

Principle of Inclusion-Exclusion Notes

Today s Topics. Sometimes when counting a set, we count the same item more than once

Combinatorial Proofs

Intermediate Math Circles November 1, 2017 Probability I

Math 127: Equivalence Relations

Math 365 Wednesday 2/20/19 Section 6.1: Basic counting

Chapter 1. Probability

Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1:

Section Summary. Permutations Combinations Combinatorial Proofs

Counting. Chapter 6. With Question/Answer Animations

Counting in Algorithms

Poker Hands. Christopher Hayes

It is important that you show your work. The total value of this test is 220 points.

If you roll a die, what is the probability you get a four OR a five? What is the General Education Statistics

Compound Probability. Set Theory. Basic Definitions

Dealing with some maths

MA 524 Midterm Solutions October 16, 2018

With Question/Answer Animations. Chapter 6

Define and Diagram Outcomes (Subsets) of the Sample Space (Universal Set)

POKER (AN INTRODUCTION TO COUNTING)

Tribute to Martin Gardner: Combinatorial Card Problems

7.1 Experiments, Sample Spaces, and Events

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

An interesting class of problems of a computational nature ask for the standard residue of a power of a number, e.g.,

Introduction to Computational Manifolds and Applications

MATH6 - Introduction to Finite Mathematics

CISC-102 Fall 2017 Week 8

MATH 433 Applied Algebra Lecture 12: Sign of a permutation (continued). Abstract groups.

DVA325 Formal Languages, Automata and Models of Computation (FABER)

The probability set-up

Chapter 2 Integers. Math 20 Activity Packet Page 1

Permutations: The number of arrangements of n objects taken r at a time is. P (n, r) = n (n 1) (n r + 1) =

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

LET S PLAY PONTOON. Pontoon also offers many unique payouts as well as a Super Bonus of up to $5000 on certain hands.

CMPSCI 240: Reasoning Under Uncertainty First Midterm Exam

Sec$on Summary. Permutations Combinations Combinatorial Proofs

Activity 1: Play comparison games involving fractions, decimals and/or integers.

Math 1111 Math Exam Study Guide

Week 1: Probability models and counting

CS 202, section 2 Final Exam 13 December Pledge: Signature:

6.1 Basics of counting

Discrete Finite Probability Probability 1

November 6, Chapter 8: Probability: The Mathematics of Chance

Chapter 1: Sets and Probability

Developed by Rashmi Kathuria. She can be reached at

Mat 344F challenge set #2 Solutions

CS 237 Fall 2018, Homework SOLUTION

1 = 3 2 = 3 ( ) = = = 33( ) 98 = = =

Counting (Enumerative Combinatorics) X. Zhang, Fordham Univ.

4.1 Sample Spaces and Events

1. An office building contains 27 floors and has 37 offices on each floor. How many offices are in the building?

Chapter 2. Permutations and Combinations

Such a description is the basis for a probability model. Here is the basic vocabulary we use.

The probability set-up

Probability (Devore Chapter Two)

Math Exam 2 Review. NOTE: For reviews of the other sections on Exam 2, refer to the first page of WIR #4 and #5.

Math-Essentials. Lesson 9-2: Counting Combinations

Math Exam 2 Review. NOTE: For reviews of the other sections on Exam 2, refer to the first page of WIR #4 and #5.

Tutorial 1. (ii) There are finite many possible positions. (iii) The players take turns to make moves.

X = {1, 2,...,n} n 1f 2f 3f... nf

Slide 1 Math 1520, Lecture 13

Chapter 1. Probability

Poker: Further Issues in Probability. Poker I 1/29

Suppose you are supposed to select and carry out oneof a collection of N tasks, and there are T K different ways to carry out task K.

n! = n(n 1)(n 2) 3 2 1

DISCUSSION #8 FRIDAY MAY 25 TH Sophie Engle (Teacher Assistant) ECS20: Discrete Mathematics

More Probability: Poker Hands and some issues in Counting

Practice Midterm 2 Solutions

and problem sheet 7

Food for Thought. Robert Won

Countability. Jason Filippou UMCP. Jason Filippou UMCP) Countability / 12

1. The empty set is a proper subset of every set. Not true because the empty set is not a proper subset of itself! is the power set of A.

The Classification of Quadratic Rook Polynomials of a Generalized Three Dimensional Board

CMPSCI 240: Reasoning Under Uncertainty First Midterm Exam

Lecture 3 Presentations and more Great Groups

LESSON 2: THE INCLUSION-EXCLUSION PRINCIPLE

Cardinality and Bijections

Math 1111 Math Exam Study Guide

Classical vs. Empirical Probability Activity

I. WHAT IS PROBABILITY?

Counting and Probability Math 2320

Transcription:

Thought exercise 2.2 25 Counting integral solutions Question: How many non-negative integer solutions are there of x 1 + x 2 + x 3 + x 4 =10? Give some examples of solutions. Characterize what solutions look like. A combinatorial object with a similar flavor is: In general, the number of non-negative integer solutions to x 1 + x 2 + + x n = k is. Question: How many positive integer solutions are there of x 1 + x 2 + x 3 + x 4 = 10, where x 4 3?

Overcounting 1.2 26 The sum principle Often it makes sense to break down your counting problem into smaller, disjoint, and easier-to-count sub-problems. Example. How many integers from 1 to 999999 are palindromes? Answer: Condition on how many digits. Length 1: Length 4: Length 2: Length 5,6: Length 3: Total: Every palindrome between 1 and 999999 is counted once. This illustrates the sum principle: Suppose the objects to be counted can be broken into k disjoint and exhaustive cases. If there are n j objects in case j, then there are n 1 + n 2 + + n k objects in all.

Overcounting 1.2 27 Counting pitfalls When counting, there are two common pitfalls: Undercounting Often, forgetting cases when applying the sum principle. Ask: Did I miss something? Overcounting Often, misapplying the product principle. Ask: Do cases need to be counted in different ways? Ask: Does the same object appear in multiple ways? Common example: A deck of cards. There are four suits: Diamond, Heart, Club, Spade. Each has 13 cards: Ace, King, Queen, Jack, 10,9,8,7,6,5,4,3,2. Example. Suppose you are dealt two diamonds between 2 and 10. In how many ways can the product be even?

Overcounting 1.2 28 Overcounting Example. In Blackjack you are dealt 2 cards: 1 face-up, 1 face-down. In how many ways can the face-down card be an Ace and the face-up card be a Heart? Answer: There are aces, so there are choices for the down card. There are hearts, so there are choices for the up card. By the product principle, there are 52 ways in all. Except: Remember to ask: Do cases need to be counted in different ways?

Overcounting 1.2 29 Overcounting Example. How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Examples: 1114, 1229, 5555 Non-examples: 1231, 9898. Strategy: 1. Choose where the adjacent equal elements are. ( ways) 2. Choose which number they are. ( ways) 3. Choose the numbers for the remaining elements. ( ways) By the product principle, there are ways in all. Except: Remember to ask: Does the same object appear in multiple ways?

Overcounting 1.2 30 Counting the complement Q1: How many 4-lists taken from [9] have at least one pair of adjacent elements equal? Compare this to Q2: How many 4-lists taken from [9] have no pairs of adjacent elements equal? What can we say about: Q1: Q2: Together: Q3: Strategy: It is sometimes easier to count the complement. Answer to Q3: Answer to Q2: Answer to Q1:

Overcounting 1.2 31 Poker hands Example. When playing five-card poker, what is the probability that you are dealt a full house? [Three cards of one type and two cards of another type.] 555KK Game plan: Count the total number of hands. Count the number of possible full houses. Choose the denomination of the three-of-a-kind. Choose which three suits they are in. Choose the denomination of the pair. Choose which two suits they are in. Apply the multiplication principle. Total: Divide to find the probability. # of ways

Bijections 1.3 32 Introduction to Bijections Key tool: A useful method of proving that two sets A and B are of the same size is by way of a bijection. A bijection is a function or rule that pairs up elements of A and B. Example. The set A of subsets of {s 1, s 2, s 3 } are in bijection with the set B of binary words of length 3. { Set A:, {s1 },{s 2 },{s 1, s 2 },{s 3 },{s 1, s 3 },{s 2, s 3 },{s 1, s 2, s 3 } } Bijection: { } Set B: 000, 100, 010, 110, 001, 101, 011, 111 Rule: Given a A, (a is a subset), define b B (b is a word): If s i a, thenletteri in b is 1. If s i / a, thenletteri in b is 0. Difficulties: Finding the function or rule (requires rearranging, ordering) Proving the function or rule (show it IS abijection).

Bijections 1.3 33 What is a Function? Reminder: A function f from A to B (write f : A B) is a rule where for each element a A, f (a) isdefinedasanelementb B (write f : a b). A is called the domain. (We write A =dom(f )) B is called the codomain. (We write B =cod(f )) The range of f is the set of values that f takes on: rng(f )= { b B : f (a) =b for at least one a A } Example. Let A be the set of 3-subsets of [n] andletb be the set of 3-lists of [n]. Then define f : A B to be the function that takes a3-subset{i 1, i 2, i 3 } A (with i 1 i 2 i 3 ) to the word i 1 i 2 i 3 B. Question: Is rng(f )=B?

Bijections 1.3 34 What is a Bijection? Definition: Afunctionf : A B is one-to-one (an injection) when For each a 1, a 2 A, iff (a 1 )=f (a 2 ), then a 1 = a 2. Equivalently, For each a 1, a 2 A, ifa 1 a 2,thenf (a 1 ) f (a 2 ). When the inputs are different, the outputs are different. (picture) Definition: Afunctionf : A B is onto (a surjection) when For each b B, there exists some a A such that f (a) =b. Every output gets hit. Definition: Afunctionf : A B is a bijection if it is both one-to-one and onto. The function from the previous page is. What is an example of a function that is onto and not one-to-one?

Bijections 1.3 35 Proving a Bijection Example. Use a bijection to prove that ( n) ( k = n n k) for 0 k n. Proof. Let A be the set of k-subsets of [n] and let B be the set of (n k)-subsets of [n]. AbijectionbetweenA and B will prove ( n k Step 1: Find a candidate bijection. ) = A = B = ( n n k). Strategy. Try out a small (enough) example. Try n =5andk =2. {1, 2}, {1, 3} {1, 4}, {1, 5} {2, 3}, {2, 4} {2, 5}, {3, 4} {3, 5}, {4, 5} {1, 2, 3}, {1, 2, 4} {1, 2, 5}, {1, 3, 4} {1, 3, 5}, {1, 4, 5} {2, 3, 4}, {2, 3, 5} {2, 4, 5}, {3, 4, 5} Guess: Let S be a k-subset of [n]. Perhaps f (S) =.

Bijections 1.3 36 Proving a Bijection Step 2: Prove f is well defined. The function f is well defined. If S is any k-subset of [n], then S c is a subset of [n] withn k members. Therefore f : A B. Step 3: Prove f is a bijection. Strategy. Prove that f is both one-to-one and onto. f is 1-to-1: Suppose that S 1 and S 2 are two k-subsets of [n] such that f (S 1 )=f(s 2 ). That is, S1 c = S 2 c.thismeansthatforalli [n], then i / S 1 if and only if i / S 2. Therefore S 1 = S 2 and f is 1-to-1. f is onto: Suppose that T B is an (n k)-subset of [n]. We must find a set S A satisfying f (S) =T.ChooseS =. Then S A (why?), and f (S) =S c = T,sof is onto. We conclude that f is a bijection and therefore, ( n k ) = ( n n k).

Bijections 1.3 37 Using the Inverse Function When f : A B is 1-to-1, we can define f s inverse. We write f 1, and it is a function from rng(f ) to A. It is defined via f.iff : a b, thenf 1 : b a. Caution: When f is a function from A to B, f 1 might not be a function from B to A. Theorem. Suppose that A and B are finite sets and that f : A B is a function. If f 1 is a function with domain B, thenf is a bijection. Proof. Since f 1 is only defined when f is 1-to-1, we need only prove that f is onto. Suppose b B. Byassumption,f 1 (b) A exists and f (f 1 (b)) = b. Sof is onto, and is a bijection. Consequence: An alternative method for proving a bijection is: Find a rule g : B A which always takes f (a) backtoa. Verify that the domain of g is all of B.

Bijections 1.3 38 Using the Inverse Function Example. There exists as many even-sized subsets of [n] as odd-sized subsets of [n]. { even:, {s1, s 2 },{s 1, s 3 }, {s 2, s 3 } } { odd: {s1 }, {s 2 }, {s 3 }, {s 1, s 2, s 3 } } Proof. Let A be the set of even-sized subsets of [n] andletb be the set of odd-sized subsets { of [n]. Consider the } function S {1} if 1 S f (S) =. S {1} if 1 / S f : A B is a well defined function from A to B (why?). f 1 exists and equals f (why?) and has domain B (why?). Therefore, f is a bijection, proving the statement, as desired. n Eyebrow-Raising Consequence: ( 1) k( n k) =0. k=0