set.seed(905)

Question 1

A bag contains 5 green and 7 red jellybeans. How many ways can 5 jellybeans be withdrawn from the bag so that the number of green ones withdrawn will be less than 2?

Here, we have a combination problem constrained by a condition. There are two ways we could draw 5 jellybeans and end up with less than 2 greens: 5 reds, or 4 reds and 1 green. That means we need to find the number of combinations of 5 red jellybeans out of 7 (\(C(7,5)\)), and the added probabilities of drawing 4 red jellybeans out of 7 (\(C(7,4)\)) and 1 green jellybean out of 5 (\(C(5,1)\)).

The formula for the number of combinations of \(k\) elements out of \(n\) total is given by: \[ C(n,k) = \frac{n!}{k!(n-k)!} \] In our specific scenario, the total number of combinations is given by:

\[ C(7,5) + C(7,4) * C(5,1) = \frac{7!}{5!(7-5)!} + \frac{7!}{4!(7-4)!} * \frac{5!}{1!(5-1)!} \]

c_7_5 = factorial(7) / (factorial(5) * factorial(2))
c_7_4 = factorial(7) / (factorial(4) * factorial(3))
c_5_1 = factorial(5) / (factorial(4))

c_7_5 + c_7_4 * c_5_1
## [1] 196

There are 196 ways to choose jellybeans with these constraints.

Question 2

A certain congressional committee consists of 14 senators and 13 representatives. How many ways can a subcommittee of 5 be formed if at least 4 of the members must be representatives?

This is fundamentally similar to the jellybean problem. In this case, there are really only two possible scenarios for 5-person subcomittees in which at least 4 are representatives: 5 reps, or 4 reps and 1 senator. We will calculate the number of possibilities for both and add them together.

For the first scenario, we’re looking for how many combinations of 5 reps we can get out of 13 reps, given by “13 choose 5”, or \(C(13, 5)\). The formula for such combinations (see the generalized form in the jellybean problem) is given as:

\[ C(13,5)=\frac{13!}{5!(13-5)!} \]

c_13_5 <- factorial(13) / (factorial(5) * factorial(8))

c_13_5
## [1] 1287

So we have 1,287 possibilities for that scenario. For the second, we have to consider the joint possibilities of choosing 4 of 13 reps (\(C(13,4)\)), and 1 of 14 senators (\(C(14,1)\)), which we multiply together.

\[ C(13,4) * C(14,1) = \frac{13!}{4!(13-4)!} * \frac{14!}{1!(14-1)!} \]

c_13_4 <- ( factorial(13) / (factorial(4) * factorial(9)) )

c_14_1 <- ( factorial(14) / factorial(13) ) 

c_13_4 * c_14_1
## [1] 10010
c_13_5 + (c_13_4 * c_14_1)
## [1] 11297

So, the total number of possibilities for the subcomittee is 11,297.

Question 3

If a coin is tossed 5 times, and then a standard six-sided die is rolled 2 times, and finally a group of three cards are drawn from a standard deck of 52 cards without replacement, how many different outcomes are possible?

For this problem, we will assume the order of each step matters–for example, in the dice section, we would treat 4 then 3 as different than 3 then 4.

In that case, the number of outcomes is given by a relatively simple multiplication problem: the number of possible outcomes in each experiment to the power of the number of trials, all multiplied by each other:

\[ 2^5 * 6^2 * 52*51*50 = 152,755,200 \] So, there are 152,755,200 possibilities.

One way to think about this problem differently is to assume that order doesn’t matter for the cards, in which case the outcomes for the card drawing section would be defined by:

\[ C(52,3) = \frac{52!}{3!(52-3!)} = 22,100 \] In that case, plugging the value for \(C(52,3)\) into the above formula in place of \(52*51*50\), we get:

\[ 2^5 * 6^2 * 22,100 = 25,459,200 \]

25,459,200 possibilities in this case.

Question 4

3 cards are drawn from a standard deck without replacement. What is the probability that at least one of the cards drawn is a 3? Express your answer as a fraction or a decimal number rounded to four decimal places.

The question is asking for the probability of at least one 3 looks, to me, like a clue that we should start by finding the probability of the opposite outcome, and subtract that from 1. This is because it is easier to calculate the probability that none of the cards drawn are a 3.

