Let $X \in \{1,2,3\}$ be random variable such that $\mathbb{P}\left(X=1\right)=\frac{1}{4}$ and $X_1, \ldots X_n$ $n \ge 3,$ independent random variables distributed like $X$. We define $$Y_i = \left|\{k:X_k=i\} \right|, \ i=1,2,3 \\ k=1, \ldots n$$.
We know that $$\operatorname{Cov}\left(Y_1+Y_2,Y_2+Y_3\right)=\frac{-n}{16}$$.
Calculate $\mathbb{E}X$.
I have problem with solving this task, so I really ask for the help. The answer is $\mathbb{E}X=2$, but I got $\mathbb{E}X=\frac{9-\sqrt5}{4}$ Here is my method:
Lets determine distribution of $X$, for some $p \in\left(0,1\right)$ we have $$\mathbb{P}\left(X=1\right)=\frac{1}{4} \\ \mathbb{P}\left(X=2\right)=p \\ \mathbb{P}\left(X=3\right)=\frac{3}{4}-p $$ I know that: $$\operatorname{Cov}\left(Y_1+Y_2,Y_2+Y_3\right)= \operatorname{Cov}\left(Y_1,Y_2\right) +\operatorname{Cov}\left(Y_1,Y_3\right)+\operatorname{Var}\left(Y_2\right)+\operatorname{Cov}\left(Y_2,Y_3\right)$$ and $$\operatorname{Cov}\left(Y_i,Y_j\right)=\frac{\operatorname{Var}\left(Y_i+Y_j\right)-\operatorname{Var}\left(Y_i\right)-\operatorname{Var}\left(Y_j\right)}{2}$$.
Then it seems to me (it may be wrong, because I can't prove it) that we have a lot of the binomial distributions with the following parameters:
$$Y_1 \sim B\left(n,\frac{1}{4}\right)\\ Y_2 \sim B\left(n,p\right)\\ Y_1 \sim B\left(n,\frac{3}{4}-p\right)\\ Y_1 + Y_2 \sim B\left(n,1-\left(\frac{3}{4}-p\right)\right)\\ Y_1 + Y_3 \sim B\left(n,1-p\right)\\ Y_2 + Y_3 \sim B\left(n,1-\frac{1}{4}\right)$$.
Using common knowledge that for $Y \sim B\left(n,p\right)$, $\operatorname{Var}\left(X\right)=npq$ and taking into consideration, everything what I wrote above, I got that $p=\frac{1+\sqrt5}{4}$ and the result: $$\mathbb{E}X=\frac{9-\sqrt5}{4}$$
Please let me know what I'm doing wrong.
All of what you’ve written here is correct. Interestingly, I apparently made the same mistake as you in the rest of the calcultaion at first and got $p=\frac{1+\sqrt5}4$. This was because I didn’t take into account that the $\operatorname{Var}(Y_2)$ term isn’t multiplied by $\frac12$ like all the other terms.
To avoid the complicated calculation, you can use the fact that $Y_1+Y_2+Y_3=n$ is a constant, so
$$ \operatorname{Cov}(Y_1+Y_2,Y_2+Y_3)=\operatorname{Cov}(Y_1+Y_2-n,Y_2+Y_3-n)=\operatorname{Cov}(Y_3,Y_1)\;. $$
In any case, the result $p=\frac12$ comes out right if you do the calculation correctly.