I have a question about part of a proof of a Lemma in a book (Casella's Statistical Inference) I'm reading. This it how it goes.
Let $X_1, \cdots ,X_n$ are a random sample from a population and let $g(x)$ be a function such that $\mathbb{E}g(X_1)$ and $\text{Var}\,g(X_1)$ exist. Then $$ \text{Var}\,\left(\sum_{i=1}^{n}g(X_i)\right)=n\left(\text{Var}\,g(X_1)\right).$$
So this is how I proceeded to to prove it.
Since the $X_i's$ are independent, we have that
$$
\begin {align*}
\text{Var}\,\left(\sum_{i=1}^{n}g(X_i)\right)&= \text{Var}\,g(X_1)+\cdots +\text{Var}\,g(X_n)\\
&= n\text{Var}\, g(X_1). \end {align*}$$
where the last equality holds because the $X_i's$ are identically distributed.
Can I do this? I'm asking this because the proof in the book started by using the definition of the variance and somewhere along the lines involved the covariance matrix.
Thanks.