Suppose there are 2 bags (A and B). In the A 30% of the blue balls, 40% red and 30% black. In the B 30% of red, 50% of blue and 20% of yellow. Each bag was taken out by a ball. The first ball was red and the second was blue. What is the probability that the first bag was A.
My solution is as follows, but it seems to me that I'm wrong.
Let P(red)=P(r), P(blue)=P(b). It's obvious that P(A)=P(B).
$$P(A|(r,b))=\frac{P((r,b)|A)P(A)}{P(r,b)}=\frac{P(r|A)P(b|A)P(A)}{P((r,b)|A)P(A)+P((r,b)|B)P(B)}=\frac{P(r|A)P(b|A)}{P(r|A)P(b|A)+P(r|B)P(b|B)}=\frac{0.4\cdot0.3}{0.4\cdot0.3+0.3\cdot0.5}=0.444444$$
A ball was taken from each bag.
We want to find the probability for taking a red from bag A (and therefore a blue from bag B) given that a red and a blue ball were taken out; let us represent that as: $\newcommand{\pair}[2]{\langle{#1,#2}\rangle} \mathsf P(\pair r b \mid \pair r b \cup\pair b r )$ , where the pair $\pair ab$ represents that the colours taken from bag $A$ and $B$ respectively (not first and second bag).
(Whichever bag from which the red ball was taken is the "first bag".)
$$\begin{align}\mathsf P(\pair r b \mid \pair r b \cup\pair b r )~&=~\dfrac{\mathsf P(\pair r b )}{\mathsf P(\pair r b )+\mathsf P(\pair b r )} \\[1ex] &=~ \dfrac{0.40\cdot 0.50}{0.40\cdot 0.50 + 0.30\cdot 0.30}\end{align}$$