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?
We should consider 2 cases: (1) The number of green jellybeans withdrawn is 0. (2) The number of green jellybeans withdrawn is 1.
Case 1: The number of green jellybeans withdrawn is 0. This means all 5 jellybeans withdrawn will be red.
\(\binom{7}{5}=\frac{7!}{5!(7-5)!}=\frac{7!}{5!\cdot 2!}=21\)
Case 2: The number of green jellybeans withdrawn is 1. This means out of all 5 jellybeans withdraw, 1 jellybean will be green and 4 jellybeans will be red.
(the number of ways to choose 1 green jellybean form 5 green jellybeans) \(\cdot\) (the number of ways to choose 4 red jellybeans form 7 red jellybeans)
\(\binom{5}{1}\binom{7}{4}=\frac{5!}{1!(5-1)!} \cdot \frac{7!}{4!(7-4)!}=\frac{5!}{4!} \cdot \frac{7!}{4!\cdot 3!}=5\cdot 35 = 175\)
Total ways = \(21+175=196\)
green <- 5
red <- 7
withdraw <- 5
# Case 1: Withdraw 0 green jellybean (all 5 are red)
case1 <- choose(red, withdraw)
# Case 1: Withdraw 1 green jellybean and 4 red jellybeans
case2 <- choose(green, 1)*choose(red, withdraw-1)
total <- case1 + case2
paste("The total ways that 5 jellybeans can be withdrawn from the bag so that the number of green ones withdrawn will be less than 2 is", total)
## [1] "The total ways that 5 jellybeans can be withdrawn from the bag so that the number of green ones withdrawn will be less than 2 is 196"
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?
We should consider 2 cases: (1) The subcommittee of 5 contains 4 representatives and 1 senator. (2) The subcommittee of 5 contains 5 representatives and 0 senator.
Case 1: The subcommittee of 5 contains 4 representatives and 1 senator
(the number of ways to choose 4 representatives form 13 representatives) \(\cdot\) (the number of ways to choose 5 representatives form 13 representatives)
\(\binom{13}{4}\binom{14}{1}=\frac{13!}{4!(13-4)!} \cdot \frac{14!}{1!(14-1)!}=\frac{13!}{4!\cdot9!} \cdot \frac{14!}{13!}=715\cdot 14 = 10,010\)
Case 2: The subcommittee of 5 contains 5 representatives and 0 senator
\(\binom{13}{5}=\frac{13!}{5!(13-5)!}=\frac{13!}{5!\cdot8!}=1287\)
Total ways = \(10,010+1,287=11,297\)
senators <- 14
representatives <- 13
subcommittee <- 5
# Case 1: 4 representatives and 1 senator
case1 <-choose(representatives,4)*choose(senators,subcommittee-4)
# Case 2:
case2 <-choose(representatives,subcommittee)
total <- case1 + case2
paste("The total ways that a subcommittee of 5 can be formed if at least 4 of the members must be representatives is", total)
## [1] "The total ways that a subcommittee of 5 can be formed if at least 4 of the members must be representatives is 11297"
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?
For each coin toss, there are 2 possible outcomes (heads or tails). Tossing the coin 5 times results \((2)^{6}=64\) different outcomes.
For each standard six-sided roll, there are 6 possible outcomes (1, 2, 3, 4, 5, or 6). Rolling the standard six-sided roll 2 times results \((6)^{2}=36\) different outcomes.
Drawing three cards from a standard deck of 52 cards without replacement results \(\binom{52}{3}=\frac{52!}{3!(52-3)!}=\frac{52!}{3!\cdot49!}=22,100\) different outcomes.
Total outcomes = \(64*36*22,100 = 50,918,400\)
total <- 2^6*6^2*choose(52,3)
paste("The total different outcomes is", total)
## [1] "The total different outcomes is 50918400"
A standard deck of cards contains 52 cards (26 of which are red and 26 of which are black) divided into 4 suits (clubs, spades, diamonds, and hearts), where there are 13 of each rank (ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, jack, queen, and king). Of these cards, 12 are considered face cards (4 kings, 4 queens, and 4 jacks) and 16 do not have numbers on them (4 aces, 4 kings, 4 queens, and 4 jacks).
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.
The probability that at least one of the cards drawn is a 3 is the same as the sum of the probability that exactly one card is 3, exactly two cards is 3, and exactly three cards is 3.
Let \(x\) be the number of cards that is a 3
\(P(x\leq 1)=P(x=1)+P(x=2)+P(x=3)\)
The probability that at least one of the cards drawn is a 3 is complement of no cards drawn is a 3.
\(P(x\leq 1)=1-P(x=0)\)
There are 4 cards that is a 3, which means there are \(52-4=48\) cards that is not a 3.
First card drawn: The probability of the first card drawn that is not a 3 is \(\frac{48}{52}\).
Second card drawn: After the first card is drawn (no replacement), there will be \(52-1=51\) cards left in the deck and \(48-1=47\) cards are not a 3. The probability of the second card drawn that is not a 3 is \(\frac{48-1}{52-1}=\frac{47}{51}\).
Third card drawn: After the first and second card is drawn (no replacement), there will be \(52-2=51\) cards left in the deck and \(48-2=46\) cards are not a 3. The probability of the second card drawn that is not a 3 is \(\frac{48-2}{52-2}=\frac{46}{50}\).
\(P(x=0)=\frac{48}{52}\cdot\frac{47}{51}\cdot\frac{46}{50}\approx0.2174\)
total_cards <- 52
cards_with_three <- 4
cards_with_no_three <- total_cards-cards_with_three
first_card <- cards_with_no_three/total_cards
second_card <- (cards_with_no_three-1)/(total_cards-1)
third_card <- (cards_with_no_three-2)/(total_cards-2)
p_no_threes <- first_card*second_card*third_card
p_at_least_one_three <- 1 - p_no_threes
paste("The probability that at least one of the cards drawn is a 3 is ", round(p_at_least_one_three,4))
## [1] "The probability that at least one of the cards drawn is a 3 is 0.2174"
The probability that at least one of the cards drawn is a 3 is complement of no cards drawn is a 3. \(P(x\leq 1)=1-P(x=0)\)
There are 4 cards that is a 3, which means there are \(52-4=48\) cards that is not a 3.
The total possible way to draw any three card from a standard deck of cards is \(\binom{52}{3}=\frac{52!}{3!(52-3)!}=\frac{52!}{3!\cdot29!}=1287\)
The total possible way draw three cards that is not a 3 from a standard deck of cards is \(\binom{48}{3}=\frac{48!}{3!(48-3)!}=\frac{48!}{3!\cdot45!}=\)
The probability that all three cards is not a 3 is (The total possible way draw three cards that is not a 3 from a standard deck of cards)/(The total possible way to draw any three card from a standard deck of cards) = \(\frac{\binom{48}{3}}{\binom{52}{3}}=\frac{\frac{48!}{3!(48-3)!}}{\frac{52!}{3!(52-3)!}}=\frac{\frac{48!}{3!\cdot45!}}{\frac{52!}{3!\cdot49!}}\approx0.2174\)
total_cards <- 52
cards_with_three <- 4
cards_with_no_three <- total_cards-cards_with_three
number_cards_withdraw <- 3
draw_any_three_cards <- choose(total_cards,number_cards_withdraw)
draw_no_threes <- choose(cards_with_no_three,number_cards_withdraw)
p <- draw_no_threes/draw_any_three_cards
p_at_least_one_three2 <- 1-p
paste("The probability that at least one of the cards drawn is a 3 is ", round(p_at_least_one_three2,4))
## [1] "The probability that at least one of the cards drawn is a 3 is 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?
Lorenzo can rent any 5 movies from a total of \(17+14=31\) selections.
\(\binom{17+14}{5}=\binom{31}{5}=169911\)
total <- choose(31,5)
paste("The total different combinations of 5 movies he can rent is", total)
## [1] "The total different combinations of 5 movies he can rent is 169911"
We should consider 6 cases:
He rent 5 documentaries and 0 mystery.
He rent 4 documentaries and 1 mystery.
He rent 3 documentaries and 2 mysteries.
He rent 2 documentaries and 3 mysteries.
He rent 1 documentaries and 4 mysteries.
He rent 0 documentaries and 5 mysteries.
Case 1: He rent 5 documentaries and 0 mystery.
(the number of ways to rent 5 documentaries form 17 documentaries) = \(\binom{17}{5}\)
Case 2: He rent 4 documentaries and 1 mystery.
(the number of ways to rent 4 documentaries form 17 documentaries) \(\cdot\) (the number of ways to rent 1 mystery form 14 mysteries) = \(\binom{17}{4}\binom{14}{1}\)
Case 3: He rent 3 documentaries and 2 mysteries.
(the number of ways to rent 3 documentaries form 17 documentaries) \(\cdot\) (the number of ways to rent 2 mysteries form 14 mysteries) = \(\binom{17}{3}\binom{14}{2}\)
Case 4: He rent 2 documentaries and 3 mysteries.
(the number of ways to rent 2 documentaries form 17 documentaries) \(\cdot\) (the number of ways to rent 3 mysteries form 14 mysteries) = \(\binom{17}{2}\binom{14}{3}\)
Case 5: He rent 1 documentaries and 4 mysteries.
(the number of ways to rent 1 documentaries form 17 documentaries) \(\cdot\) (the number of ways to rent 4 mysteries form 14 mysteries) = \(\binom{17}{1}\binom{14}{4}\)
Case 6: He rent 0 documentaries and 5 mysteries.
(the number of ways to rent 5 mysteries form 14 mysteries) = \(\binom{14}{5}\)
Total ways = \(\binom{17}{5}+\binom{17}{4}\binom{14}{1}+\binom{17}{3}\binom{14}{2}+\binom{17}{2}\binom{14}{3}+\binom{17}{1}\binom{14}{4}\binom{14}{5}=169,911\)
documentaries <- 17
mysteries <- 14
# Case 1: 5 documentaries and 0 mysteries
case1 <-choose(documentaries,5)*choose(mysteries,0)
# Case 2: 4 documentaries and 1 mysteries
case2 <-choose(documentaries,4)*choose(mysteries,1)
# Case 3: 3 documentaries and 2 mysteries
case3 <-choose(documentaries,3)*choose(mysteries,2)
# Case 4: 2 documentaries and 3 mysteries
case4 <-choose(documentaries,2)*choose(mysteries,3)
# Case 5: 1 documentaries and 4 mysteries
case5 <-choose(documentaries,1)*choose(mysteries,4)
# Case 6: 0 documentaries and 5 mysteries
case6 <-choose(documentaries,0)*choose(mysteries,5)
total <- case1 + case2 + case3 + case4 + case5 + case6
paste("The total different combinations of 5 movies he can rent is", total)
## [1] "The total different combinations of 5 movies he can rent is 169911"
How many different combinations of 5 movies can he rent if he wants at least one mystery?
We can use our last answer to solve this problem. In the previous part, we calculated all possible different combinations of 5 movies he can rent. Subtract the total ways to rent 5 documentaries (no mysteries) from the total way to rent any 5 movies.
(the total ways to rent any 5 movies from a selection of 31 movies)-(the number of ways to rent 5 documentaries form 17 documentaries)
\(\binom{31}{5} - \binom{17}{5} =169,911-6,188=163,773\)
total <- choose(31,5) - case1
paste("The total different combinations of that he can rent at least one mystery of the 5 is", total)
## [1] "The total different combinations of that he can rent at least one mystery of the 5 is 163723"
We should consider 5 cases:
He rent 4 documentaries and 1 mystery.
He rent 3 documentaries and 2 mysteries.
He rent 2 documentaries and 3 mysteries.
He rent 1 documentaries and 4 mysteries.
He rent 0 documentaries and 5 mysteries.
Case 1: He rent 5 documentaries and 0 mystery.
(the number of ways to rent 5 documentaries form 17 documentaries) = \(\binom{17}{5}\)
Case 2: He rent 4 documentaries and 1 mystery.
(the number of ways to rent 4 documentaries form 17 documentaries) \(\cdot\) (the number of ways to rent 1 mystery form 14 mysteries) = \(\binom{17}{4}\binom{14}{1}\)
Case 3: He rent 3 documentaries and 2 mysteries.
(the number of ways to rent 3 documentaries form 17 documentaries) \(\cdot\) (the number of ways to rent 2 mysteries form 14 mysteries) = \(\binom{17}{3}\binom{14}{2}\)
Case 4: He rent 2 documentaries and 3 mysteries.
(the number of ways to rent 2 documentaries form 17 documentaries) \(\cdot\) (the number of ways to rent 3 mysteries form 14 mysteries) = \(\binom{17}{2}\binom{14}{3}\)
Case 5: He rent 1 documentaries and 4 mysteries.
(the number of ways to rent 1 documentaries form 17 documentaries) \(\cdot\) (the number of ways to rent 4 mysteries form 14 mysteries) = \(\binom{17}{1}\binom{14}{4}\)
Case 6: He rent 0 documentaries and 5 mysteries.
(the number of ways to rent 5 mysteries form 14 mysteries) = \(\binom{14}{5}\)
Total ways = \(\binom{17}{5}+\binom{17}{4}\binom{14}{1}+\binom{17}{3}\binom{14}{2}+\binom{17}{2}\binom{14}{3}+\binom{17}{1}\binom{14}{4}\binom{14}{5}=169,911\)
documentaries <- 17
mysteries <- 14
# Case 1: 5 documentaries and 0 mysteries
case1 <-choose(documentaries,5)*choose(mysteries,0)
# Case 2: 4 documentaries and 1 mysteries
case2 <-choose(documentaries,4)*choose(mysteries,1)
# Case 3: 3 documentaries and 2 mysteries
case3 <-choose(documentaries,3)*choose(mysteries,2)
# Case 4: 2 documentaries and 3 mysteries
case4 <-choose(documentaries,2)*choose(mysteries,3)
# Case 5: 1 documentaries and 4 mysteries
case5 <-choose(documentaries,1)*choose(mysteries,4)
# Case 6: 0 documentaries and 5 mysteries
case6 <-choose(documentaries,0)*choose(mysteries,5)
total <- case2 + case3 + case4 + case5 + case6
paste("The total different combinations of that he can rent at least one mystery of the 5 is", total)
## [1] "The total different combinations of that he can rent at least one mystery of the 5 is 163723"
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.
Cory is setting up to schedule of 9 symphonies to be played and he needs to have an equal number of symphonies from Brahms, Haydn, and Mendelssohn. Thus, he needs to choose 3 from each composer.
choose 3 of the 4 Brahms: \(\binom{4}{3}\) choose 3 of the 104 Haydn: \(\binom{104}{4}\) choose 3 of the 17 Mendelssohn: \(\binom{17}{4}\)
Total possible schedules = \(\binom{4}{3}\cdot\binom{104}{4}\cdot\binom{17}{4}=4.95*10^{8}\)
brahms <- 4
haydn <- 104
mendelssohn <- 17
symphonies <- 9/3
total <- choose(brahms,symphonies)*choose(haydn,symphonies)*choose(mendelssohn,symphonies)
paste("The total possible different schedules are", formatC(total, format = "e", digits = 2))
## [1] "The total possible different schedules are 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.
Total books = \(6+6+7+5 = 24\)
total ways to read no more than 4 nonfiction books = (the total ways to pick any 13 books from a selection of 24 books)-(the number of ways to pick 5 nonfictions and 8 other books)
the total ways to pick any 13 books from a selection of 24 books = \(\binom{24}{13}\)
the number of ways to pick 5 nonfictions and 8 other books = (the number of ways to pick 5 nonfictions from 5 nonfictions)(the number of ways to pick 8 other books from 24-5=19 other books) =\(\binom{5}{5}\cdot\binom{24-5}{13-5}=\binom{5}{5}\cdot\binom{19}{8}=2.42\cdot10^{6}\)
novels <- 6
plays <- 6
poetry <- 7
nonfiction <- 5
total_books <- novels+plays+poetry+nonfiction
books_to_choose <- 13
choose_any13 <- choose(total_books,books_to_choose)
# choose 5 nonfiction and 8 other books
choose_5non <- choose(nonfiction,5)*choose(total_books-5,books_to_choose-5)
less_than_5non <- choose_any13-choose_5non
paste("The total possible different reading schedules are", formatC(less_than_5non , format = "e", digits = 2))
## [1] "The total possible different reading schedules are 2.42e+06"
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.
the number of ways to pick 6 plays and 7 other books = (the number of ways to pick 6 plays from 6 plays)(the number of ways to pick 13-6=7 other books from 24-6=18 other books) =\(\binom{6}{6}\cdot\binom{24-6}{13-6}=\binom{5}{5}\cdot\binom{18}{7}=3.18\cdot10^{4}\)
novels <- 6
plays <- 6
poetry <- 7
nonfiction <- 5
total_books <- novels+plays+poetry+nonfiction
books_to_choose <- 13
# choose 6 plays and 7 other books
choose_6plays <- choose(plays,6)*choose(total_books-6,books_to_choose-6)
paste("The total possible different reading schedules are", formatC(choose_6plays , format = "e", digits = 2))
## [1] "The total possible different reading schedules are 3.18e+04"
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 possible way to plant 10 trees is \(10!\). The total possible way to plant 5 sycamores trees next to each other is \(5!\). The total possible way to plant 5 cypress trees next to each other is \(5!\).
The probability of randomly planting the trees so that all 5 sycamores are next to each other and all 5 cypress trees are next to each other is \(\frac{5!\cdot5!}{10!}=\frac{1}{252}\)
p <- (factorial(5)*factorial(5))/factorial(10)
paste("The probability is ", p, "which is approximately",round(p,digits = 4) )
## [1] "The probability is 0.00396825396825397 which is approximately 0.004"
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.)
Expected value
Find the expected value of the proposition. Round your answer to two decimal places. Losses must be expressed as negative values.
There are 8 cards (kings and ace) higher than the queen. The number of cards that are queen or lower is \(52-8=44\). We want to make sure to draw any of those 44 cards. The proability of drawing a queen or lower is \(44/52=11/13\). The probability of drawing higher than a queen is \(8/52=2/13\)
The expected value of the proposition is \(4\cdot\frac{11}{13}-16\cdot\frac{2}{13}\approx0.92\)
p <- 44/52
pc <- 8/52
expected_value <- 4*(p)-16*pc
expected_value
## [1] 0.9230769
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,digits=2)
## [1] 768.92