Starting with a full deck, the probability of not drawing a 3 is given by \(48/52\), or the number of non-3s in the deck divided by the total number of cards. We would multiply that by the probability of a non-3 in the next draw, given by \(47/51\) (since after the first draw, 47 non-3’s remain out of 51 cards left in the deck). Following the same logic, we’d multiply by the probability on the third draw, \(46/50\). That gives the probability of not drawing a 3, so substracting that from 1 (or 100%) gives us the probability of drawing at least one 3.

1 - ((48/52) * (47/51) * (46/50))
## [1] 0.2173756

Therefore, the probability of drawing at least one 3 is 0.2174.

Question 5

Lorenzo is picking out some movies to rent, and he is primarily interested in documentaries and mysteries. He has narrowed down his selections to 17 documentaries and 14 mysteries.

Step 1. How many different combinations of 5 movies can he rent?

This can be solved by simply taking \(C(31,5)\), or the number of combinations of any 5 movies taken from the total of 31 movies.

choose(31,5)
## [1] 169911

There are 169,911 different combinations of movies he could watch (in any order).

Step 2. How many different combinations of 5 movies can he rent if he wants at least one mystery?

As in the card selection question above, this is probably best answered by looking at the number of possibilities where no mystery is selected, and subtracting that number from the total count of possibly movie combinations we derived above.

We can do this by first finding the number of possible combinations of only documentaries. That’s given by \(C(17,5)\), which works out to 6,188.

choose(17,5)
## [1] 6188
169911 - 6188
## [1] 163723

Given that the total number of movie combinations is 169,911, the number of those combinations that involve at least one mystery must be given by \(169,911 - 6,188\), or 163,723.

Question 6

In choosing what music to play at a charity fund raising event, Cory needs to have an equal number of symphonies from Brahms, Haydn, and Mendelssohn. If he is setting up a schedule of the 9 symphonies to be played, and he has 4 Brahms, 104 Haydn, and 17 Mendelssohn symphonies from which to choose, how many different schedules are possible? Express your answer in scientific notation rounding to the hundredths place.

In order to get an equal number of symphonies from each composer for a 9-song setlist, 3 songs will need to be selected from each. That means multiplying three combination values \(C(X_i, 3)\), where each \(X_i\) is the number of symphonies from each composer.

\[ C(4,3) * C(104,3) * C(17,3) \] Solving programatically:

choose(4,3) * choose(104,3) * choose(17,3)
## [1] 495322880

This amounts to 495,322,880 possible combinations or, in scientific notation, \(4.95 * 10^8\).

Question 7

An English teacher needs to pick 13 books to put on his reading list for the next school year, and he needs to plan the order in which they should be read. He has narrowed down his choices to 6 novels, 6 plays, 7 poetry books, and 5 nonfiction books.

Step 1. If he wants to include no more than 4 nonfiction books, how many different reading schedules are possible? Express your answer in scientific notation rounding to the hundredths place.

Because order explicitly matters in this context, we must use permutations to solve it. However, combinations will be useful in understanding the total number of possibilities given the provided condition.

Given the condition that there must be 4 or fewer nonfiction books, we must change our pool of possibilities to reflect the different arrangements of 0, 1, 2, 3, or 4 nonfiction books we could be pulling from. So basically, we need to multiply \(13!\) (the number of permutations for any chosen 13 books) times the number of combinations possible given the constraint.

For these purposes, we don’t need to consider any book classification other than non-fiction (5 books) and “other” (19 books). The total number of combinations is:

\[ C(19,13) + \\ C(19,12) * C(5,1) + \\ C(19,11) * C(5,2) + \\ C(19,10) * C(5,3) + \\ C(19,9) * C(5,4) \] Or:

choose(19,13)+choose(19,12)*choose(5,1)+choose(19,11)*choose(5,2)+choose(19,10)*choose(5,3)+choose(19,9)*choose(5,4)
## [1] 2420562

Then, we multiply that by \(13!\), the number of possible permutations for any of those combinations of 13 books.

2420562 * factorial(13)
## [1] 1.507289e+16

So the total number of possibilities is \(1.51 * 10^{16}\).

Step 2. If he wants to include all 6 plays, how many different reading schedules are possible? Express your answer in scientific notation rounding to the hundredths place.

