# understanding the solution for “Expectation of the difference of sums”

I found the question Expectation of the difference of sums on this site, and I am trying to understand the solution, which uses the variance of the vector $a$.

First, on the 4-th row of the solution, $$\begin{eqnarray} \def\Var{\operatorname{Var}}\Var a &=& \frac{2m-1}{(2m)^2}\lVert a\rVert^2-\frac1{(2m)^2}2m(2m-1)A\;, \end{eqnarray}$$ how did we get $2m(2m-1)$? (As I understand, we have $2m(m-1)$positive terms of different entries.)

My second question is how to find $A$, the average over all permutations?

-

On your first question: It seems your $2m(m-1)$ is the count of positive terms with pairs of different entries in the desired expectation value that I mention in the second line of the solution. This is a different count. The factor $2m(2m-1)$ counts the number of pairs of different entries in the sum $\sum_{i\ne j}a_ia_k$. There's no division of the vector into two halves with different signs here; we're merely counting pairs of entries of the entire vector to calculate the variance of the entire vector, so all $2m$ entries are treated the same, and there are $2m(2m-1)$ ordered pairs of different entries. This is just $n(n-1)$ with $n=2m$.
On your second question, $A$ is indeed the average over all permutations, but the point is that to average the product of a pair of different entries over all permutations, you don't have to actually go through all permutations, because you get the same result by just averaging over all pairs of different entries. So for $m=2$, A would be $(a_1a_2+a_1a_3+a_1a_4+a_2a_3+a_2a_4+a_3a_4)/6$.
Sorry, for rxample, $Ea^2_{\pi(i)}=\frac{\|a\|^2}{2m}$-tgere is no permutation in the RHS. I am anderstand logically why, but I would like to find explonation. Thank you – Nick G.H. Apr 3 '12 at 15:32
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9272951483726501, "perplexity": 186.32574742391202}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2016-22/segments/1464049276537.37/warc/CC-MAIN-20160524002116-00091-ip-10-185-217-139.ec2.internal.warc.gz"}