Probability: Find a value to make this equation hold true Question:
Let X1,...,Xn be independent, identically distributed random variables with common mean and variance. Find the values of c and d that will make the following formula true:
$$E[(X_1 + . . . + X_n)^2] = cE[X_1^2] + d(E[X_1])^2$$
Solution:
$$E[(X_1 +...+X_n)^2] = var(X_1 +...+X_n)+(E[X_1 +...+X_n])^2\\ = nvar(X_1)+(nE[X_1])^2
\\= nE[X_1^2] − n(E[X_1])^2 + n^2E[X_1])^2
\\= nE[X_1^2] + n(n − 1)(E[X_1])^2$$
Thus, c = n and d = n(n − 1).

I don't understand the very first line of the solution, but I understand the algebra that follows it. Can someone please explain how they get the first line?
Thank you

Well, there is this equality
$$ var(X) = E[X^2] - (E[X])^2 $$
which you can find in this wiki article. So, $E[X^2] = var(X) + (E[X])^2 $.
