# Mean and Variance of Linear Combinations

Printer-friendly version

#### $\bar{X}=\dfrac{X_1+X_2+\cdots+X_n}{n}$

If we re-write the formula for the sample mean just a bit:

$\bar{X}=\dfrac{1}{n} X_1+\dfrac{1}{n} X_2+\cdots+\dfrac{1}{n} X_n$

we can see more clearly that the sample mean is a linear combination of the random variables X1, X2, ..., Xn. That's why the title and subject of this page! That is, here on this page, we'll add a few a more tools to our toolbox, namely determining the mean and variance of a linear combination of random variables X1X2, ..., Xn. Before presenting and proving the major theorem on this page, let's revisit again, by way of example, why we would expect the sample mean and sample variance to have a theoretical mean and variance.

### Example

A statistics instructor conducted a survey in her class. The instructor was interested in learning how many siblings, on average, the students at Penn State University have? She took a random sample of n = 4 students, and asked each student how many siblings he/she has. The resulting data were: 0, 2, 1, 1. In an attempt to summarize the data she collected, the instructor calculated the sample mean and sample variance, getting:

$\bar{X}=\dfrac{4}{4}=1$ and $S^2=\dfrac{(0-1)^2+(2-1)^2+(1-1)^2+(1-1)^2}{3}=\dfrac{2}{3}$

The instructor realized though, that if she had asked a different sample of n = 4 students how many siblings they have, she'd probably get different results. So, she took a different random sample of n = 4 students. The resulting data were: 4, 1, 2, 1. Calculating the sample mean and variance once again, she determined:

$\bar{X}=\dfrac{8}{4}=2$  and   $S^2=\dfrac{(4-2)^2+(1-2)^2+(2-2)^2+(1-2)^2}{3}=\dfrac{6}{3}=2$

Hmmm, the instructor thought that was quite a different result from the first sample, so she decided to take yet another sample of n = 4 students. Doing so, the resulting data were: 5, 3, 2, 2. Calculating the sample mean and variance yet again, she determined:

$\bar{X}=\dfrac{12}{4}=3$  and   $S^2=\dfrac{(5-3)^2+(3-3)^2+(2-3)^2+(2-3)^2}{3}=\dfrac{6}{3}=2$

That's enough of this! I think you can probably see where we are going with this example. It is very clear that the values of the sample mean $\bar{X}$and the sample variance Sdepend on the selected random sample.  That is, $\bar{X}$ and S2 are continuous random variables in their own right.  Therefore, they themselves should each have a particular:

1. probability distribution (called a "sampling distribution"),
2. mean, and
3. variance.

We are still in the hunt for all three of these items. The next theorem will help move us closer towards finding the mean and variance of the sample mean $\bar{X}$.

 Theorem. Suppose X1, X2, ... , Xn are n independent random variables with means $\mu_1,\mu_2,\cdots,\mu_n$ and variances $\sigma^2_1,\sigma^2_2,\cdots,\sigma^2_n$.  Then, the mean and variance of the linear combination $Y=\sum\limits_{i=1}^n a_i X_i$, where a1, a2, ... , an are real constants are: $\mu_Y=\sum\limits_{i=1}^n a_i \mu_i$ and: $\sigma^2_Y=\sum\limits_{i=1}^n a_i^2 \sigma^2_i$ respectively.

Proof. Let's start with the proof for the mean first:

Now for the proof for the variance. Starting with the definition of the variance of Y, we have:

$\sigma^2_Y=Var(Y)=E[(Y-\mu_Y)^2]$

Now, substituting what we know about Y and the mean of Y, we have:

$\sigma^2_Y=E\left[\left(\sum\limits_{i=1}^n a_i X_i-\sum\limits_{i=1}^n a_i \mu_i\right)^2\right]$

Because the summation signs have the same index (i = 1 to n), we can replace the two summation signs with one summation sign:

$\sigma^2_Y=E\left[\left(\sum\limits_{i=1}^n( a_i X_i-a_i \mu_i)\right)^2\right]$

And, we can factor out the constants ai:

$\sigma^2_Y=E\left[\left(\sum\limits_{i=1}^n a_i (X_i-\mu_i)\right)^2\right]$

Now, let's rewrite the squared term as the product of two terms. In doing so, use an index of i on the first summation sign, and an index of j on the second summation sign:

$\sigma^2_Y=E\left[\left(\sum\limits_{i=1}^n a_i (X_i-\mu_i)\right) \left(\sum\limits_{j=1}^n a_j (X_j-\mu_j)\right) \right]$

Now, let's pull the summation signs together:

$\sigma^2_Y=E\left[\sum\limits_{i=1}^n \sum\limits_{j=1}^n a_i a_j (X_i-\mu_i) (X_j-\mu_j) \right]$

Then, by the linear operator property of expectation, we can distribute the expectation:

$\sigma^2_Y=\sum\limits_{i=1}^n \sum\limits_{j=1}^n a_i a_j E\left[(X_i-\mu_i) (X_j-\mu_j) \right]$

Now, let's rewrite the variance of Y by evaluating each of the terms from i = 1 to n and j = 1 to n. In doing so, recognize that when i = j, the expectation term is the variance of Xi, and when ij, the expectation term is the covariance between Xi and Xj, which by the assumed independence, is 0:

Simplifying then, we get:

$\sigma^2_Y=a_1^2 E\left[(X_1-\mu_1)^2\right]+a_2^2 E\left[(X_2-\mu_2)^2\right]+\cdots+a_n^2 E\left[(X_n-\mu_n)^2\right]$

And, simplifying yet more using variance notation:

$\sigma^2_Y=a_1^2 \sigma^2_1+a_2^2 \sigma^2_2+\cdots+a_n^2 \sigma^2_n$

Finally, we have:

$\sigma^2_Y=\sum\limits_{i=1}^n a_i^2 \sigma^2_i$

as was to be proved.

### Example

Let X1 and X2 be independent random variables. Suppose the mean and variance of X1 are 2 and 4, respectively. Suppose, the mean and variance of X2 are 3 and 5 respectivelyWhat is the mean and variance of X1 + X2?

Solution. The mean of the sum is:

$E(X_1+X_2)=E(X_1)+E(X_2)=2+3=5$

and the variance of the sum is:

$Var(X_1+X_2)=(1)^2Var(X_1)+(1)^2Var(X_2)=4+5=9$

What is the mean and variance of X1 − X2?

Solution. The mean of the difference is:

$E(X_1-X_2)=E(X_1)-E(X_2)=2-3=-1$

and the variance of the difference is:

$Var(X_1-X_2)=Var(X_1+(-1)X_2)=(1)^2Var(X_1)+(-1)^2Var(X_2)=4+5=9$

That is, the variance of the difference in the two random variables is the same as the variance of the sum of the two random variables.

What is the mean and variance of 3X1 + 4X2?

Solution. The mean of the linear combination is:

$E(3X_1+4X_2)=3E(X_1)+4E(X_2)=3(2)+4(3)=18$

and the variance of the linear combination is:

$Var(3X_1+4X_2)=(3)^2Var(X_1)+(4)^2Var(X_2)=9(4)+16(5)=116$