Combinations
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?
196 Combinations
<-choose(5,1) * choose(7,4) # 175
ways_1_green<-choose(5,0) * choose(7,5) # 21
ways_0_green
# add the 2 because they are 2 unrelated result sets
sprintf("%.d combinations to withdraw less than 2 green",ways_0_green+ways_1_green )
## [1] "196 combinations to withdraw less than 2 green"
23520 Permutations
# 2520 permutations of 5 from 7reds (0 greens)
<-factorial(7)/factorial(2)
ways_0_green
# 21000 permutations of 4 from 7reds (1 green from 5 greens)
<-(factorial(7)/factorial(3)) * (factorial(5)/factorial(4)) * 5
ways_1_green
sprintf("%d permutations to withdraw less than 2 green",ways_0_green+ways_1_green )
## [1] "23520 permutations to withdraw less than 2 green"
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?
11297 Combinations
<-choose(14,1) * choose(13,4) # 10010
ways_4_reps<-choose(14,0) * choose(13,5) # 1287
ways_5_reps
sprintf("%d Combinations to withdraw less than 2 green",ways_5_reps+ways_4_reps )
## [1] "11297 Combinations to withdraw less than 2 green"
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?
2^5 * 6^2 * 52 * 51 * 50
## [1] 152755200
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.
We can calcuate this as 1 minus the probability of 3 straight non-threes
round(1 - (48/52 * 47/51 * 46/50),4)
## [1] 0.2174
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?
<-choose(17,5)
total_combinations total_combinations
## [1] 6188
How many different combinations of 5 movies can he rent if he wants at least one mystery?
Just subtract out the all documentary combinations
-choose(17,5) total_combinations
## [1] 0
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.
<-choose(4,3)
brahms_combos<-choose(104,3)
haydn_combos<-choose(17,3)
mendelssohn_combos
options(digits = 3, scipen = -3)
* haydn_combos * mendelssohn_combos brahms_combos
## [1] 4.95e+08
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.
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.
<-choose(24,13)
total_combinations
options(digits = 3, scipen = -3)
/5 total_combinations
## [1] 4.99e+05
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 all 6 plays are a given, we just need to calculate the combinations for a set of 7 from 18
options(digits = 3, scipen = -3)
choose(18,7)
## [1] 31824
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.
The total permutations of 5 times the total permutations of 5 is the number of ways to sit cypress trees in a group and also the sycamore trees in a group. But we can also consider that the sycamores can precede the cypress or vica-versa so multiply that result by 2
<-(factorial(5)*factorial(5))/factorial(10) # 3.97e-03 or 0.003970
prob<-prob * 2 #
prob
sprintf("%.3e",prob)
## [1] "7.937e-03"
This can be done with combinations as well although I find this method less intuitive.
# library(gtools)
# prob<-2/nrow(combinations(10,5))
<-2/choose(10,5)
probsprintf("%.3e",prob)
## [1] "7.937e-03"
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.)
Find the expected value of the proposition.
Round your answer to two decimal places.
Losses must be expressed as negative values.
<-44/52
p_win_4<-8/42
p_lose_16
<-(4 * p_win_4) + (-16 * p_lose_16)
expected_value
round(expected_value,2)
## [1] 0.34
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.
round(833 * expected_value,2)
## [1] 281