## ECC failure in memory device (probability of bad word transmission)

so this is my problem and the solution. i am looking for concurrence or disagreement with my method. any help will be appreciated.

ECC works for a single bad bit, if 2 or more bad bits, word is uncorrectable and ECC doesnt work.

B = 21 bits / address (16 data bits, 5 ECC bits)
p = probability of bad bit (bit in error)
1-p = probability of good bit

probability of exactly 0 bits in error (all 21 bits are good within the word)
(1-p)^B

probability of exactly 1 bit in error (all 21 bits are bad and 20 bits are good)
B*p*(1-p)^(B-1)

probability of more than 1 bit in error (1 - sum of the above two expressions)
1 - [((1-p)^B) + (B*p*(1-p)^(B-1))]

this simplifies to
1 - (1-p)^B - (B*p*(1-p)^(B-1)

Then we take this equation, expand the middle term, (1-p)^B, to the second order binomial expression and simplify the rest of the equation to:

binomial series:
(1+x)^n = 1 + xn + [n(n-1)x^2]/2! + [n(n-1)(n-2)x^3]/3! ...

~ p^2*B*(B-1) - [p^2*B*(B-1)]/2 = p^2*B*(B-1)
solve for B=21 bits/word

420*p^2 - 210*p^2 = 210*p^2
so this above expression corresponds to a bad word transmission for every word transmission attempt.