Picking Same Color Probability So i recently came across this question,
Marla has m bottles of marbles. Each bottle has n marbles of n different colours. Marla mixes all the marbles from all the bottles together. Now, she picks up n random marbles and puts them into another empty bottle. 
Remember that now there can be more than one marble of a same colour in this bottle.
Marla picks up one marble from this bottle, notes down the colour and puts the marble back into the same bottle. The second time she picks up a marble from the same bottle, if it is of the same colour, then she succeeds.
What is the probability that she succeeds?
This is a sample test case that was provided.
Eg. Sample Input
2 2
Sample Output
0.666666666666
Explanation
The probability of getting both the marbles in the bottle of the same colour is 0.33333333333333.
The probability of then succeeding is 1.
The probability of getting both the marbles in the bottle of different colours is 0.666666666666.
The probability of then succeeding is 0.5.
The total probabilty of succeeding is ( 0.333333333333 x 1 ) + (0.666666666666 x 0.5)= 0.666666666666
How do i go about this?
Probability is not my forte, so i am not really sure how to go about this.
I have made 3 cases (n=m),(n>m) and (n
 A: Let's just consider the probability of getting a specific color of marble twice, and then, due to the symmetry of the problem, we may multiply by $n$ to get the total probability of success for Martha.
First, the probabilities of getting $k$ marbles of that color in your bottle: there are $nm$ marbles, and so there are $nm\choose n$ ways to pick $n$ marbles to put into a bottle.  Of those ways, there are $m\choose k$ ways to pick $k$ marbles from the $m$ marbles of the desired color, leaving ${nm-m}\choose {n-k}$ choices of other-colored marbles to fill up your bottle. So the probability of getting $k$ marbles of this color is:
$$\frac{{m\choose k}\cdot{nm-m\choose n-k}}{nm\choose n} $$
Now, given that you have $k$ marbles in your bottle, then the probability of picking one of those marbles is simply $k/n$. So your probability of getting $k$ marbles of one color and then picking that color of marble twice will be 
$$\frac{{m\choose k}\cdot{nm-m\choose n-k}}{nm\choose n}\cdot\frac{k^2}{n^2} $$
So your probability of success, multiplying by $n$ to account for all colors, is the sum of these probabilities for all possibilities of $k$, from 1 to $m$ or $n$, whichever comes first:
$$\Pr(Success)=\sum\limits_{k=1}^{\min(m,n)}\frac{{m\choose k}\cdot{nm-m\choose n-k}}{nm\choose n}\cdot\frac{k^2}{n} $$
...so yeah, as to a nice, closed form solution, I'm not too sure, but just going from counting equally likely events, I believe this would be your answer
A: Total number of marbles are mn
Out of these mn marbles, m are of same colour. For our event to a success we need atleast 2 marbles of same colour. 
We know $$\binom{n}{k} = \frac{n!}{k!(n - k)!}$$
Hence the number of ways for selecting 2 marbles to be of same colour will be -
$$\binom{m}{2} *\binom{mn-m}{n-2} $$
So the probability of getting 2 marbles of the same color is
$$\frac{{m\choose 2}\cdot{mn-m\choose n-2}}{mn\choose n}$$
As we have 2 marbles in our bottle, the probability of picking one of those marbles is simply 2/n. So oour probability of getting 2 marbles of one color and then picking that color of marble twice will be
$$\frac{{m\choose 2}\cdot{mn-m\choose n-2}}{mn\choose n}\cdot\frac{2^2}{n^2}$$
To take into account all colours, we must multiply the result by n.
Hence, the probability for the event to be successfull is --
$$\frac{{m\choose 2}\cdot{mn-m\choose n-2}}{mn\choose n}\cdot\frac{2^2}{n}$$
Please correct me, if i am wrong. Its been a long time i came across probability questions. 
