We put $n$ red tomatoes and $n$ green tomatoes into $n$ baskets at random, so that each basket contains two tomatoes. Let $X$ be the number of baskets containing one red and one green tomato. Find $\text{var}(X)$. Assume that $n \geq 10.$
For $k=1,2...,n$, we introduce random variables
$$X_k= \begin{cases} 1 \quad \text{ if the $k^{th}$ basket contains one red and one green tomato}\\ 0 \quad \text{otherwise} \end{cases} $$ Since each tomato is equally likely to end up in any of the $n$ baskets there are $2n \choose 2 $ ways to select a pair of tomatoes for the $k^{th}$ basket. Of which there are $ n \choose 1 $$n \choose 1$ ways to choose a red and green tomato ($n^2$ ways.) Consequently
$$ P(X_k=1)=\frac{n^2}{2n \choose 2}=\frac{n}{2n-1} $$ $$E[X]=\frac{n^2}{2n-1} $$
But how to find $E[X^2]$?
Thank you
We are using indicator random variables.
Let $X_i$ be the indicator that box $i$ contains differently coloured tomatoes. Then $X=\sum_{i=1}^n X_i$ .
For any box $i$ the probability that $X_i=1$ is $\binom n1^2/\binom{2n}2$ or $n/(2n-1)$. This is $\mathsf E(X_i)$.
Now as you had :$$\begin{align}\mathsf E(X)&=\mathsf E(\sum_i X_i) \\ &= n~\mathsf E(X_1)\\ &= n^2/(2n-1)\end{align}$$
Similarly for any box $i$ the probability that $X_i=1$ is also $\mathsf E(X_i^2)$ since the indicator variable is either $0$ or $1$. $\mathsf E(X_i^2)=1^2\mathsf P(X_i=1)+0^2\mathsf P(X_i=0)$
Next, for any two distinct boxes $i,j$, the probability that $X_i=1$ and $X_j=1$ is something. This is $\mathsf E(X_iX_j)$ .
So we find
$$\begin{align}\mathsf E(X^2)&=\mathsf E((\sum_{i=1}^n X_i)(\sum_{j=1}^n X_j)) \\ &= \sum_{i=1}^n \mathsf E(X_i^2)+2\sum_{i=2}^{n}\sum_{j=1}^{i-1}\mathsf E(X_iX_j) \\ &= n^2/(2n-1) + n(n-1)\mathsf E(X_1X_2) \end{align}$$
Now what is the probability that two particular boxes each contain differently coloured tomatoes? Back to you.