CUNY MSDS DATA 605 Week 6

Nicholas Schettini

October 3, 2018

Question 8

A die is rolled 30 times. What is the probability that a 6 turns up exactly 5 times?

dbinom(x = 5, prob = 1/6, size = 30)
## [1] 0.1921081

What is the most probable number of times that a 6 will turn up?

expected successes = probability * number of trial

1/6 * 30
## [1] 5

Question 12

A poker hand is a set of 5 cards randomly chosen from a deck of 52 cards.

\[ _nC_r = \frac {n!}{r!(n-r)!} \ \]

Find the probability of a:

  1. royal flush (ten, jack, queen, king, ace in a single suit).
C <- function(n, r){
  factorial(n)/(factorial(n-r)*factorial(r))
}
combination <- C(52, 5)
cat("Total number of ways is:", combination, "\n")
## Total number of ways is: 2598960
4/combination
## [1] 1.539077e-06

Choose function also works

choose(52,5)
## [1] 2598960
  1. straight flush (five in a sequence in a single suit, but not a royal flush).
36/combination
## [1] 1.385169e-05
  1. four of a kind (four cards of the same face value).

\[ _{13}C_1 * _{4}C_4 * _{48}C_1 = 13 * 1 * 48 = 624\]

624/combination
## [1] 0.000240096