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?
choose(5,5)*choose(7,0) + choose(5,4)*choose(7,1)
## [1] 36

or

phyper(1,7,5,5) * choose(12, 5)
## [1] 36
  1. 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?
total_representatives <- 13

total_senators <- 14

# number of ways 4 members are representatives 
four_representatives <- choose(total_representatives, 4)

# number of ways all 5 members are representatives
five_representatives <- choose(total_representatives, 5)

# number of ways to choose 1 senator 
one_senator <- choose(total_senators, 1)

# total number of ways when at least 4 members are representatives
total_ways <- four_representatives * one_senator + five_representatives

total_ways
## [1] 11297

or

sum(dhyper(4:5, 13, 14, 5)) * choose(27,5)
## [1] 11297
  1. 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?
# Number of outcomes for each event
outcomes_coin_toss <- 2  # (Heads or Tails)
outcomes_die_roll <- 6  # (1, 2, 3, 4, 5, 6)
outcomes_card_draw <- choose(52, 3)  # Combinations of 3 cards from a deck of 52

# Number of repetitions for each event
repetitions_coin_toss <- 5
repetitions_die_roll <- 2

# Calculate the total number of different outcomes
total_outcomes <- outcomes_coin_toss^repetitions_coin_toss * outcomes_die_roll^repetitions_die_roll * outcomes_card_draw
total_outcomes
## [1] 25459200
  1. 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.
total_cards <- 52

total_ways_to_draw_3_cards <- choose(total_cards, 3)

# Number of ways to choose 3 non-3 cards from the 48 non-3 cards in the deck
non_3_cards <- total_cards - 4  # There are four 3 cards in the deck
total_ways_to_draw_3_non_3_cards <- choose(non_3_cards, 3)

# Probability of drawing 3 non-3 cards
probability_3_non_3_cards <- total_ways_to_draw_3_non_3_cards / total_ways_to_draw_3_cards

# Probability of drawing at least one 3 card 
probability_at_least_one_3 <- 1 - probability_3_non_3_cards
probability_at_least_one_3
## [1] 0.2173756
  1. 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?

documentaries <- 17
mysteries <- 14
movies_to_rent <- 5

# number of different combinations of 5 movies
total_combinations <- choose(documentaries + mysteries, movies_to_rent)

total_combinations
## [1] 169911

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

combinations_without_mystery <- choose(documentaries, movies_to_rent)
combinations_at_least_one_mystery <- total_combinations - combinations_without_mystery
combinations_at_least_one_mystery
## [1] 163723

or

choose(14,1)* choose(17,4) + 
choose(14,2)* choose(17,3) + 
choose(14,3)* choose(17,2) + 
choose(14,4)* choose(17,1) +
choose(14,5)* choose(17,0)
## [1] 163723
  1. 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.
brams_symphonies <- 4
haydn_symphonies <- 104
mendelssohn_symphonies <- 17

# number of symphonies to be played
total_symphonies <- 9

# Calculate the number of different schedules
num_schedules <- choose(brams_symphonies, 3) *
                 choose(haydn_symphonies, 3) *
                 choose(mendelssohn_symphonies, 3) * factorial(total_symphonies)

# Format the result in scientific notation with two decimal places
answer <- format(num_schedules, scientific = TRUE, digits = 4)
answer
## [1] "1.797e+14"
  1. 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.

total_number_of_books <- 13
plays <- 6
novels <- 6
poetry_books <- 7
nonfiction_books <- 5

x <- choose(24,13) +
(choose(24,12) * choose(5,1)) +
(choose(24,11) * choose(5,2)) +
(choose(24,10) * choose(5,3)) +
(choose(24,9) * choose(5,4))
reading_schedules <- x * factorial(total_number_of_books)
format(reading_schedules, scientific = TRUE, digits = 4)
## [1] "4.18e+17"

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.

all_six_plays <- signif(choose(6,6) * choose(18,7) * factorial(13), digits = 4)
all_six_plays
## [1] 1.982e+14
  1. 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.
sycamore <- 5
cypress_trees <- 5
total_trees <- 10

prob_plants <- 2/(factorial(total_trees)/(factorial(sycamore)*factorial(cypress_trees)))
round(prob_plants, digits = 4)
## [1] 0.0079
  1. 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.

drawing_queen_or_lower <- 44/52
drawing_higher_than_queen <- 8/52
pay_drawing_queen_or_lower <- 4
pay_drawing_higher_than_queen <- -16

expected_value <- (drawing_queen_or_lower * pay_drawing_queen_or_lower) + (drawing_higher_than_queen * pay_drawing_higher_than_queen)
expected_value <- round(expected_value, 2)
expected_value
## [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.

# Number of times you play the game
n_games <- 833


# Calculate total expected win/loss
total_win_or_loss <- expected_value * n_games

# Round result to two decimal places
total_win_or_loss <- round(total_win_or_loss, 2)
total_win_or_loss
## [1] 766.36