On this page
8.4 Variance of Random Variables
Suppose that, for a random variable $ X $, we verify that $ \mathbb{E}(X) = 2 $. What does this mean? As we saw above, it means that if we consider a large number of observations of $ X $, let’s say $ x_1, x_2,\ldots,x_n $, when we calculate the average of these values, it will be close to 2, if $ n $ is big.
Suppose, for example, that $ X $ represents the life span of lamps being received from a manufacturer, and which $ \mathbb{E}(X) = 1000 $ hours. This could mean that most bulbs should last between 900 hours and 1100 hours. It could also mean that the bulbs are made up of two very different types: about half are of very good quality and will last approximately 1400 hours, while the other half are of very poor quality and will last approximately 600 hours.
Therefore, there is an obvious need to introduce a measure that can distinguish between these two situations.
Definition 4.1
Be $ X $ a random variable. We define the variance of $ X $, denoted by $ \text{Var}(X) $ or $ \sigma^2_X $ by
$$\text{Var}(X)=\mathbb{E}\left[\left(X-\mathbb{E}(X)\right)^2\right].$$
The positive square root of the variance $ \text{Var}(X) $ is called the standard deviation of $ X $ and denoted by $ \sigma_X $.
Note
The number $ \text{Var}(X) $ is expressed in square units of $ X $. That is, if $ X $ is measured in hours, then $ \text{Var}(X) $ is expressed in (hours)².
The calculation of $ \text{Var}(X) $ can be simplified with the help of the following result.
Property
The variance of a random variable $ X $ can be calculated as follows
$$\text{Var}(X)=\mathbb{E}(X^2)-[\mathbb{E}(X)]^2.$$
In fact, developing $ \mathbb{E}\left[\left(X-\mathbb{E}(X)\right)^2\right] $ and employing the already established properties of expected value, we obtain
$$\text{Var}(X)=\mathbb{E}\left[\left(X-\mathbb{E}(X)\right)^2\right]=\mathbb{E}\left(X^2-2X\mathbb{E}(X)+[\mathbb{E}(X)]^2\right)$$
i.e.
$$\text{Var}(X)=\mathbb{E}(X^2)-2\mathbb{E}(X)\mathbb{E}(X)+[\mathbb{E}(X)]^2=\mathbb{E}(X^2)-[\mathbb{E}(X)]^2.$$
Example 4.1
Let’s suppose that $ X $ be a continuous random variable with pdf

Calculate $ \text{Var}(X) $.
We have to

$$\mathbb{E}(X)=\int_{-1}^0x(1+x)dx+\int_0^1x(1-x)dx=\left(\frac{x^3}{3}+\frac{x^2}{2}\right)_{-1}^0+\left(\frac{x^2}{2}-\frac{x^3}{3}\right)_0^1=0$$
and
$$\mathbb{E}(X^2)=\int_{-1}^0x^2(1+x)dx+\int_0^1x^2(1-x)dx=\left(\frac{x^4}{4}+\frac{x^3}{3}\right)_{-1}^0+\left(\frac{x^3}{3}-\frac{x^4}{4}\right)_0^1=\frac{1}{6}$$
therefore, we have to
$$\text{Var}(X)=\mathbb{E}(X^2)-[\mathbb{E}(X)]^2=\frac{1}{6}.$$
Example 4.2
Using example 3.2.5 whose probability density function of the random variable $ X $ is given by

