let us consider following problem taken from book
An appliance store purchases electric ranges from two companies. From company A, 500 ranges are purchased and 2% are defective. From company B, 850 ranges are purchased and 2% are defective. Given that a range is defective, find the probability that it came from company B
so here we are assuming that probability of selection company is equally right? that means that $P(A)=P(B)=\frac{1}{2}$ , also $2$ % defective means that probability of selection of defective from ranges is equal to $0.02$, for instance in Company A, number of defective ranges is $500*0.02=10$ there probability is equal to $\frac{10}{500}=0.02=2$%
we know probability of selecting defective range is equal to
$ \frac{1}{2} *2$% + $\frac{1}{2} *2$% and probability of selecting defective from company B will be $1/2 * 2$% divided by probability of selection of defective range, but book says that answer is $0.65 $, how?
Either there is a typo or the answer in the book $(0.65)$ isn't correct:
In the problem text is nothing said about a specific randomized selection process. So, the only meaningful context here is to consider the range as randomly selected from all ranges.
Now $\color{blue}{\mbox{Bayes}}$ gives immediately (here including all steps)
$$\color{blue}{P(B|D)} = \frac{P(B \cap D)}{P(D)} = \frac{P(B \cap D)}{P(D \cap A) + P(D \cap B)}= \color{blue}{\frac{P(D|B)P(B)}{P(D|A)P(A) + P(D|B)P(B)}}$$ $$ = \frac{0.02\cdot \frac{850}{500+850}}{0.02\cdot \frac{500}{500+850} + 0.02\cdot \frac{850}{500+850}} = \frac{850}{500+850} \approx \boxed{0.63}$$