Expected number of correct guess in a game Question is as follow.
There is a bag. In the bag, there are $a$ red cubes and $b$ blue cubes. Assume that she knows exactly how many cubes for each of the colors before the draw.  Mary is going to draw all the cubes one by one out of the bag randomly. For every turn, she will make a guess on the color before drawing the cube. Find the expected number of correct guess in the game.
Trial:
I can solve for a simpler case, that is when she doesn't know the number of cubes of each color. But if she does, then I can figure out her strategy, that is she is going to guess the color which is greater in number in the bag. Also, I tried the find the probability of getting one correct only but cant gets a success because it seems to depend on the previous results. 
 A: We find the following recurrence:
$$E(a,b) = \begin{cases}
\frac{bE(a,b-1) + a(E(a-1,b)+1)}{a+b}&\text{if } a\ge b,\\
E(b,a)&\text{if }b>a,\\
0&\text{if }a=b=0.
\end{cases}$$
These cases are pretty obvious: the first says "we gain one point if we guess right", the second says "we can pick the cube that is more common and it doesn't matter which that is", and the third says "you can't score any points on an empty bag"
From here we can begin to find easy ones: It's clear that $E(a,0) = a$, for instance.  But it gets harder from there - each entry depends on the ones before it in ugly ways.  I present here the values for $a,b \le 5$.
$$\begin{array}{c|cccccc}
\ &0&1&2&3&4&5\\
\hline
0 & 0 & 1 & 2&3&4&5\\
1&1&1\frac{1}{2}&2\frac{1}{3}&3\frac{1}{4}&4\frac{1}{5}&5\frac{1}{6}\\
2&2&2\frac{1}{3}&2\frac{5}{6}&3\frac{3}{5}&4\frac{7}{15}&5\frac{8}{21}\\
3&3&3\frac{1}{4}&3\frac{3}{5}&4\frac{1}{10}&4\frac{29}{35}&5\frac{37}{56}\\
4&4&4\frac{1}{5}&4\frac{7}{15}&4\frac{29}{35}&5\frac{23}{70}&6\frac{2}{63}\\
5&5&5\frac{1}{6}&5\frac{8}{21}&5\frac{37}{56}&6\frac{2}{63}&6\frac{67}{126}
\end{array}$$
From this a few other closed forms for special cases are apparent:


*

*for $(1,n)$, it's $n+\frac{1}{n+1}$

*for $(2,n)$ with $n>0$, it's $n+\frac{2(n+3)}{(n+1)(n+2)}$


There are sure to be others but I don't know them.
A: Let $m_{a,b} = \mathbb{E}[\text{number of correct guesses when there are }a, b \text { (red, blues)}]$.
We know $m_{0,k} = m_{k,0} = k$, for all $k\geq0$, since Mary will always guess correct when just one color.
Then for positive $a$ and $b$ we have the recursion
$$m_{a,b} = \begin{cases}
\frac{a}{a+b}(m_{a-1,b}+1) + \frac{b}{a+b}m_{a,b-1} \space \space \text{  if } a\geq b \\ 
\frac{b}{a+b}(m_{a,b-1}+1) + \frac{a}{a+b}m_{a-1,b} \space \space \text{  if } a < b 
\end{cases}$$
which comes from the fact that Mary will guess the next cube correctly with probability $\frac{\max(a,b)}{a+b}$ (and get $1$ cube) in addition to the rest cubes, whose expectation is $m_{*,*}$ where the subscripts depend on which color cube the drawn was.
A: Non-recursive formula: the correct number of guesses $C(a, b) = C_1 + \cdots + C_{a+b}$, where $C_k = 1$ iff the $k$th guess was correct, and $C_k = 0$ otherwise. Hence
$$\mathbb{E}(C(a,b)) = \mathbb{E}(C_1 + \cdots + C_{a + b}) = \mathbb{E}(C_1) + \cdots + \mathbb{E}(C_{a + b}) = \mathbb{P}(C_1 = 1) + \cdots + \mathbb{P}(C_{a + b} = 1).$$
We have, for example,
$$\mathbb{P}(C_1 = 1) = \frac{\max(a, b)}{a + b},$$
and in general
$$\mathbb{P}(C_{k + 1} = 1) = \sum_{r = \max(0, k - b)}^{\min(a, k)} \mathbb{P}(C_{k + 1} = 1 \mid r \text{ reds in draws } 1, \dots, k) \mathbb{P}(r \text{ reds in draws } 1, \dots, k).$$
We can calculate the first, conditional, probability assuming the strategy that Mary always guesses whichever colour is most common in the bag:
$$\mathbb{P}(C_{k + 1} = 1 \mid r \text{ reds drawn in draws } 1, \dots, k) = \frac{\max(a - r, b - (k - r))}{a + b-k}.$$
We can also calculate the second, unconditional, probability using the fact that this is a draw from the hypergeometric distribution:
$$\mathbb{P}(r \text{ reds drawn in draws } 1, \dots, k) = \frac{\binom{a}{r}\binom{b}{k - r}}{\binom{a + b}{k}}.$$
So we have
$$\mathbb{P}(C_{k + 1} = 1) = \sum_{r = \max(0, k - b)}^{\min(a, k)}\frac{\max(a - r, b - (k - r))}{a + b-k}\frac{\binom{a}{r}\binom{b}{k - r}}{\binom{a + b}{k}}.$$
Hence
$$\mathbb{E}(C(a, b)) = \sum_{k = 0}^{a + b - 1} \sum_{r = \max(0, k - b)}^{\min(a, k)}\frac{\max(a - r, b - (k - r))}{a + b-k}\frac{\binom{a}{r}\binom{b}{k - r}}{\binom{a + b}{k}}.$$
