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?

# Number of ways to withdraw with with less than 2 green jellybeans
ways_less_than_2_green <- choose(5, 0) * choose(7, 5) + choose(5, 1) * choose(7, 4)

ways_less_than_2_green
## [1] 196

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?

t_ways <- choose(14 + 13, 5)

least_4_rep <- choose(13, 4) * choose(14, 1) + choose(13, 5)
least_4_rep
## [1] 11297

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?

# Total outcomes
total_outcomes <- choose(2, 2) * choose(6, 2) * choose(52, 3) * 2**5

cat("Total number of different outcomes:", total_outcomes, "\n")
## Total number of different outcomes: 10608000

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.

tways <- choose(52, 3)

wno_3s <- choose(48, 3)

prob <- round(1 - wno_3s / tways,4)
prob
## [1] 0.2174

Question 5a

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. How many different combinations of 5 movies can he rent?

# Total number of ways to choose 5 movies
total_ways <- choose(17 + 14, 5)

cat("Number of different combinations of 5 movies:", total_ways, "\n")
## Number of different combinations of 5 movies: 169911

Question 5b

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

#Number of ways to choose 5 documentaries
sel_all_documentaries <- choose(17, 5)

#Number of ways with at least one mystery
ways_at_least_one_mystery <- total_ways - sel_all_documentaries

ways_at_least_one_mystery
## [1] 163723

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.

schedule = choose(4,3) * choose(104,3) * choose(17,3) * factorial(9)
signif(schedule, 4)
## [1] 1.797e+14

Question 7

step1 = choose(24,13) + choose(5,1)*choose(25,12) + choose(5,2)*choose(24,11) + choose(5,3)*choose(24,10) + choose(5,4)*choose(25,9)
step1_x = step1 * factorial(13)

prob7_1 = signif(step1_x, 4)
prob7_1
## [1] 5.186e+17

7b

step2 = (choose(6,6) * choose(18,7)) * factorial(13)
prob7_2 = signif(step2, 4)
prob7_2
## [1] 1.982e+14

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.

prob <- round((2 * factorial(5)) / factorial(10),4)
prob
## [1] 1e-04

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.

P_win <- 40/52

P_lose = 1-P_win

# Calculate the expected value
EV <- round(P_win * 4 + P_lose * -16,2)

cat("Expected Value:",EV,"dollars", "\n")
## Expected Value: -0.62 dollars

9 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.

num_games <- 833
EV <- -0.62

winnings_losses <- round(EV * num_games,2)

cat("Total Winnings/Losses after playing 833 times:", winnings_losses,"dollar", "\n")
## Total Winnings/Losses after playing 833 times: -516.46 dollar