Expected value and covariance of vector of Bernoullis I have seen this in Bishop's book (page 445) but I can't understand why.
If I have a vector of $D$ binary variables  (the components of the product are independent random variables):
$$ \prod_{j=1}^{D}  \mu_{j}^{x_{j}} (1 - \mu_{j})^{1-x_{j}} 
$$
How do I calculate the mean and covariance?
$$
\mathbb{E}[\pmb{x}] = \pmb{\mu}
$$
$$
 cov[\pmb{x}] = diag(\mu_{j}(1-\mu_{j})) 
$$
 A: There is no product of $D$ random variables; what you have is a vector $\mathbf X = (X_1, X_2, \ldots, X_D)$ of $D$ Bernoulli random variables $X_1, X_2, \ldots, X_D$ with parameters $\mu_1, \mu_2, \ldots, \mu_D$ respectively (and hence means $\mu_1, \mu_2, \ldots, \mu_D$ respectively). Thus, we have 
$$E[\mathbf X] \stackrel{\small{\text{def}}}{=} \big(E[X_1], E[X_2], \ldots, E[X_D]\big) = (\mu_1, \mu_2, \ldots, \mu_D) \stackrel{\small{\text{def}}}{=} {\pmb{\mu}}.\tag{1}$$ 
We are also told that the probability mass function of $\mathbf X$ (equivalently, the joint probability mass function of the $D$ random variables) is
\begin{align}p_{\mathbf X}(\mathbf x) \stackrel{\small{\text{def}}}{=} 
p_{X_1, X_2, \ldots, X_D}(x_1,x_2, \ldots, x_D)
= \prod_{j=1}^{D}  \mu_{j}^{x_{j}} (1 - \mu_{j})^{1-x_{j}}.
\tag{2}\end{align}
But the right side of $(2)$ is readily recognized as being equal to
$\displaystyle \prod_{j=1}^{D} p_{X_j}(x_j)$ which tells us that
$X_1, X_2, \ldots, X_D$ are independent random variables, and so
$$\mathrm{cov}(X_i,X_j) = \begin{cases}\mu_i(1-\mu_i), &j=i,\\
0, &j\neq i,\end{cases}\tag{3}$$
leading to
$$\mathrm{cov}(\mathbf X) \stackrel{\small{\text{def}}}{=} \big[\mathrm{cov}(X_i,X_j)\big]_{i,j} = \mathrm{diag}\big(\mu_1(1-\mu_1),\mu_2(1-\mu_2),\ldots, \mu_D(1-\mu_D)\big).\tag{4}$$
