Basic Counting Rules - University of South Carolina

Download Report

Transcript Basic Counting Rules - University of South Carolina

Counting Rules and Binomial
Probabilities
Stat 509 Lecture (E. Pena)
February 12, 2001
Fundamental Theorem of Counting
Suppose you have an experiment which could be
performed in k steps, so the outcome of this
experiment will be of form:
(O1, O2, …, Ok)
where Oi is the outcome from the ith step of the
experiment.
If on the ith step there are ni distinct possible
outcomes, then the total number of possible (ordered)
outcomes in the experiment is n1n2…nk.
Counting Rules and Binomial
Probabilities
2
Some Examples
1. How many possible outcomes are there when a
coin is tossed 25 times?
Solution: (2)(2)(2)…(2) = 225
2. Suppose that a man and a woman is to be chosen
from a group of people where 10 are men and 15 are
women. How many possible choices can be made?
Solution: Step 1 is to choose the man, and there are 10
ways of doing this. Step 2 is to choose the woman and
there are 15 ways of doing this. Therefore, the number
of possible outcomes is (10)(15) = 150 ways.
Counting Rules and Binomial
Probabilities
3
3. How many possible subsets could be formed from a
set with 10 elements, if we also include the empty
subset and the whole set as a subset?
Answer: 210 = 1024. Why?
4. Suppose that you have n distinct objects. In how many
ways could these n objects be arranged in a sequence?
For example, suppose that there are 20 students in this
class, and there are available 20 chairs. In how many
ways could you be seated?
Solution: The first object can be chosen in n ways; the
next in (n-1) ways; then (n-2) ways, …, until the last
object has only one way to go. Therefore, the number of
ways is: (n)(n-1)(n-2)…(2)(1) = n! with 0! = 1.
Counting Rules and Binomial
Probabilities
4
Factorial Notation
For a positive integer, n, the factorial of n is defined via
n! = (n)(n-1)(n-2)…(2)(1).
Examples
4! = (4)(3)(2)(1) = 24
By convention, 0! = 1
7! = (7)(6!) = (7)(6)(5!)
In general, n! = n(n-1)! = n(n-1)(n-2)! = etc.
Counting Rules and Binomial
Probabilities
5
Permutations
5. Suppose that you have n distinct elements. In how
many ways could you choose r of these elements if
sampling is without replacement, and the order in which
the elements are chosen is important, that is, the samples
are ordered?
Solution: nPr = number of permutations of n objects taken
r at a time. This number is given by
n!
.
n Pr 
( n  r )!
Counting Rules and Binomial
Probabilities
6
Combinations
6. Suppose again that you have n distinct objects. In
how many ways could you form a sample of size r if
sampling is without replacement and the order in which
the objects are being included in the sample does not
matter?
Answer: nCr = number of combinations of n objects
taken r at a time. This is defined by
n
n!

.

n Cr  
 r  r!(n  r )!
 
Counting Rules and Binomial
Probabilities
7
Some Properties of Combinations
1. nC0 = 1 and nCn = 1
2. nC1 = n and nCn-1 = n
3. nCr = nCn-r
4. nCr are called the binomial coefficients since they appear
as the coefficients in the binomial expansion
n
( a  b )   n Cr a r b n  r .
n
r 0
Example: (a  b)3 3 C0a 0b3  3 C1a1b2  3 C2a 2b1  3 C3a 3b0
 b3  3ab2  3a 2b  a 3.
