Problem 3.2

p=c(1/4,1/2,1/8,1/8)
x=c(0:3)
s=sample(x,10000,replace=TRUE,prob=p) 
one=s[s==1] 
length(one)/length(s) 
## [1] 0.5036
t=table(s)
prop.table(t)
## s
##      0      1      2      3 
## 0.2470 0.5036 0.1248 0.1246

Problem 3.34

Set1 <- rpois(300,2)

Set2 <- dpois(Set1,2)

Set3 <- choose(300,Set2)*(2/300)^Set2*(1-2/300)^(300-Set2)

Set4 <- Set3 - Set2

max(Set4)
## [1] 0.1343682

Problem 4.13

X <- rnorm(10000, 0, 2)
Y <- rnorm(10000, 0, 1)
Z <- X+ 3*Y
var(Z)
## [1] 13.29372
C <- 1^2*4+3^2*1
## var(Z) > C