Question 1:

  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?

Binomial Coefficient formula: \[\binom{n}{k} = \frac{n!}{k!(n-k)!}\]

  • Green Jellybeans = 5
  • Red Jellybeans = 7
  • Total jellybeans = 12

Case 1: Zero green jellybeans are withdrawn or all five are red

Number of ways to do this is given by the combination formula: C(7,5) = 7! / (5! * 2!) = 21

Case 2: Choose 4 Red and 1 green we need to choose 4 jellybeans from the 7 red jellybeans, and 1 jellybean from the 5 green jellybeans. The number of ways to do this is given by: C(7,4) = (7! / (4! * 3!)) = 35

C(5,1) = (5! / (1! * 4!) = 5

Now multiply these two = 35*5 = 175

Therefore, the total number of ways to withdraw 5 jellybeans from the bag so that the number of green ones withdrawn will be less than 2 is the sum of the two cases:

21 + 175 = 196 ways.

Use Choose() function to solve this in R code:

choose (7,5) + (choose (7,4) * choose(5,1))
## [1] 196

Question 2:

  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?

We will use Binomial Coefficient formula to solve this.

Options for at least 4 must be representatives are:

  • case 1: 4 representatives, 1 senator
  • Case 2: 5 representatives, 0 senator

case 1: 4 representatives, 1 senator

sen <- 14
rep <- 13

# 4 representatives
rep_13_ch_4 <- factorial(13) / (factorial(4)*(factorial(13-4)))

# 1 senator
sen_14_ch_1 <- factorial(14) / (factorial(1)*(factorial(14-1)))

# multiply steps of case 1
(rep_4_sen_1 <- rep_13_ch_4*sen_14_ch_1)
## [1] 10010

Case 2: 5 representatives, 0 senator

(rep_13_ch_5 <- factorial(13) / (factorial(5)*(factorial(13-5))))
## [1] 1287

Result:add case 1 and case 2

rep_4_sen_1+rep_13_ch_5
## [1] 11297

Using choose() to check this in R:

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

Question 3:

  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?
# set variables
coin <- 2
die <- 6
cards <- 52

# coin is tossed 5 times
coin_5 <- coin^5

# six-sided die is rolled 2 times
die_2 <- die^2
# group of three cards are drawn from a standard deck of 52 cards without replacement

cards_52_ch_3 <- factorial(52) / (factorial(3)*factorial(52-3))

# final result
coin_5*die_2*cards_52_ch_3
## [1] 25459200

Question 4:

  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.

Probability that at least one of the cards drawn is 3: possible test scenarios:

  • all 3 cards drawn are 3: choose(4,3)
  • Out of 3 drawn cards 2 are 3 and 1 is something else: choose(4,2) * choose(48,1)
  • Out of 3 drawn cards 1 card is 3 and 2 are something else: choose(4,1) * choose(48,2)
round(((choose(4,1) * choose(48,2)) + (choose(4,2) * choose(48,1)) + choose(4,3)) / choose(52,3),digits = 4)
## [1] 0.2174

Question 5:

  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?

doc<-17
myst<-14
Total_movie<-31
(Choose_5movie<-choose(31,5))
## [1] 169911
#Choose_5movie

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

Answer: 5 movies can he rent if he wants at least one mystery: possible test scenarios:

  • 1 myst and 4 doc = choose(14,1)*choose(17,4)
  • 2 myst and 3 doc = choose(14,2)*choose(17,3)
  • 3 myst and 2 doc = choose(14,3)*choose(17,2)
  • 4 myst and 1 doc = choose(14,4)*choose(17,1)
  • 5 myst and 0 doc = choose(14,5)*choose(17,0) ##[choose(17,0) = 1]
myst1_doc4<-choose(14,1)*choose(17,4)
myst2_doc3<- choose(14,2)*choose(17,3)
myst3_doc2<- choose(14,3)*choose(17,2)
myst4_doc1<- choose(14,4)*choose(17,1)
myst5_doc0<- choose(14,5)*choose(17,0)
# sum all to find different combination
(myst1_doc4+myst2_doc3+myst3_doc2+myst4_doc1+myst5_doc0)
## [1] 163723

Question 6:

  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.

# set variables
brahms <- 4
haydn <- 104
Mendel <- 17
(format(choose(4,3) * choose(104,3) * choose(17,3),scientific = T, digits = 4))
## [1] "4.953e+08"

Question 7:

  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.
# set variables
novels <- 6
plays <- 6
poetry <- 7
non_fiction <- 5
total <- novels+plays+poetry+non_fiction

format(choose(total,13) - choose(5,5) * choose(total-5,8),scientific = T, digits = 3)
## [1] "2.42e+06"

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. Answer:

format(choose(plays,6) * choose(total-plays,7),scientific = T, digits = 4)
## [1] "3.182e+04"

Question 8:

  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?

Answer:

sycamores<-5
cypress<-5
total_tree<-10
# all possible outcomes
(tree10choose5<-choose(10,5))
## [1] 252
## find proportion by dividing 2
round(2/tree10choose5, digits = 4)
## [1] 0.0079

Question 9:

  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.

Answer:

cards <- 52
queen_lower<- 44
pay_qn_lower <- 4
if_not <- 16
round(pay_qn_lower * queen_lower/cards - if_not * ((cards-queen_lower)/cards),2)
## [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.

Answer:

round(833*0.92, digits = 2)
## [1] 766.36