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
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
# 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
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
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
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"
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
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
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