Docsity

Counting and Probability: Elements in Lists, Probability of Events, and Combinatorics - Pr, Study notes of Discrete Structures and Graph Theory

Toggle sidebar
bg1
1
Counting Elements in a List
• How many integers in the list from 1 to 10?
• How many integers in the list from m to n?
(assuming m <= n)
How many in a list divisible by something:
• How many positive three digit integers are there?
– (this means only the ones that require 3 digits)
– 999 – 100 + 1 = 900
• How many three digit integers are divisible by 5?
– think about the definition of divisible by
x | y ↔ ∃ k ∈Z, y = kx and then count the k’s that work
100, 101, 102, 103, 104, 105, 106,… 994, 995, 996, 997, 998, 999
20*5 21*5 … 199*5
– count the integers between 20 and 199
– 199 – 20 + 1 = 180
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Counting and Probability: Elements in Lists, Probability of Events, and Combinatorics - Pr and more Study notes Discrete Structures and Graph Theory in PDF only on Docsity!

Counting Elements in a List

  • How many integers in the list from 1 to 10?
  • How many integers in the list from m to n? (assuming m <= n)

How many in a list divisible by something:

  • How many positive three digit integers are there?
    • (this means only the ones that require 3 digits)
    • 999 – 100 + 1 = 900
  • How many three digit integers are divisible by 5?
    • think about the definition of divisible by x | y ↔ ∃ k ∈Z, y = kx and then count the k’s that work 100, 101, 102, 103, 104, 105, 106,… 994, 995, 996, 997, 998, 999 205 215 … 199*
    • count the integers between 20 and 199
    • 199 – 20 + 1 = 180

Probability

likelihood of a specific event

  • Sample Space = set of all possible outcomes
  • Event = subset of sample space
  • Equal Probability Formula:
    • Given a finite sample space S where all outcomes are equally likely
    • Select an event E from the sample space S
    • The probability of event E from sample space S:

n S

n E

P E =

Flipping Two Coins

  • Sample Space = {(H,H), (H,T), (T,H), (T,T)}
  • Probability of no heads
  • Probability of at least one head
  • Probability of same sides on the two coins
  • Note: probability & actual outcomes often differ

Multi-level Probability

  • If I toss a coin once – the probability of Head = ½
  • If I toss that coin 5 times
    • the probability of all heads
    • the probability of exactly 4 heads

Multiplication Rule

  • 1st^ step can be performed n 1 ways
  • 2nd^ step can be performed n 2 ways
  • …
  • Kth^ step can be performed nk ways
  • operation can be performed n 1 *n 2 …nk ways
  • Cartesian product n(A)=3, n(B)=2, n(C)=
    • n(AxBxC) = 24
    • n(AxB) = 6 n((AxB)xC) = 24

Tournament Play

  • Team A and Team B in “Best of 3” Tournament
  • where they each have an equal likelihood of winning each game - Do leaves add up to 1? - Do we have to play 3 games? - Do A and B have an equal chance of winning?

What if A wins 2 of every 3 games?

  • Each line for A must have a 2/
  • Each line for B must have a 1/
  • How likely is A to win the tournament?
  • How likely is B to win the tournament?

Difference Rule Formally

  • If A is a finite set and B ⊆A, then n(A-B) = n(A) – n(B)
  • One Application: probability of the complement of an event P(E’) = P(Ec) = 1-P(E)

PINs with less specified length

Addition Rule

  • Assume it can be a 2,3 or 4 length PIN Partition the problem number of 2 length PINs w/rep allowed: 44 = 16 number of 3 length PINs w/rep allowed: 444 = 64 number of 4 length PINs w/rep allowed: 4444 = 256

Number PINs if allowing length of 2,3 or 4 = 336

Addition Rule Formally

  • if A 1  A 2  A 3 … Ak =A
  • and A 1 , A 2 , A 3 ,…,Ak are pairwise disjoint

in other words, if these subsets form a partition of A

n(A) = n(A 1 )+n(A 2 )+n(A 3 )+…+n(Ak)

Another example for

Multiplication Rule and Addition Rule

  • How many 3 digit integers are divisible by 5?
    • How many end in a 0? 9101 = 90
    • How many end in a 5? 9101 = 90
    • These form a partition with the set of numbers divisible by 5 so
    • 90 + 90 = 180

Permutations

  • Different ways of arranging objects
    • in a line or circle
    • without duplication/ all items distinguishable
    • note: order is taken into account
  • Number of linear permutations of N objects = N! N possible for 1st^ position * (N-1) for 2nd^ * …* (1) for last
  • Number of circular permutations of N objects = (N-1)! Fix one person, then (N-1) possible for next position * (N-2) for 2nd^ * …* (1) for last

r-Permutations

If there are n things in the set, and you want to line-up only r of them.

  • Example: Class = {Alice, Bob, Carol, Dan}
    • select a president and a vice president to represent the class

( )!

! ( , ) n r

n P n r r Pn −

= =

Combinations

  • Different ways of selecting objects
    • Counting Subsets
    • without duplication/ all items distinguishable
    • note: order is not taken into account
  • Examples: Class = {Alice, Bob, Carol, Dan}
    • select two class representatives
    • select three class representatives

( ) ( )!!

! !

( , ) ( , ) n r r

n r

P n r C n r nr −

= = =

∀ n , r ∈ Z ≥^0 wheren ≥ r ,

Harder Examples

selecting “class representatives”

Class = {Alice,Bob,Carol,Dan, Erin, Fred}

  • select 2 – no restrictions
  • select 2 – assuming Alice and Bob must stay together
  • select 3 – no restrictions
  • select 3 – assuming Alice and Bob must stay together
  • select 3 – assuming Alice and Bob refuse to serve together

Combinations with Repetition

  • {a,b,c,d,e}
  • How many 3-combinations can I make without repetition?
  • How many 3-combinations can I make with unlimited repetition allowed?
  • these are multisets [a,b,c]
    • not sets {a,b,c}
    • not tuples (a,b,c)

Probability with Combinations

  • Assume there are 32 people in the class
  • And that 7 will be chosen to get extra homework
  • What is the probability that you get extra homework
  • Number of ways to select the “lucky 7”
  • Number of ways to select if “I get HW”
  • P(I get HW)

Properties of r-Permutations

and proofs of those properties

P(n,1) = n P(n,2) = n^2 -n P(n,2) + P(n,1) = n^2

P(n,n) = n! P(n,n-1) = n!

Properties of Combinations and

their proofs

( n n ) = 1

n n r

n

r = −

( 0 n ) = 1

2

( 1 ) 2

− −^ =

n n^ n n

( n n − 1 ) = n

2

( 1 ) 2

−

n n n

( 1 n^ ) = n

Conditional Probability

  • Probability of B given that A is known to have happened
  • If P(B) = P(B|A) then event B is Independent of event A

( )

( ) ( | ) P A

P A B P B A