Binomial Distribution of no more than/at least $x$ rejects out of 10 items

405 Views Asked by At

A manufacturer of metal pistons finds that, on average, 12% of the pistons they manufacture are rejected because they are incorrectly sized. What is the probability that a batch of 10 pistons will contain:

No more than 2 rejects? At least 2 rejects?

\begin{align} P(X\leq 2) &= \sum_0^2\mathcal{B}(i,10, 0.12)\\ P(X\geq 2) &= 1-\sum_0^1\mathcal{B}(i,10, 0.12)\\ \end{align}

And I got

0.658
0.721

Which aren't the right answers.

import math
from functools import reduce
import operator as op

p = 0.12
n = 10

# No more than two rejects
def nCr(n,r):
    r = min(r, n-r)
    num = reduce(op.mul, range(n, n-r,-1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return num // denom
    
result = 0
    
for i in range(0,2):
    result += nCr(n,i)*p**i*(1-p)**(n-i)
    
print(round(result,3))

# At least two rejects
result = 0
for i in range(0,1):
    result += nCr(n,i)*p**i*(1-p)**(n-i)
    
print(round(1-result,3))
    
    
1

There are 1 best solutions below

2
On

First of all

$$P(X\geq 2)=1-P(X\leq 1)$$

And obviously

$$P(X\leq 2)=0.88^{10}+\binom{10}{1}0.12\cdot0.88^9+\binom{10}{2}0.12^2\cdot0.88^8\approx 89.13\%$$

Thus

$$P(X\geq 2)=1-P(X\leq 1)\approx 34.17\%$$

These result are correct.