Should I use Bayes's theorem in this problem? We have two companies $A$ & $B$ that produces an item, let's say for the sake of argument, that they both produces light bulbs.
Light bulbs of company $A$ have a probability of $p(A)$ of being defective, while B's light bulbs are defective with probability $p(B)$.
I always buy light bulbs from these two companies with the same proportions, $x(A)$ & $x(B)$ with, of course, $x(A) + x(B) = 1$.
Now, if I pick $n$ light bulbs to test them and I got that $m$ (with $m \leq n$) were defective, what is the conditional probability that the $n$ lights were produced by company $A$?
Should I use Bayes theorem to answer? And if so, how?
 A: There are two ways to interpret your statement:
You buy all your bulbs from A with probability $x(A)$
The probability you got m defective if you were buying from A is $\binom{n}{m} p(A)^m(1-p(A))^{n-m}$, similar for B. Thus you can indeed use Bayes Theorem to assert that your posterior probability of having bought them in A is:
$$\frac{x(A)\binom{n}{m} p(A)^m(1-p(A))^{n-m}}{\binom{n}{m} (x(A)p(A)^m(1-p(A))^{n-m} + x(B)p(B)^m(1-p(B))^{n-m})} = \frac{x(A)p(A)^m(1-p(A))^{n-m}}{x(A)p(A)^m(1-p(A))^{n-m} + x(B)p(B)^m(1-p(B))^{n-m}}$$
You have a probability $x(A)$ of buying each light bulb from A
The probability you got m defective if all come from A is now $(x(A))^n\binom{n}{m}p(A)^m(1-p(A))^{n-m}$. The probability of getting m defective is a little bit more elaborate, you can see it in the denominator. In any case you can still apply Bayes:
$$\frac{x(A)^n\binom{n}{m} p(A)^m(1-p(A))^{n-m}}{\binom{n}{m}(x(A)p(A)+x(B)p(B))^m(x(A)(1-p(A))+x(B)(1-p(B)))^{n-m}} = \frac{x(A)^n p(A)^m(1-p(A))^{n-m}}{(x(A)p(A)+x(B)p(B))^m(x(A)(1-p(A))+x(B)(1-p(B)))^{n-m}}$$
