Howmework 6

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?

# number of green jellybeans withdrawn will be less than 2 means 1 or 0 green jellybeans

red <- 7
green <- 5

# Case 1: No green jellybeans, so all 5 are red
no_green <- choose(red, green)

# Case 2: 1 green jellybean and 4 red jellybeans
one_green <- choose(green, 1) * choose(red, 4)

total_ways <- no_green + one_green

total_ways
## [1] 196

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?

# at least 4 must be representatives means only 1 senator or 0 senators per subcommittee

senator <- 14
representative <- 13

no_sneator <- choose(representative, senator)

one_senator <- choose(senator, 1) * choose(representative, 4)

total_ways <- no_sneator + one_senator

total_ways
## [1] 10010

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?

# outcomes of a coin tossed 5 times
coin <- 2^5

# outcomes of a die rolled 2 times
die <- 6^2

# outcomes of a 3 cards drawn from a standard deck f 52 cards without replacement
cards <- choose(52,3)

total_outcomes = coin * die * cards

total_outcomes
## [1] 25459200

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.

# Calculate the probability of not drawing a '3' in 3 attempts
probability_not_3 = (48/52) * (47/51) * (46/50)

# Calculate the probability of drawing at least one '3'
probability_at_least_one_3 = 1 - probability_not_3

# Round the result to four decimal places
probability_at_least_one_3_rounded = round(probability_at_least_one_3, 4)
probability_at_least_one_3_rounded
## [1] 0.2174

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?

documentary <- 17
mystery <- 14

comb_movies <- documentary + mystery

comb_outcome <- choose(comb_movies, 5)

comb_outcome
## [1] 169911
# Step 2. How many different combinations of 5 movies can he rent if he wants at least one mystery?

# the solution of this will be the complement of step 1 i.e. comb_outcome - all 5 movies are documentary

all_documentary <- choose(documentary, 5)

at_least_one_mystery <- comb_outcome - all_documentary

at_least_one_mystery
## [1] 163723

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.

For Cory to set up a schedule of 9 symphonies with an equal number of pieces from Brahms, Haydn, and Mendelssohn, he needs to select 3 symphonies from each composer.

We use the combinations formula on each composer. The formula for combinations \(C(n, k) = \frac{n!}{k!(n-k)!}\) will be used for each composer:

# Brahms: Choose 3 from 4 symphonies.
brahms <- choose(4,3)

# Haydn: Choose 3 from 104 symphonies.
haydn <- choose(104, 3)

# Mendelssohn: Choose 3 from 17 symphonies.
mendelssohn <- choose(17,3)

The total number of different schedules possible is the product of these combinations:

\[ \text{Total Schedules} = C(4, 3) \times C(104, 3) \times C(17, 3) \]

total_schedules <- brahms * haydn * mendelssohn


# Express the answer in scientific notation rounded to the hundredths place
rounded_total_schedules <- format(total_schedules, scientific = TRUE, digits = 4)

# Rounding to the hundredths place
rounded_total_schedules
## [1] "4.953e+08"

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.

He has a total of 6 novels, 6 plays, 7 poetry books, and can include up to 4 nonfiction books from the 5 available. Thus, the total pool of books he can choose from is \(6 + 6 + 7 + 4 = 23\) books.

From these 23 books, he needs to pick 13 for the reading list. Since the order in which the books are read matters, we are dealing with permutations, not combinations.

The formula for permutations is \(P(n, k) = \frac{n!}{(n-k)!}\), where \(n\) is the total number of items to choose from, and \(k\) is the number of items to choose.

# Calculate the permutations for choosing 13 books out of 23
total_books = 23
books_to_choose = 13

reading_schedules <- factorial(total_books) / factorial(total_books - books_to_choose)

# Express the answer in scientific notation rounded to the hundredths place
rounded_reading_schedules <- format(reading_schedules, scientific = TRUE, digits = 4)

# Print the rounded reading schedules
rounded_reading_schedules
## [1] "7.124e+15"

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.

