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?
# For the draw that contains 1 greenjelly beans we can have 5 choose 1 where 5 jelly beans can have 1 position
choose(5,1)
## [1] 5
# Then for other spots must be filled with red jellybeans for the remaining for 4 spots so:
choose(7,4)
## [1] 35
# For the draw that contains no green jelly beans we only have red jelly beans we can do 7 red jelly beans choose 5 spots:
choose(7,5)
## [1] 21
# Combining the possibilites we have in total:
paste0("Total: ",(choose(5,1) * choose(7,4)) + choose(7,5))
## [1] "Total: 196"
  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?
# Possibilites of 4 representatives and one senator we have:
choose(13,4) * choose(14,1)
## [1] 10010
# Possibilites with all 5 representative we have:
choose(13,5)
## [1] 1287
# Total possiblites are:
paste0("Total: ",(choose(13,4) * choose(14,1)) + choose(13,5))
## [1] "Total: 11297"
  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?
# If a coin is tossed 5 times and the only possiblites are Heads and Tails which are 2 possiblites then we have: 32 outcomes
2*2*2*2*2 
## [1] 32
# A standard six sided die has 6 possiblites 1 thorugh 6 and we roll it 2 times which is: 36 outcomes
6*6
## [1] 36
# A group of three cards choose from 52 cards is 52 choose 3
choose(52,3)
## [1] 22100
# We add all them up:
paste0("Total: ",32+36 + choose(52,3))
## [1] "Total: 22168"
  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.
# Probablity atleast one of the card is a 3 means P(x > 1) =
# we have 4 cards that are a 3 
# one of the card is a 3 
choose(4,1) * choose(48,2)
## [1] 4512
# two of the card is a 3
choose(4,2) * choose(48,1)
## [1] 288
# three of the cards is a 3 
choose(4,3)
## [1] 4
# 3 cards drawn from a deck without replacement is 52 choose 3 so
choose(52,3)
## [1] 22100
# Adding all the cards over the total cards drawn from the deck is:
Total_Prob = (4512+288+4)/choose(52,3)
paste0("Total: ",round(Total_Prob,4))
## [1] "Total: 0.2174"
  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?
# He has picked 17+14 31 movies to choose for 5 so 31 choose 5
choose(31,5)
## [1] 169911
# Step 2. How many different combinations of 5 movies can he rent if he wants at least one mystery?
# P(X > 1) = 1 - P(X < 1)
# Atleast one mystery means possible combinations of 1 mystery or more 
# Combinations with one mystery and 4 docs
oNe <- choose(14,1) * choose(17,4)
# Combinations with two mystery and 3 docs:
two <- choose(14,2) * choose(17,3)
# Combinations with three mystery and 2 docs:
three <- choose(14,3) * choose(17,2)
# Combinations with 4 mystery and 1 doc:
four <- choose(14,4) * choose(17,1)
# COmbinations with all 5 movies being mysteries
five <- choose(14,5)
# All of the total is:
paste0("Total: ",oNe + two + three + four + five)
## [1] "Total: 163723"
  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.
# If Cory needs to have an equal # from each symphony for 9 then he needs three of each so
# 4 Brahms For 3
choose(4,3)
## [1] 4
# 104 Haydn for 3
choose(104,3)
## [1] 182104
# 17 Mendelssohn for 3
choose(17,3)
## [1] 680
# Multiplying them all we get
ans <- choose(4,3) * choose(104,3) * choose(17,3)

formatC(ans,format="e")
## [1] "4.9532e+08"
  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.
# 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 books are 6+6+7+5 which is 23 books
# No more than 4 means we can only have 4 or less nonfiction books 
# 23 - 5 = 19
# Combinations with 1 non-fic and 19 others books then:
o <- choose(5,1) * choose(19,12)
# With 2 non-fic and 
t <- choose(5,2) * choose(19,11)
# With 3 non-fic 
three <- choose(5,3) * choose(19,10)
# With 4 non-fic 
four <- choose(5,4) * choose(19,9)
paste0("different reading schedules are possible: ",formatC(o+t+three+four,format="e"))
## [1] "different reading schedules are possible: 2.3934e+06"
# 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.
# 6 plays for 6 slots and the remaing are whatever so: 23 books - 6 plays = 18 books left
choose(6,6) * choose(18,7)
## [1] 31824
paste0("Total: ", formatC(choose(6,6) * choose(18,7),format = "e"))
## [1] "Total: 3.1824e+04"
  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? Express your answer as a fraction or a decimal number rounded to four decimal places.
# Total arrangement is 2 syca + cypress or cypress + syca 
# So we have 5 sycamores for 5 positions and andother 5 cypress for another 5
syca <- choose(5,5)
cypress <- choose(5,5)
arrangement <- 2
paste0("Total: ",(syca * cypress)/2)
## [1] "Total: 0.5"
  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.
# Step 1. Find the expected value of the proposition. Round your answer to two decimal
# places. Losses must be expressed as negative values.
# In order to get $4 i must not get a king or an ace since there are 4 kings and 4 aces we have probability 8/52 so 
# 1 - 8/52 = 44/52
# To lose 16 we must have 8/52
paste0("Value: ",round((4* (44/52)) + (-16 * (8/52)),4))
## [1] "Value: 0.9231"
#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
# multiply the answ by 833
ans <- (4* (44/52)) + (-16 * (8/52))
ans <- round(833 * ans,2)

paste0("Value: ", ans)
## [1] "Value: 768.92"