Further explanation regarding calculation of E[X^2]

47 Views Asked by At

I was reading over the following evaluation of $ E[X^2] $ on the following pdf: http://crab.rutgers.edu/~guyk/dmlec/lectures/lec15/l15.pdf.

This part was especially confusing for me: $$\begin{align} \mathsf E[X^2] & = \sum_{i=1}^n \mathsf E[X_i^2] + 2\sum_{i<j}\mathsf E[X_i\cdot X_j] \\[1ex] & = \sum_{i=1}^n \mathsf E[X_i^2] + 2\sum_{i<j}1\cdot \Pr[X_i=1\cap X_j=1] \\[1ex] & = \sum_{i=1}^n \frac 1 n + 2\left(\frac{n(n+1)}{2}\right)\left(\frac {1}{n(n-1)}\right) \\[1ex] & = n\cdot\frac 1 n + 1 \\[1ex] & = 2 \end{align}$$ This is present on page 3 of the pdf document.

I need help understanding what is going on in lines 1 to 3.

Thanks so much for your help!

1

There are 1 best solutions below

3
On BEST ANSWER

$$X = X_1 + X_2 + \cdots + X_n.$$ Then $$\begin{align*} X^2 &= (X_1 + X_2 + \cdots + X_n)^2 \\ &= X_1^2 + X_2^2 + \cdots + X_n^2 + 2(X_1 X_2 + X_1 X_3 + \cdots + X_1 X_n) \\ &\quad + 2(X_2 X_3 + X_2 X_4 + \cdots + X_2 X_n) \\ &\quad + \cdots + 2X_{n-1} X_n \\ &= \sum_{i=1}^n X_i^2 + 2 \sum_{i < j} X_i X_j. \end{align*}$$ Then since expectation is a linear operator, the expectation of the sum is equal to the sum of the expectations. As for how $\operatorname{E}[X_i X_j] = 1 \cdot \Pr[(X_i = 1) \cap (X_j = 1)]$, that depends on the distribution that the $X_i$s jointly follow.