# Are expectation of with replacement and without replacement same? When?

I have $k_1$ red balls and $k_2$ green balls in a box. These balls are select by a uniform distribution. Randomly select $n$ balls from the box. Let $X$ be random variable that counts number of red ball after $n$ trails. What is expected number of red ball after $n$ trails if

1. These balls are uniform randomly select with replacement
2. These balls are uniform randomly select without replacement

Are these expectation similar? When?

This is what I did:

For with replacement case, I followed the answer at What is the probability that selects $i$ red ball and $n-i$ green ball, with replacement? and got the result as

$$E_1(X)=n \frac{k_1}{k_1+k_2}$$

In case of without replacement, I follow the Hypergeometric distribution

$$E_2(X)=\sum_i^{k_1} \frac{\binom{k_1}{i}\binom{k_2}{n-i}}{\binom{k_1+k_2}{n}} i$$

Thanks all

This is MATLAB simulation for two cases. I saw that these expectation are same. Why?.

k1=8;k2=8;n=13;
%% With replacement
sum_E1=n*k1/(k1+k2);
%% Without replacement
sum_E2=0;
for i=0:k1
if ((n-i>k2)|(n-i<0))
continue;
else
sum_E2=sum_E2+i*nchoosek(k1,i)*nchoosek(k2,n-i)./nchoosek(k1+k2,n);
end
end
sum_E1
sum_E2


Actually, no, it is not a uniform distribution. I hope you found out that in case 1, $X$ follows a binomial distribution with $n$ trials, and $p = k_1/(k_1+k_2)$. You should be familiar with the fact that $$E[X] = np.$$
Further, you seem to be familiar with the fact that in case 2, $X$ follows a hypergeometric distribution with $n$ trials, $N = k_1+k_2$ total balls, and $G = k_1$ red balls. You should be familiar with the fact that $$E[X] = n\cdot \frac{G}{N}.$$ Notice that $n\cdot G/N = n\cdot k_1/(k_1+k_2) = np$. The most you can draw in case 2 are $k_1+k_2$ balls, so the two will be the same when $0\leq n\leq k_1+k_2$. Also, I assume that "These balls are select by a uniform distribution." means that you draw the balls fairly/impartially from the box, not that there is some underlying uniform distribution that is not revealed.