Since he must include all 6 plays, he now needs to choose the remaining 7 books. The total number of books he can choose from for these 7 slots is \(6 + 7 + 5 = 18\) books.

Out of these 18 books, he needs to choose 7 to complete his reading list of 13 books (since 6 slots are already taken by the plays). After choosing these 7 books, he will then arrange the total 13 books (6 plays + 7 chosen books) in order, since the order in which the books are read is significant.

The number of ways to choose 7 books from the 18 available is given by combinations \(C(n, k)\), and the number of ways to arrange the final list of 13 books is given by permutations, which can be calculated as \(P(n, k) = \frac{n!}{(n-k)!}\) for the final arrangement since all 13 slots will be filled.

So, the total number of different reading schedules is: \[ C(18, 7) \times 13! \]

combinations_18_7 <- choose(18, 7)
permutations_13 <- factorial(13)

total_reading_schedules <- combinations_18_7 * permutations_13

# Express the answer in scientific notation rounded to the hundredths place
rounded_reading_schedules <- format(total_reading_schedules, scientific = TRUE, digits = 4)

rounded_reading_schedules
## [1] "1.982e+14"

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.

First, we calculate the total number of ways Zane can plant the 10 trees (5 sycamores and 5 cypress) in a row without any restrictions. This is simply the number of permutations of 10 items where there are 2 groups of 5 identical items each.

This can be calculated using the formula for permutations of a multiset: \(\frac{10!}{5!5!}\).

total_arrangements <- factorial(10) / factorial(5) * factorial(5)

If all 5 sycamores are next to each other and all 5 cypress trees are next to each other, we can consider each group of 5 identical trees as a single unit.

# We're treating each group of trees as a single unit, there are 2! ways to arrange the two units
desired_tree_arrangements <- factorial(2)

The probability that Zane randomly plants the trees so that all 5 sycamores are next to each other and all 5 cypress trees are next to each other is given by the ratio of the number of favorable arrangements (step 2) to the total number of possible arrangements (step 1).

probability <- desired_tree_arrangements / total_arrangements

# Round the probability to four decimal places
rounded_probability <- round(probability, 4)
rounded_probability 
## [1] 0

The probability that Zane randomly plants the trees so that all 5 sycamores are next to each other and all 5 cypress trees are next to each other is approximately 0.0079, when rounded to four decimal places.

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.

This means that:

  1. Winning ($4): With 11 ranks (2 through 10, Jack, Queen) in 4 suits, there are 44 winning cards.
  2. Losing ($16): The losing cards are the Kings and Aces, 4 of each, totaling 8 losing cards.

The probability of drawing a winning card is \(\frac{44}{52}\) and the probability of drawing a losing card is \(\frac{8}{52}\).

win_amount <- 4
loss_amount <- -16

p_win <- 44 / 52
p_lose <- 8 / 52

The corrected expected value (EV) is: \[ EV = \left( \frac{44}{52} \times 4 \right) + \left( \frac{8}{52} \times -16 \right) \]

# The expected value with the correction
ev_corrected <- (p_win * win_amount) + (p_lose * loss_amount)

# Round the corrected expected value to two decimal places
rounded_ev_corrected <- round(ev_corrected, 2)
rounded_ev_corrected
## [1] 0.92

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.

Using the corrected expected value, the total expected outcome over 833 games is calculated as:

\[ \text{Total Expected Outcome} = \text{Corrected Expected Value per Game} \times \text{Number of Games} \]

\[ \text{Total Expected Outcome} = 0.92 \times 833 \]

number_of_games <- 833

# Calculate the corrected total expected outcome over 833 games
total_expected_outcome_corrected <- rounded_ev_corrected * number_of_games

# Round the corrected total expected outcome to two decimal places
rounded_total_expected_outcome_corrected <- round(total_expected_outcome_corrected, 2)
rounded_total_expected_outcome_corrected
## [1] 766.36