I have a random graph/network described by the adjacency matrix $(a\_{ij})\_{N\times N}$ where $a\_{ij}=1$ with probability $p$. Each node in the graph is associated with a continuous quantity $\eta\_i=\sum\_j a\_{ij}\eta\_j$ in $\mathbb{R}$. In this framework the *ensemble average* of $\eta\_i$, denoted by $\bar{\eta}$ is just $\mathrm{E}[\eta\_i]$. Similarly, $\overline{\eta^2} = \mathrm{E}[\eta\_i^2]$. I want to understand the derivation for 


$\overline{\sum\_j a\_{ij}\eta\_j} = Np\bar{\eta}$


and


$\overline{\sum\_j a\_{ij}\eta\_j-Np\bar{\eta})^2} = Np(\overline{\eta^2} - p\bar{\eta})\quad\quad\quad\quad\quad$ (\*)


The first formula (correct me if I am wrong, please) should come from the reasoning that


$\mathrm{E[\sum\_j a\_{ij}\eta\_j]} = \sum\_j \mathrm{E[a\_{ij}]}\mathrm{E}[\eta\_j] = \bar{\eta}\sum\_jp = Np\bar{\eta}$


But for the second formula I cannot find a correct derivation. I actually obtain $\overline{\sum\_j a\_{ij}\eta\_j-Np\bar{\eta})^2} = Np(\overline{\eta^2} - \bar{\eta})$, and I cannot figure out where the $p$ factor inside the parenthesis in (\*) comes from. Should I opt for a typo (\*). Or is anyone that can provide a correct derivation?



Ensemble averaging in a random graph (or network) in the large $N$ limit
Ok, it seems that this section of StackExchange is really made for you to figure out your own answer... After some lengthy frustrating trial and error, there is no typo in the given solution. The mistake I was doing was in the calculation of $\mathrm{E}[(\sum\_ja\_{ij}\eta\_j)^2]$. In the development of this multinomial square, you need to be careful when you compute the expectation of the mixed terms. In fact:


$\mathrm{Var}[\sum\_ja\_{ij}\eta\_j] = \mathrm{E}[(\sum\_ja\_{ij}\eta\_j - Np\bar{\eta})^2] = \mathrm{E}[(\sum\_ja\_{ij}\eta\_j)^2] - N^2p^2\bar{\eta}^2$


$=\mathrm{E}[\sum\_ja\_{ij}^2\eta\_j^2] + \mathrm{E}[\sum\_ja\_{ij}\eta\_j\sum\_{k,k\ne i}a\_{ik}\eta\_k] - N^2p^2\bar{\eta}^2 = Np\cdot \overline{\eta^2} + Np\cdot(N-1)p\cdot \bar{\eta}^2 - N^2p^2\bar{\eta}^2$


$=pN(\overline{\eta^2}-p\bar{\eta}^2)$


I hope that it can help others. FYI this type of calculation occurs very often in the study of neural networks.