This is the same basic process, but with an easier constraint. Again, we consider only binary classification here: plays and non-plays. Since we’re selecting all 6 plays, the only calculation we need to do for the number of combinations is \(C(18,7)\), or selecting the 7 additional books we need from the remaining 18 non-play books.

choose(18,7)
## [1] 31824

We then multiply that value by \(13!\) as the number of possible permutations for each set of 13 books.

31824 * factorial(13)
## [1] 1.981687e+14

In this case, we’re dealing with \(1.98*10^{14}\) possible book schedules.

Question 8

Zane is planting trees along his driveway, and he has 5 sycamores and 5 cypress trees to plant in one row. What is the probability that he randomly plants the trees so that all 5 sycamores are next to each other and all 5 cypress trees are next to each other? Express your answer as a fraction or a decimal number rounded to four decimal places.

Given these conditions, there are only 2 outcomes in which Zane plants the trees in a way in which all cypresses and all sycamores are next to each other (where \(S\) is a sycamore and \(C\) is a cypress):

\[ S\:S\:S\:S\:S\:C\:C\:C\:C\:C \] and

\[ C\:C\:C\:C\:C\:S\:S\:S\:S\:S \] Thus, in order to find this probability, we will divide 2 by the number of possible permutations of 10 trees broken down into two categories. That total number of permutations is given by the formula for permutations of a multiset. When there are two categories being used in the permutation, that formula is given by…

\[ \frac{n!}{n_1!*n_2!} \] …where \(n\) is the total number of elements (in our case, 10 trees) and \(n_1\) and \(n_2\) are the amounts in each subset (5 sycamores and 5 cypresses).

In our case that works out to:

\[ \frac{10!}{5! * 5!} \] Which we can solve programatically:

factorial(10) / (factorial(5) * factorial(5))
## [1] 252

If there are \(252\) total possible tree arrangements, and \(2\) of them line up each tree type as the problem suggests, the probability of Zane randomly planting the trees that way is equal to \(2/252\), 0.0079, or 7.9%.

2/252
## [1] 0.007936508

Question 9

If you draw a queen or lower from a standard deck of cards, I will pay you $4. If not, you pay me $16. (Aces are considered the highest card in the deck.)

Step 1. Find the expected value of the proposition. Round your answer to two decimal places. Losses must be expressed as negative values.

Under these conditions, every card in the deck has a presumed dollar value of either 4 or -16. In order to find the expected value of the proposition, we must multiply those dollar amounts by their likelihood, and add them together. The expected value formula therefore takes the shape…

\[ 4 * P(L) - 16 * P(H) \] …where \(L\) is drawing a card queen or lower, and \(H\) is drawing a king or ace (the only values higher than queen). Because there are 4 of each “number” card (including face cards) in the deck, the probability of drawing a queen or lower is \((4*11)/52 = 44/52 = 84.6\%\) (because there are 11 distinct ‘numbers’ from 2 to queen, and 4 of each, all over the 52 cards in the deck). Whether by subtracting that value from 1 (since the outcomes are binary) or by counting the probability of drawing a king or ace, \(P(H)\) works out to \(8/52 = 15.4\%\).

Plugging these values back into our expected value equation:

4 * (44/52) - 16 * (8/52)
## [1] 0.9230769

We get an expected value of about 92.3 cents per card draw. Not a bad deal!

Step 2. If you played this game 833 times how much would you expect to win or lose? Round your answer to two decimal places. Losses must be expressed as negative values.

In order to calculate this value theoretically, we can simply multiply the expected value of each draw by the number of draws:

.923 * 833
## [1] 768.859

So I would expect to earn about $768.86. All in a day’s work!

Just to gut check these values (and have a bit of fun), I’ll set up a simulation to see this play out in “practice”. Let’s assume every card has a value from 1 to 52, and the last queen stops at 44. In this exercise, any card with a value 44 or less is a win (so, worth $4) and anything above that is a loss (worth -$16.)

#create empty list of winnings value
winnings_list <- c()

#loop through 1000 trials of 833 draw games
for (i in 1:1000) {
  draws <- sample(1:52, 833, replace=TRUE) 
  winnings <- sum(ifelse(draws<=44, 4, -16))

  #add winnings to list
  winnings_list = c(winnings_list, winnings)
}

mean(winnings_list)
## [1] 774.26

My results for 1000 trials are quite close to my theoretical winnings, and confirm that this is a game I’m very interested in finding at a casino. Seems better than roulette!