Computing expected value of dependent random variables

combinatoricsgraph theoryprobability

A graph $G=(V, E)$ has $2n$ vertices of which $n$ are coloured in blue and $n$ are coloured in red. The probability that there is an edge between any two vertices is $1/2$. Let $X$ denote the expected number of edges whose endpoints have the same colour. Compute the expected value of $X$.

Let $Y$ denote the number of edges whose endpoints have the colour blue.
We define
\begin{align*}
Y_{\{u, v\} }:=\begin{cases}
1,\ \text{there exists an edge and }u, v\text{ are blue}\\[5pt]
0, \ \text{else}
\end{cases}
.\end{align*}

We then have
\begin{align*}
\mathbb{E}[Y]=\sum_{\{u, v\} \subseteq V}^{} \mathbb{E}\left[ Y_{\{u, v\} } \right]
= \binom{|V|}{2}\cdot \frac{1}{8}
.\end{align*}

We get the same result for the expected number of edges whose endpoints are
red, let $Z$ be the respective random variable.
Because $X=Y+Z$ we finally obtain
\begin{align*}
\mathbb{E}[X]=\mathbb{E}[Y+Z]= \mathbb{E}[Y]+\mathbb{E}[Z]=
\frac{1}{4}\cdot \binom{|V|}{2}
.\end{align*}

Is my solution correct?

Best Answer

Your answer is not correct.

I will not immediately point out the flaw in your reasoning, in case you prefer to find the flaw by yourself. One way to see that your answer is wrong is by doing the following sanity check: is this the right answer for small values of $n$?

For $n = 1$, there are two vertices with different colours, with an edge between them with probability $\frac{1}{2}$. However, there are no edges between vertices of the same colour, so the answer should be $0$. But your formula gives $\frac{1}{4} \cdot \binom{2}{2} = \frac{1}{4}$.

Maybe it helps if you work out the answer for $n = 2$, and then see how you can generalize this solution. If you figure it out, feel free to answer the question yourself. Otherwise, let us know if you need more help!


Added later (as requested). The flaw in your reasoning is this. In your solution, the equality $\mathbb{E}[Y]=\sum_{\{u, v\} \subseteq V}^{} \mathbb{E}\left[ Y_{\{u, v\} } \right]$ is valid. However, we don't have $\mathbb{E}\left[ Y_{\{u,v\}} \right] = \frac{1}{8}$, but rather $$ \mathbb{E}\left[ Y_{\{u,v\}} \right] = \begin{cases} \frac{1}{2},&\text{if $u$ and $v$ are blue};\\[1ex] 0,&\text{otherwise}. \end{cases} $$ After all, the expected value ranges over all edge realizations, but the colours are fixed. So if either $u$ or $v$ is not blue, then we have $Y_{\{u,v\}} = 0$ for all possible edge realizations.

Related Question