This section presents some common methods for counting the number of outcomes in a set. When there are a lot of outcomes in an experiment, it is convenient to have a method of determining how many outcomes there are in \(S\).
Suppose that an experiment has two parts or phases. In the first part there are \(n_{1}\) outcomes and in the second part there are \(n_{2}\) outcomes. The composite experiment which consists of both parts of the experiment then has \(n_{1}\times n_{2}\) possible outcomes.
Let \(E_{1}\) denote the selection of a rat form a cage containing one female (F) rat and one male (M) rat. Let \(E_{2}\) denote the administering of either drug A, drug B, or a placebo to the selected rat.
Another way of illustrating the multiplication principle is with a tree diagram. The diagram shows that there are \(n_{1}\)=2 possibilities for the gender of the rat and that for each of these outcomes there are \(n_{2}=3\) possibilities for the drug.
The multiplication rule can be extended to more than two experiments.
Total possible calendars: \(7*2 = 14\)
2 temps * 3 pressure * 2 catalysts * 2reps = 24 combinations
Let \(A\) = Appetizer, \(E\) = Enree, \(D\) = dessert and \(B\) = beverage. Then meals could be made from the following combinations of groups are possible:
4*14*6 + 14*6*5 + 4*6*5 + 4*14*5
## [1] 1156
!
is a function called a factorial and is defined as\[ n! = n * (n-1) * (n-2) * \ldots * 1 \]
The “ice cream club” is hosting a make-your-own sundae at which the following are provided:
Ice Cream flavors: Chocolate, Cookies-n-cream, Strawberry, Vanilla
Toppings: Caramel, Hot Fudge, Marshmallow, M&Ms, Nuts, Strawberries
How many different sundaes are possible using one flavor of ice cream and three different toppings?
Let \(E_{1}\): 1 flavor of ice cream: 4 choices
Let \(E_{2}\): 3 different toppings: 6 choices on the first pick, then 5 choices remain for the second pick, then 4 choices remain for the 3rd pick.
4*(6*4*3)
## [1] 288
How many sundaes are possible using one flavor of ice cream and from 0 to 6 toppings?
\(E_{1}\): 1 flavor of ice cream: 4 choices
\(E_{2}\): Different toppings - can happen in several ways. You can choose 6 OR 5 OR 4 OR 3 OR 2 OR 1 topping:
4*(factorial(6) + (6*5*4*3*2) + (6*5*4*3) + (6*5*4) + (6*5) + 6 + 1)
## [1] 7828
There are 9 presidential candidates at a debate. How many different ways can candidates be lined up?
factorial(9)
## [1] 362880
If the order of objects is not important, then the number of ways of choosing \(k\) distinct objects from a set of \(n\) is given by
\[ \binom{n}{k}=\frac{n!}{k!\left(n-k\right)!}. \]
Handy r
functions: factorial(x)
and choose(n, k)
The Alpha Beta Zeta sorority is trying to fill a pledge class of nine new members during fall rush. Among the twenty-five available candidates, fifteen have been judged marginally acceptable and ten highly desirable. How many ways can the pledge class be chosen to give a two-to-one ratio of highly desirable to marginally acceptable candidates?
If we want a 2:1 ratio of highly:marginal candidates, we want 6 highly desirable and 3 marginal candidates.
\[ \binom{15}{3} * \binom{10}{6} \\ = \frac{15!}{3!12!} * \frac{10!}{6!4!} \\ = \frac{15*14*13*12!}{(3*2*1)*12!} * \frac{10*9*8*7*6!}{6!(4*3*2*1)} \\ = (5*7*13) * (10*3*7) \]
5*7*13*10*3*7
## [1] 95550
choose(15,3)*choose(10,6)
## [1] 95550
For each of these, write the R code used to calculate the answer and the answer itself.
How many different ways can you line up 6 Democrats in 9 spots?
choose(9,6)
## [1] 84
OR
How many different ways can you line up 3 Republicans in 9 spots?
choose(9,3)
## [1] 84
choose(9,4)
## [1] 126
choose(5,2)*choose(4,2)
## [1] 60
Find the way that groups of 4 can be picked such that EVERYONE is in the same major, and subtract that from the total # of ways to choose 4 interns.
choose(9,4) - (choose(5,4) + choose(4,4))
## [1] 120
In the previous section our concern focused on counting the number of ways a given operation, or sequence of operations could be performed. In this section we want to calculate the probability that a certain combination will occur. For instance, from the previous section we would be able to count the total number of ways a poker player could draw a straight. What if the poker player wanted to determine the probability of a straight. How could we set this up?
Ten equally qualified marketing assistants are candidates for promotion to associate buyer; seven are men and three are women. If the company intends to promote four of the ten at random, what is the probability that exactly two of the four are women?
<- choose(10,4)
total <- choose(3,2)*choose(7,2)
two_women <-two_women/total) (prob_two_women
## [1] 0.3
An urn contains twenty chips, numbered 1 through 20. Two are drawn simultaneously. What is the probability that the numbers on the two chips will differ by more than 2? Hint: Calculate the complement and subtract from one.
<-choose(20,2)
total1-(19/total+18/total)
## [1] 0.8052632
<- 7^7
total <- factorial(7)
diff <- 7 same
P(different)
/ total diff
## [1] 0.006119899
P(all same)
/total same
## [1] 8.49986e-06
6*5*4*3)/6^4 (
## [1] 0.2777778