We introduce a uniformly distributed random variable $Z : \Omega \rightarrow \{-1,1\}^{n}$. For $\omega \in \Omega$, we denote by $Z_{i}(\omega)$ the coordinates of $Z(\omega)$. Show that for all $A = (a_{i,j})_{1 \leqslant i,j \leqslant n} \in \mathcal{M}_{n}(\{-1,1\})$, we have $$\forall i \in \{1, \ldots, n\}, \quad \mathbb{E}\left[\left|\sum_{j=1}^{n} a_{i,j} Z_{j}\right|\right] = \frac{1}{2^{n}} \sum_{k=0}^{n} \binom{n}{k} |n - 2k|,$$ where $\binom{n}{k}$ denotes the binomial coefficient. Deduce $$\mathbb{E}\left[g_{A}(Z)\right] = \frac{n}{2^{n}} \sum_{k=0}^{n} \binom{n}{k} |n - 2k|.$$
We introduce a uniformly distributed random variable $Z : \Omega \rightarrow \{-1,1\}^{n}$. For $\omega \in \Omega$, we denote by $Z_{i}(\omega)$ the coordinates of $Z(\omega)$. Show that for all $A = (a_{i,j})_{1 \leqslant i,j \leqslant n} \in \mathcal{M}_{n}(\{-1,1\})$, we have
$$\forall i \in \{1, \ldots, n\}, \quad \mathbb{E}\left[\left|\sum_{j=1}^{n} a_{i,j} Z_{j}\right|\right] = \frac{1}{2^{n}} \sum_{k=0}^{n} \binom{n}{k} |n - 2k|,$$
where $\binom{n}{k}$ denotes the binomial coefficient. Deduce
$$\mathbb{E}\left[g_{A}(Z)\right] = \frac{n}{2^{n}} \sum_{k=0}^{n} \binom{n}{k} |n - 2k|.$$