Counting Rules and Binomial
Probabilities
8
Applications of Counting Rules
1. A batch of 20 electronic items (e.g., computer chips)
has 5 defective and 15 good items. Suppose that a sample
of size 4 is taken without replacement from this batch,
with the order in which they are taken being unimportant.
A) How many possible samples are possible?
Solution: 20C4 = 20!/[4!(20-4)!] = 4845 samples.
B) How many samples are possible which has exactly
2 defectives and 2 good items?
Solution: (5C2)(15C2) = (10)(105) = 1050.
Counting Rules and Binomial
Probabilities
9
C) If sampling is performed randomly, what will be
the probability of getting a sample with exactly 2
defectives and 2 good items?
Solution: P(2D,2G) = N(A)/N(S) = 1050/4845 =
0.2167.
D) What is the probability of getting a sample with
at least 2 defective items?
Solution: P(at least 2 D) = P(2D,2G) + P(3D,1G) +
P(4D,0G) = [(5C2)(15C2) + (5C3)(15C1) +
(5C4)(15C0)]/20C4 = [1050 + 150 + 5]/4845 =
1205/4845 = 0.2487.
Counting Rules and Binomial
Probabilities
10
2. Suppose that you have 8 (indistinguishable) objects of
type I, and 12 (indistinguishable) objects of type II, and
you have 20 positions on which to place these 20 objects.
In how many ways could you place these 20 objects in
these 20 positions?
Solution: You may place these objects by first choosing the
8 positions out of the 20 positions on which to put the type
I objects. The remaining 12 positions will then be occupied
by the 12 type II objects. Therefore, the total number of
ways equals the number of ways of choosing 8 positions
out of 20, without regards to the order in which the
positions are chosen. Therefore, the total number of ways
is
20C8 = 20C12 = 20!/[8!(20-8)!] = 125,970 ways.
Counting Rules and Binomial
Probabilities
11
3. If a coin is tossed 25 times, in how many ways could you
get an outcome with exactly 15 heads and 10 tails?
Solution: The number of ways would be the number of
ways of choosing the 15 positions out of the 25 tosses in
which the heads should appear. The other 10 positions will
have the tails. Thus, the total number of ways of getting
exactly 15 heads and 10 tails is
25C15 = 3,268,760.
Question: What will be the probability of getting exactly
15 heads in 25 tosses of a fair coin?
Answer: P(15H,10T) = 25C15/225 = 25C15 (1/2)15 (1/2)10 =
3268760/33554432 = 0.097, or about 10%.
Counting Rules and Binomial
Probabilities
12
4. Consider the experiment of rolling a fair die 25 times.
How many possible outcomes are there in this
experiment?
Solution: By the Fundamental Theorem of Counting,
there will be (6)(6)…(6) = 625 possible outcomes.
B) How many possible outcomes are there with exactly
15 “6”s and 10 “non-6”s?
Solution: Any configuration with 15 6’s and 10 non-6’s
could occur in (115)(510) possible ways. There are 25C15
configurations with 15 6’s and 10 non-6’s. Therefore,
the total number of ways of getting 15 6’s and 10 non6’s is
15
10
25C15 (1) (5) .
Counting Rules and Binomial
Probabilities
13
Binomial Probabilities
In the preceding example of rolling a fair die 25 times, the
probability of obtaining exactly 15 6’s and 10 non-6’s is
therefore
P(15 6’s and 10 non-6’s) = 25C15 (1/6)15 (5/6)10.
This is an example of a binomial probability.
Definition: A discrete random variable X taking values in
{0,1,2,…,n} is said to have a binomial probability
function with parameters n and p (0 < p < 1) if its
probability function is given by:
n k
f (k )  P{X  k}    p (1  p)nk , k  0,1,2,...,n.
k 
Counting Rules and Binomial
Probabilities
14
Binomial Probability Models
A random experiment that gives rise to binomial random
variables typically has the following characteristics:
1. The experiment consists of n trials or steps.
2. Each trial or step has only two possible outcomes:
labeled a success (S) or a failure (F).
3. The probability of getting a success (S) at a given
trial is equal to p.
4. The outcome on any given trial is unaffected by the
outcomes of the other trials (this is the assumption of
independent trials).
If X is the random variable denoting the number of
successes out of the n trials, then it has a binomial
probability distribution with parameters n and p.
Counting Rules and Binomial
Probabilities
15
Binomial Probability Shapes
Graphs of binomial probability functions
with n = 10 and for three values of p.
Binomial Probabilities
0.3
p=.2
p=.5
p=.7
0.2
0.1
0.0
0
5
10
X=Number of Successes
Counting Rules and Binomial
Probabilities
16
Computing Binomial Probabilities




Use the binomial tables in the textbook. Provides
probabilities of form P(X < k), so P(X = k) = P(X < k) P(X < k-1).
Use the binomial function in your calculator.
Use Minitab using the “Probability Distributions” option in
the “Calc” Menu.
Calculate it by hand and calculator.
Example: Assume that the probability of a newly
manufactured computer of a certain brand having a defect
is 0.10. Suppose that 20 of these newly manufactured
computers are tested for defects. Let X denote the number
out of these 20 computers which has defects. Then X has a
binomial distribution with n = 20 and p = .10.
Counting Rules and Binomial
Probabilities
17
Some Questions Pertaining to the Preceding Situation
• What is the probability that none of the 20 computers will
have defects?
Answer: P(X=0) = 20C0 (.1)0(.9)20-0 = (0.9)20 = 0.1216.
•What is the probability that at least one of these 20
computers will be found to have a defect?
Answer: P(X > 1) = 1 - P(X=0) = 1 - 0.1216 = 0.8784.
•What is the probability that the number of defective
computers will be at most 2?
Answer: P(X < 2) = P(X=0) + P(X=1) + P(X=2) = .1216 +
.2702 + .2852 = .6769 using Minitab.
Counting Rules and Binomial
Probabilities
18
Mean and Standard Deviation of a Binomial
Random Variable
If X is a random variable whose distribution is binomial
with parameters n and p, then
Mean = m = np;
Variance = s2 = np(1-p);
Standard Deviation = s = [np(1-p)]1/2.
Example: In the preceding example, m = (20)(.1) = 2 and
s = [20(.1)(1-.1)]1/2 = (1.8)1/2 = 1.34.
Counting Rules and Binomial
Probabilities
19
Computational Limitations when Dealing with
Binomial Distributions
Situation: Suppose that you toss a fair coin 6 million times,
and you denote by X the number of heads that comes up.
Then X will be binomial with n = 6,000,000 and p = 0.5.
Consequently,
On average, we should get m = (6,000,000)(.5) =
3,000,000 heads in this experiment; and
The standard deviation will be s = [(6000000)(.5)(.5)]1/2
= 1224.74.
But, what will be the probability that X will differ from 3
million by at most 500? This is tough computationally, so
later we will simply approximate this probability! [Relate
this situation to the Florida election!!]
Counting Rules and Binomial
Probabilities
20