Binomial Coefficient formula: \[\binom{n}{k} = \frac{n!}{k!(n-k)!}\]
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
We will use Binomial Coefficient formula to solve this.
Options for at least 4 must be representatives are:
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
# 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
Probability that at least one of the cards drawn is 3: possible test scenarios:
round(((choose(4,1) * choose(48,2)) + (choose(4,2) * choose(48,1)) + choose(4,3)) / choose(52,3),digits = 4)
## [1] 0.2174
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:
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
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"
# 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"
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
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
https://davetang.org/muse/2013/09/09/combinations-and-permutations-in-r/ https://www.r-tutor.com/elementary-statistics/probability-distributions/binomial-distribution https://towardsdatascience.com/back-to-basics-part-1-7065c90eae71 http://www.philosophypages.com/lg/e16.htm http://www.stat.ucla.edu/~cochran/stat10/winter/lectures/lect8.html https://www.youtube.com/watch?v=zKxdcCgzZ-M