I have two urns, one with $2$ red, $3$ green, and $2$ blue balls and the other with $3$ red, $4$ green, and $3$ blue balls. If I pick an random urn and draw one ball, and that ball is blue, what is the probability it came from the first urn?
So far, I have:
$P(U1|B)=(P(B|U1)*P(U1))/P(B)$
Plugging in values, I use $(2/7*1/2)/5/17$
For that, I get $17/70$.
If consider the numerator $P(U1,B)$ instead, I seem to come up with $2/5$ instead. What am I doing wrong?
The problem is that you have not calculated $P(B)$ correctly in the formula. $P(B)$ is not $5/17$, which you arrived at by considering that the total number of blue balls is $5$ and the total number of balls is $17$.
Instead, $P(B)$ should be calculated as follows: $P(B) = P(U_1 \cap B) + P(U_2 \cap B)$. That is, we need to find the probability of [choosing the first urn and choosing a blue ball], and add that to the probability of [choosing the second urn and choosing a blue ball]. So, $$P(B) = \frac{1}{2} \cdot \frac{2}{7} + \frac{1}{2} \cdot \frac{3}{10} = \frac{41}{140}.$$
Then, $$P(U_1 \mid B) = \frac{\frac{2}{7}\cdot\frac{1}{2}}{\frac{41}{140}} = \frac{20}{41}.$$
At the same time, one should not calculate the numerator of the RHS as $\frac{2}{5}$, which you arrived at by considering that if the blue ball is picked from urn $1$, then the total number of blue balls in urn $1$ is $2$, and the total number of balls is $17$, and so $\frac{2/17}{5/17} = 2/5$. This is an incorrect method of applying the rules/theory of conditional probability.