Solution

ID: past-exam-of-the-year-1-of-the-computer-science-course-of-the-university-of-oxford/2015/discrete-mathematics-continuous-mathematics-and-probability/9/a/ii/solution

Assume a finite second moment, so the following expectations are finite. Expand the square and use linearity of expectation:
Thus
The same equality holds in the extended sense when the mean is finite and the second moment is infinite.

New to topics? Read the docs here!