Let X1 and X2 be independent random variables with common distribution Px = 0 (1/8), 1 (3/8), 2 (1/2). Find the distribution of the sum X1 + X2.
Answer:
#Let Z = x1 + X2
#P(z = 0) = 0.015625
1/8*1/8
## [1] 0.015625
#P(Z = 1) = 0.09375
1/8*3/8 + 3/8*1/8
## [1] 0.09375
#P(Z = 2) = 0.265625
1/8*1/2 + 3/8*3/8 + 1/2*1/8
## [1] 0.265625
#P(Z = 3) = 0.375
3/8*1/2 + 1/2*3/8
## [1] 0.375
#P(Z = 4) = 0.25
1/2*1/2
## [1] 0.25
#make sure they sum to 1
(1/8*1/8 ) + (1/8*3/8 + 3/8*1/8) + (1/8*1/2 + 3/8*3/8 + 1/2*1/8) + (3/8*1/2 + 1/2*3/8) + (1/2*1/2)
## [1] 1