(18 - page 199)

A baker blends 600 raisins and 400 chocolate chips into a dough mix and, from this, makes 500 cookies.

lambda_raisin = 600/500 = 6/5 raisen per cookie lambda_chocolate = 400/500 = 4/5 raise per cookie lambda_bits = (600 + 400)/500 = 1000/500 = 2 bits per cookie

lambda_raisin <- 600/500
lambda_chocolate <- 400/500
lambda_bits <- (600 + 400)/500

P(X=x) = (lambda^x) * (e^-lambda) / x!


  1. Find the probability that a randomly picked cookie will have no raisins.

P(X=0) = ((lambda_raisin^0) * (e^-lambda_raisin)) / 0! = .30

e <- exp(1)
round(((lambda_raisin^0) * (e^(-1*lambda_raisin))) / factorial(0), 2)
## [1] 0.3

  1. Find the probability that a randomly picked cookie will have exactly two chocolate chips.

P(X=2) = ((lambda_chocolate^2) * (e^-lambda_chocolate)) / 2! = .14

e <- exp(1)
round(((lambda_chocolate^2) * (e^(-1*lambda_chocolate))) / factorial(2), 2)
## [1] 0.14
  1. Find the probability that a randomly chosen cookie will have at least two bits (raisins or chips) in it.

P(X>=2) = 1 - P(X<2) = 1 - [P(X=0) + P(X=1)] = .59

e <- exp(1)
round(1 - (((lambda_bits^0) * (e^-lambda_bits)) / factorial(0) + ((lambda_bits^1) * (e^-lambda_bits)) / factorial(1)), 2)
## [1] 0.59