$1.$ Prove: If $X_1,X_2,X_3,\ldots,X_n$ are independent random variables then: $$D\left(\sum_{i=1}^n X_i\right)=\sum_{i=1}^n D(X_i)$$
Proof: Because of independence we have:
$$D(\sum_{i=1}^n X_i)=E(\sum_{i=1}^n (X_i-EX_i))^2= \sum_{i=1}^n E(X_i-EX_i)^2+ \sum_{i \neq j} E((X_i-EX_i)(X_j-EX_j))= \sum_{i=1}^n DX_i +**\sum_{i\neq j}(EX_i-EX_i)(EX_j-EX_j)**=\sum_{i=1}^n DX_i$$
What I dont understand is how the expressions within the stars are derived as well as how this independence comes into play here.
$2.$ Find : $EX(X-1)$ if $X=G(p)$- geometric distribution of $p$.
Answer(which I completely don't understand): $$\sum_{k=2}^\infty k(k-1)q^{k-1}p$$
Background of my understanding: I know how to get EX , and I;m aware that the answer here is close to the second derivative of EX.. That is all..
$\newcommand{\E}{\operatorname{E}}$If $U$, $V$ are undependent and $\E U$ and $\E V$ both exist then $\E(UV)=(\E U)(\E V)$.
Therefore $$ \E\Big((X_i-\E X_i)(X_j-\E X_j\Big) = \E(X_i-\E X_i) \E(X_j-\E X_j) $$ and $$ \E(X_i-\E X_i) = \E X_i - \E(\E X_i)) = \E X_i - \E X_i=0 $$ and similarly for $j$.
\begin{align} & \sum_{k=2}^\infty k(k-1)q^{k-1}p = qp \sum_{k=2}^\infty k(k-1)q^{k-2} = qp \sum_{k=2}^\infty \frac{d^2}{dq^2} q^k \\[10pt] = {} & qp\frac{d^2}{dq^2}\sum_{k=2}^\infty q^k \qquad (\text{This step is problematic.}) \\[10pt] = {} & qp \frac{d^2}{dq^2} \frac{q^2}{1-q}. \end{align} Now do the differentiation.
The derivative of the sum is the sum of the derivatives when the number of terms is finite. When it is infinite, then that isn't always true. But it is true of power series in the interior of the intervals of convergence, and that is applied here.
There are also discrete ways of solving this problem.