In this example we calculate the expected values of $ X $ and of $ X^2 $, which are given by
$$\mathbb{E}(X)=\frac{1}{\lambda}$$
and
$$\mathbb{E}(X^2)= \frac{2}{\lambda^2}.$$
In this way, the variance of $ X $ is given by
$$\text{Var}(X)=\mathbb{E}(X^2)-\mathbb{E}^2(X)=\frac{1}{\lambda^2}-\left(\frac{1}{\lambda}\right)^2=\frac{1}{\lambda^2}.$$
And therefore, $ \text{Var}(X)=\frac{1}{\lambda^2} $.
8.4.1 Variance properties
There are several important properties for the variance of a random variable. Below, we list some of them.
P1) Se $ c $ is a constant, then
$$\text{Var}(X+c)=\text{Var}(X).$$
In fact, we have to
$$\text{Var}(X+c)=\mathbb{E}[(X+c)^2]-[\mathbb{E}(X+c)]^2=\mathbb{E}[X^2+2cX+c^2]-[\mathbb{E}(X)+c]^2$$
therefore
$$\text{Var}(X+c)=\mathbb{E}(X^2)-[\mathbb{E}(X)]^2=\text{Var}(X).$$
Note
This property is intuitively evident, because adding a constant to a result $ X $ does not change its variability.
P2) Se $ c $ is a constant, then
$$\text{Var}(cX)=c^2\text{Var}(X)$$
In fact, we have to
$$\text{Var}(cX)=c^2\mathbb{E}(X^2)-c^2[\mathbb{E}(X)]^2=c^2\text{Var}(X).$$
P3) Se $ X $ and $ Y $ are independent random variables, then
$$\text{Var}(X+Y)=\text{Var}(X)+\text{Var}(Y).$$
In fact, we have to
$$\text{Var}(X+Y)=\mathbb{E}[(X+Y)^2]-[\mathbb{E}(X+Y)]^2$$
i.e.
$$\text{Var}(X+Y)=\mathbb{E}(X^2)+2\mathbb{E}(X)\mathbb{E}(Y)+\mathbb{E}(Y^2)-[\mathbb{E}(X)]^2-2\mathbb{E}(X)\mathbb{E}(Y)-[\mathbb{E}(Y)]^2=\text{Var}(X) +\text{Var}(Y).$$
Note
It is important to understand that variance is generally not additive, like expected value. With the complementary hypothesis of independence, P3 is valid.
P4) Be $ X_1,\ldots,X_n $ independent random variables. So,
$$\text{Var}(X_1+\ldots+X_n)=\text{Var}(X_1)+\ldots+\text{Var}(X_n).$$
This property follows directly from the previous one. Just make an induction on $ n $.
8.4.2 Covariance and Correlation Coefficient
In probability, the covariance of two variables X and Y is a measure of the joint variability of these random variables. If the variables have positive covariance they tend to show similar behavior, that is, the smallest (largest) values of variable X correspond to the smallest (largest) values of variable Y. If the covariance is negative, then the variables tend to show opposite behavior, that is, the smallest (largest) values of variable X correspond to the largest (smallest) values of variable Y.
Thus, we can see that the sign of the covariance shows the trend in the linear relationship between the variables.
Definition 4.2.1
Be $ X $ and $ Y $ integrable random variables. Then the covariance between X and Y is defined by
$$Cov(X,Y)=\mathbb{E}[(X-\mathbb{E}(X))(Y-\mathbb{E}(Y))],$$
If this hope exists, then by the linearity of hope we have to
$$Cov(X,Y)=\mathbb{E}(XY-Y\mathbb{E}(X)-X\mathbb{E}(Y)+\mathbb{E}(X)\mathbb{E}(Y))=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)$$
Thus, we have that there is covariance between two integrable variables if, and only if, there is hope $ \mathbb{E}(XY) $.
In fact, if there is covariance between two integrable variables, then we have
$$Cov(X,Y)=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)< \infty\Rightarrow\mathbb{E}(XY)\leq \mathbb{E}(X)\mathbb{E}(Y)< \infty$$
since X and Y are integrable.
Now there is $ \mathbb{E}(XY) $ and the variables X and Y are integrable then we have $ \mathbb{E}(XY)< \infty $ and $ \mathbb{E}(X)< \infty $ and $ \mathbb{E}(Y)< \infty $ then we have to $ Cov(XY)< \infty $.
Se $ Cov(X,Y)=0 $, we say that $ X $ and $ Y $ are uncorrelated. If X and Y are independent and integrable, then they are uncorrelated, because in this case
$$\mathbb{E}(XY)=\mathbb{E}(X)\mathbb{E}(Y)$$
but of course $ \mathbb{E}(XY)=\mathbb{E}(X)\mathbb{E}(Y) $ does not imply independence, that is, zero covariance does not necessarily imply independence.
Theorem 4.2.1
Be $ X_1,\dots, X_n $ integrable random variables. So,
$$Var\left(\sum_{i=1}^n X_i\right)=\sum_{i=1}^n Var(X_i)]+2\sum_{i< j}Cov(X_i,X_j).$$
In particular if $ Cov(X_i,X_j)=0 $ for $ i\neq j $ then
$$Var\left(\sum_{i=1}^n X_i\right)=\sum_{i=1}^nVar(X_i)$$
Demo
$$Var(X_1+\dots+X_n)=\mathbb{E}(X_1+\dots+X_n-\mathbb{E}(X_1+\dots+X_n))^2$$
$$=\mathbb{E}(X_1-\mathbb{E}(X_1)+\dots+X_n-\mathbb{E}(X_n))^2$$
$$=\mathbb{E}\left[\sum_{i=1}^n\sum_{j=1}^n (X_i-\mathbb{E}(X_i))(X_j-\mathbb{E}(X_j))\right]$$
$$=\mathbb{E}\left[\sum_{i=1}^n(X_i-\mathbb{E}(X_i))^2+\sum_{i\neq j}(X_i-\mathbb{E}(X_i))(X_j-\mathbb{E}(X_j))\right]$$
$$=\mathbb{E}\left(\sum_{i=1}^n (X_i-\mathbb{E}(X_i))^2+2\sum_{i< j}(X_i-\mathbb{E}(X_i))(X_j-\mathbb{E}(X_j))\right)$$
$$=\sum_{i=1}^n Var(X_i)+2\sum_{i< j}Cov(X_i,X_j)$$
Therefore the result follows.
Corollary 4.2.1
Se $ X_1,\dots, X_n $ are independent and integrable, then
$$Var(X_1+\dots+X_n)=\sum_{i=1}^n Var(X_i).$$
The magnitude of the covariance is not easy to interpret. The normalized version of the covariance (correlation coefficient), however, shows by its magnitude the strength of the linear relationship. Thus, now X and Y are integrable random variables, with positive and finite variances. We say that the random variable $ \displaystyle \frac{X-\mathbb{E}(X)}{\sigma_X} $ is a standardization of X, as it expresses the value of X in standardized units (standard deviation). A standardized random variable has zero expectation and 1 variance.
The standardized covariance is called the correlation coefficient between X and Y, which we will denote by $ \rho(X,Y) $
Definition 4.2.2
Let X and Y be integrable random variables, then the correlation coefficient between X and Y is given by
$$\rho(X,Y):=\frac{Cov(X,Y)}{\sigma_X \sigma_Y}=\mathbb{E}\left[\left(\frac{X-\mathbb{E}(X)}{\sigma_X}\right) \left(\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)\right]$$
Proposition 4.2.1
The correlation coefficient is independent of the school and transaction of the variables, that is,
$$\rho(X,Y)=\rho(aX+b,cY+d)$$
for $ a< 0 $, $ c< 0 $.
Demo
In fact, first notice that
$$\sigma_{aX+b}=\sqrt{Var(aX+b)}=\sqrt{a^2Var(X)}=a\sqrt{Var(X)}=a\sigma_X$$
$$\sigma_{cY+d}=\sqrt{Var(cY+d)}=\sqrt{c^2Var(Y)}=c\sqrt{Var(Y)}=c\sigma_Y$$
and therefore
$$\rho(aX+b,cY+d)=\mathbb{E}\left[\left(\frac{aX+b-\mathbb{E}(aX+b)}{\sigma_{aX+b}}\right) \left(\frac{cY+d-\mathbb{E}(cY+d)}{\sigma_{cY+d}}\right)\right]$$
$$=\mathbb{E}\left[\left(\frac{aX-\mathbb{E}(aX)}{\sigma_{aX+b}}\right) \left(\frac{cY-\mathbb{E}(cY)}{\sigma_{cY+d}}\right)\right]$$
$$=\mathbb{E}\left[\left(\frac{a(X-\mathbb{E}(X))}{\sigma_{aX+b}}\right) \left(\frac{c(Y-\mathbb{E}(Y))}{\sigma_{cY+d}}\right)\right]$$
$$=\mathbb{E}\left[\left(\frac{a(X-\mathbb{E}(X))}{a\sigma_{X}}\right) \left(\frac{c(Y-\mathbb{E}(Y))}{c\sigma_{Y}}\right)\right]$$
$$=\mathbb{E}\left[\left(\frac{X-\mathbb{E}(X)}{\sigma_{X}}\right) \left(\frac{Y-\mathbb{E}(Y)}{\sigma_{Y}}\right)\right]$$
$$=\rho(X,Y)$$
Below we have a proposition with some properties of the linear coefficient.
Proposition 4.2.2
Let X and Y be random variables with finite and positive variances. So:
a) $ -1\leq \rho(X,Y)\leq 1 $
b) $ \rho(X,Y)=1 $ if, and only if, $ \mathbb{P}(Y=aX+b)=1 $ for some $ a> 0 $, $ b\in \mathbb{R} $.
c) $ \rho(X,Y)=-1\Leftrightarrow \mathbb{P}(Y=aX+b)=1 $ for some $ a< 0, \quad b\in \mathbb{R}. $
Demo
(a) How
$$0\leq \left(\frac{X-\mathbb{E}(X)}{\sigma_X}-\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)^2,$$
we have
$$0\leq \mathbb{E}\left(\frac{X-\mathbb{E}(X)}{\sigma_X}-\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)^2$$
$$=\mathbb{E}\left(\frac{X-\mathbb{E}(X)}{\sigma_X}\right)^2+\mathbb{E}\left(\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)^2- \frac{2}{\sigma_X\sigma_Y}\mathbb{E}[(X-\mathbb{E}(X))(Y-\mathbb{E}(Y))]$$
$$=\frac{Var(X)}{\sigma^2_X}+\frac{Var(Y)}{\sigma^2_Y}-\frac{2Cov(X,Y)}{\sigma_X\sigma_Y}=2-2\rho(X,Y).$$
Logo $ \rho(X,Y)\leq 1. $
Replacing the sign “$ - $” by “$ + $” in the expression above we have
$$0\leq 2+2\rho(X,Y)$$
this is $ \rho(X,Y)\geq -1 $. Therefore, (a) follows.
Now if $ \rho=1 $ so we have to
$$0=2-2\rho(X,Y)=\frac{Var(X)}{\sigma^2_X}+\frac{Var(Y)}{\sigma^2_Y}- \frac{2Cov(X,Y)}{\sigma_X\sigma_Y}=\mathbb{E}\left(\frac{X-\mathbb{E}(X)}{\sigma_X}-\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)^2$$
So,
$$\mathbb{E}\left(\frac{X-\mathbb{E}(X)}{\sigma_X}-\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)^2=0$$
i.e.
$$\mathbb{E}\left(\frac{X-\mathbb{E}(X)}{\sigma_X}\right)=\mathbb{E}\left(\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)$$
Since X and Y are positive we have
$$\mathbb{P}\left(\frac{X-\mathbb{E}(X)}{\sigma_X}-\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)=1$$
i.e.
$$Y=\mathbb{E}(Y)+\frac{\sigma_Y}{\sigma_X}(X-\mathbb{E})$$
almost certainly. To return, just take $ a=\frac{\sigma_Y}{\sigma_X} $ and $ b=\mathbb{E}(Y)-\frac{\sigma_Y}{\sigma_X}\mathbb{E}(X) $.
Now if $ \rho(X,Y)=-1 $, then
$$\mathbb{E}\left(\frac{X-\mathbb{E}(X)}{\sigma_X}+\frac{Y-\mathbb{E}(Y)}{\sigma_Y}\right)=0$$
and
$$Y=\mathbb{E}(Y)-\frac{\sigma_Y}{\sigma_X}(X-\mathbb{E}(X))$$
with probability 1. In this case, $ a=-\frac{\sigma_Y}{\sigma_X} $ and $ b=\mathbb{E}(Y)+\frac{\sigma_Y}{\sigma_X}\mathbb{E}(X) $.
On the other hand, if $ \mathbb{P}(Y=aX+b)=1 $ for some $ a\neq 0 $, we have
$$\rho(X,Y)=\mathbb{E}\left[\left(\frac{X-\mathbb{E}(X)}{\sigma_X}\right)\left(\frac{aX+b-a\mathbb{E}(X)-b}{\sqrt{a^2\sigma^2_X}}\right)\right]$$
$$=\frac{a}{|a|}\mathbb{E}\left(\frac{X-\mathbb{E}(X)}{\sigma_X}\right)^2=\frac{a}{|a|}=\text{sinal}(a)$$
A high correlation between X and Y, i.e. if $ \rho(X,Y) $ close to 1, it means that the value of $ Y $ tends to follow that of X.
Example 4.2.1
Show that if $ \mathbb{E}(XY)=\mathbb{E}(X)\mathbb{E}(Y) $ and X and Y only take on values $ 0 $ and $ 1 $ then X and Y are independent.
In fact, notice that:
$$\mathbb{E}(X)=0\mathbb{P}(X=0)+1\mathbb{P}(X=1)=\mathbb{P}(X=1)$$
$$\mathbb{E}(Y)=0\mathbb{P}(Y=0)+1\mathbb{P}(Y=1)=\mathbb{P}(Y=1)$$
and
$$\mathbb{E}(XY)=0\mathbb{P}(X=0,Y=0)+0\mathbb{P}(X=0,Y=1)+0\mathbb{P}(X=1,Y=0)+1\mathbb{P}(X=1,Y=1)=\mathbb{P}(X=1,Y=1)$$
But as per hypothesis $ \mathbb{E}(XY)=\mathbb{E}(X)\mathbb{E}(Y) $ so we have to
$$\mathbb{E}(XY)=\mathbb{P}(X=1,Y=1)=\mathbb{E}(X)\mathbb{E}(Y)=\mathbb{P}(X=1)\mathbb{P}(Y=1)$$
Now notice that
$$\mathbb{P}(X=0,Y=1)=\mathbb{P}(Y=1)-\mathbb{P}(X=1,Y=1)=\mathbb{P}(Y=1)-\mathbb{P}(X=1)\mathbb{P}(Y=1)=\mathbb{P}(Y=1) \left(1-\mathbb{P}(X=1)\right)=\mathbb{P}(Y=1)\mathbb{P}(X=0)$$
and
$$\mathbb{P}(X=0,Y=0)=\mathbb{P}(X=0)-\mathbb{P}(X=0,Y=1)=\mathbb{P}(X=0)(1-\mathbb{P}(Y=1))=\mathbb{P}(X=0)=\mathbb{P}(X=0)\mathbb{P}(Y=0)$$
Using the equations above, we obtain independence.
Example 4.2.2
If X takes only values $ a $ and $ b $, Y takes only the values c and d and $ Cov(X,Y)=0 $, then X and Y are independent
In fact, consider that $ W $ and $ Z $ only take values 0 and 1. So
$$X=(b-a)W+a$$
and
$$Y=(d-c)Z+c$$
So,
$$XY=[(b-a)W+a][(d-c)Z+c]=(b-a)(d-c)WZ+a(d-c)Z+c(b-a)W+ac$$
and therefore
$$\mathbb{E}(XY)=(b-a)(d-c)\mathbb{E}(WZ)+a(d-c)\mathbb{E}(Z)+c(b-a)\mathbb{E}(W)+ac$$
and we have to
$$\mathbb{E}(X)=(b-a)\mathbb{E}(W)+a$$
and
$$\mathbb{E}(Y)=(d-c)\mathbb{E}(Z)+c$$
which implies that
$$\mathbb{E}(X)\mathbb{E}(Y)=(b-a)(d-c)\mathbb{E}(W)\mathbb{E}(Z)+a(d-c)\mathbb{E}(Z)+c(b-a)\mathbb{E}(W)+ac$$
How to $ Cov(X,Y)=0 $ and
$$0=Cov(X,Y)=(b-a)(d-c)Cov(W,Z)$$
and yet
$$Cov(XY)=\mathbb{E}(XY)-\mathbb{E}(X)\mathbb{E}(Y)=(b-a)(d-c)\mathbb{E}(WZ)+a(d-c)\mathbb{E}(Z)+c(b-a)\mathbb{E}(W)+ac - (b-a)(d-c)\mathbb{E}(W)\mathbb{E}(Z)+a(d-c)\mathbb{E}(Z)+c(b-a)\mathbb{E}(W)+ac $$
$$(b-a)(d-c)[\mathbb{E}(WZ)-\mathbb{E}(W)\mathbb{E}(Z)]=(b-a)(d-c)Cov(W,Z)$$
Now if $ Cov(X,Y)=0 $ so how $ (a-b)(d-c)\neq 0 $, because $ b> a $ and $ d> c $ which implies that from the previous example we have
$$Cov(W,Z)=0$$
which implies that $ W $ and $ Z $ are independent, which means that $ (b-a)W+a $ and $ (d-c)Z+c $ are independent and therefore X and Y are independent.
Example 4.2.3
If X and Y are independent with finite variance, then
$$Var(XY)=Var(X)Var(Y)+\mathbb{E}(X)^2Var(Y)+\mathbb{E}(Y)^2Var(X)$$
To do this, note that
$$Var(X)Var(Y)+\mathbb{E}(X)^2Var(Y)+\mathbb{E}(Y)^2Var(X)=\left(\mathbb{E}(X^2)-\mathbb{E}^2(X)\right)\left(\mathbb{E}(Y^2)-\mathbb{E}^2(Y)\right) $$
$$+\left(\mathbb{E}^2(X)\right) \left(\mathbb{E}(Y^2)-\mathbb{E}^2(Y)\right)+ \left(\mathbb{E}^2(Y)\right)\left(\mathbb{E}(X^2)-\mathbb{E}^2(X)\right)$$
$$=\mathbb{E}^2(X)\mathbb{E}(Y^2)-\mathbb{E}^2(X)\mathbb{E}^2(Y)+\mathbb{E}(X^2)\mathbb{E}^2(Y)-\mathbb{E}^2(X)\mathbb{E}^2(Y) + \mathbb{E}(X^2)\mathbb{E}(X^2)-\mathbb{E}(X^2)\mathbb{E}^2(Y)-\mathbb{E}^2(X)\mathbb{E}(Y^2)+\mathbb{E}^2(X)\mathbb{E}^2(Y)$$
$$=\mathbb{E}(X^2)\mathbb{E}(Y^2)-\mathbb{E}^2(X)\mathbb{E}^2(Y)=\mathbb{E}((XY)^2)-\mathbb{E}^2(XY)=Var(XY)$$
therefore the result follows.
Proposition 4.2.3
The covariance is bilinear, that is,
$$Cov\left(\sum_{i=1}^n a_iX_i, \sum_{j=1}^m b_jY_j\right)=\sum_{j=1}^m\sum_{i=1}^n a_i b_j Cov(X_i,Y_j)$$
in which $ a_i $ and $ b_j $ are real numbers and $ Var(X_i) $, $ Var(Y_j) $ are finite.
Demo
Since the variances are finite then $ \mathbb{E}(X_iY_j)< \infty $, and by the Cauchy-Schwartz inequality $ Cov(X_i,Y_j) $. So
$$Cov\left(\sum_{i=1}^n a_iX_i, \sum_{j=1}^n b_jY_j\right)=\mathbb{E}\left(\sum_{i=1}^n a_iX_i\sum_{j=1}^n b_jY_j\right)-\mathbb{E}\left(\sum_{i=1}^n a_i X_i\right)\mathbb{E}\left(\sum_{j=1}^m b_j Y_j\right)$$
$$=\mathbb{E}\left(\sum_{j=1}^m\sum_{i=1}^n a_i b_jX_iY_j\right)-\mathbb{E}\left(\sum_{i=1}^n a_iX_i\right)\mathbb{E}\left(\sum_{j=1}^m b_jY_j\right)$$
By the linearity of hope we have to
$$Cov\left(\sum_{i=1}^n a_iX_i, \sum_{j=1}^n b_jY_j\right)=\sum_{j=1}^n\sum_{i=1}^m a_ib_j\mathbb{E}(X_i Y_j)-\left(\sum_{i=1}^n a_i\mathbb{E}(X_i)\right)\left(\sum_{j=1}^m b_j\mathbb{E}(Y_j)\right)$$
$$=\sum_{i=1}^n \sum_{j=1}^m a_ib_j \left(\mathbb{E}(X_iY_j)-\mathbb{E}(X_i)\mathbb{E}(Y_i)\right)=\sum_{j=1}^m\sum_{i=1}^n a_ib_jCov(X_i,Y_j)$$
therefore the result follows.
Example 4.2.4
Be $ (X_1,\dots X_n, Y_1, \dots, Y_m) $ a random vector $ (m+n) $-dimensional such that $ Var(X_i)=Var(Y_j)=1 $ and $ \rho(X_i,X_j)=\rho_1 $ and $ \rho(Y_i,Y_j)=\rho_2 $ for everyone $ i\neq j $ and $ \rho(X_i,Y_j)=\rho_3 $. Se $ U=X_1+\dots+X_m $ and $ V=Y_1+\dots+Y_n $, then prove that the correlation coefficient
$$\rho(U,V)=\frac{\sqrt{mn}\rho_3}{\sqrt{1+(m-1)\rho_1}\sqrt{1+(n-1)\rho_2}}$$
To do this, note that
$$Cov(U,V)=Cov\left(\sum_{i=1}^n X_i,\sum_{j=1}^m Y_j\right)=\sum_{i=1}^n\sum_{j=1}^mCov(X_i, Y_j)=mn(\rho_3\sqrt{Var(X_1)}\sqrt{Var(Y_1)})=mn\rho_3$$
Now
$$\sigma_U^2=Var\left(\sum_{i=1}^nX_i\right)=\sum_{i=1}^nVar(X_i)+2\sum_{i< j}Cov(X_i,X_j)=n+2n(n-1)\rho_1=n(1+(n-1)\rho_1)$$
We also obtain that
$$\sigma_V^2=Var\left(\sum_{i=1}^mY_i\right)=\sum_{i=1}^mVar(Y_i)+2\sum_{i< j}Cov(Y_i,Y_j)=m(1+(m-1)\rho_2)$$
So,
$$\rho(U,V)=\frac{Cov(U,V)}{\sigma_U\sigma_V}=\frac{\sqrt{mn}\rho_3}{\sqrt{1+(m-1)\rho_1}\sqrt{1+(n-1)\rho_2}}$$
and therefore the result follows.
Example 4.2.5
Let X, Y and Z be independent variables with common distribution $ U[0,1] $. Calculate the expectation and variance of $ W=(X+Y)Z $.
Firstly note that
$$\mathbb{E}(X)=\frac{1}{2}$$
and
$$\mathbb{E}(X^2)=\frac{1}{3}$$
Now using independence, we have to
$$\mathbb{E}(W)=\mathbb{E}(X+Y)\mathbb{E}(Z)=\mathbb{E}(X)\mathbb{E}(Z)+\mathbb{E}(Y)\mathbb{E}(Z)=\left(\frac{1}{2}+\frac{1}{2}\right)\frac{1}{2}=\frac{1}{2}$$
and using Example 4.2.3, we have
$$Var[(X+Y)Z]=Var(X+Y)Var(Z)+\mathbb{E}(X+Y)^2Var(Z)+\mathbb{E}(Z)^2Var(X+Y)=\frac{5}{36}$$