Assignment 6

Question 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?

  • green must be 1 or 0
  • choose 1 green jellybean from the 5 green jellybeans in the bag * choose 4 red jellybeans from the 7 red jellybeans in the bag (1 green) + 5 red jellybeans from the 7 red in the bag (0 green)
this_many <- choose(5,1) * choose(7,4)  + choose(7,5)
cat("There are", this_many, "ways to withdraw 5 jellybeans with less than 2 green ones from the bag.")
## There are 196 ways to withdraw 5 jellybeans with less than 2 green ones from the bag.

Question 2.

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?

  • asking for 4/5 or 5/5 to be representatives
  • 0 or 1 to be senators
  • 1 senator * 4 reps + 5 reps
members <- choose(14,1) * choose(13,4) + choose(13,5)
cat("There are", members, "ways to form a subcommittee of 5 with at least 4 representatives.")
## There are 11297 ways to form a subcommittee of 5 with at least 4 representatives.

###Question 3.

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?

coin <- 2^5 #tossed 5 times, 2 outcomes
dice <- 6^2 #has 6 sides and is rolled 2x
cards <- choose(52,3)

total <- coin*dice*cards
cat("The total outcomes for all events combined is :", total)
## The total outcomes for all events combined is : 25459200

Question 4.

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. 0.2174

not_3 = (48/52 * 47/51 * 46/50) #4 out of 52, then still 4 out of 51...
three = 1 - not_3
round(three,4)
## [1] 0.2174

Question 5.

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?

selection <- choose(31,5) #14+17 options
cat("There are", selection, "different combinations of 5 movies can he rent")
## There are 169911 different combinations of 5 movies can he rent

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

  • 1, 2, 3, 4, or 5 mysteries
  • 4, 3,2, 1, or 0 documentaries
selection - choose(17, 5)
## [1] 163723

Question 6.

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.

brahms <- choose(4,3) # 4 Brahms For 3 
haydn <- choose(104,3) # 104 Haydn for 3
mendel <- choose(17,3) # 7 Mendelssohn for 3 

format(brahms*haydn*mendel,format="e", digits = 3)
## [1] "4.95e+08"

Question 7.

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.

  • 13 books to pick out of 24 options
total_options <- choose(24,13)
five <- choose(19,8) #6 novels + 6 plays + 7 poetry ; 13 - 5
format(total_options - five, digits=3, scientific=TRUE)
## [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.

# 13 minus 6=7 remaining options and all 23-6=18
formatC(choose(6,6) * choose(18,7), digits=2)
## [1] "3.2e+04"

Question 8.

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.

round (2 / (factorial(10) / (factorial(5) * factorial(5))),4)
## [1] 0.0079
probability <- 2 / choose(10,5)
#double checked for fun

Question 9.

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.

#2*4 types =8; 52-8
# winning is below, loosing is below+ pay
exp_value <- (44/52 * 4) - (8/52 * 16)
exp_value_rounded <- round(exp_value, digits = 2)
cat("Expected Value:", exp_value_rounded, "\n")
## Expected Value: 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.

  #step 1*833
round((833*exp_value),2)
## [1] 768.92