# Variance and Covariance

### Variance

Variance means **spread** of a distribution

Let X be a random variable with mean μ. The variance of X – denoted by σ

^{2}or σ^{2}_{X}or V(X) or VX is defined by

assuming this expectation exists. The standard deviation is sd(X) = √V(X) and is also denoted by σ and σ

_{X}.

Variance has the following properties.

1. V(X) = E(X^{2}) – μ^{2}

2. If a and b are constants then V(aX+b) = a^{2}V(X)

3. If X_{1}, . . . , X_{n} are independent and a_{1}, . . . , a_{n} are constants, then

Example: Let X ~ Binomial(n, p). We write X = ∑_{i}X_{i} where X_{i} = 1 if toss i is head and X_{i} = 0 otherwise. Here, P(X_{i} = 1) = p and P(X_{i} = 0) = 1 – p.

Using the formula of expectation,

E(X_{i}) = [p x 1] + [(1 – p) x 0] = p

E(X_{i}^{2}) = [p x 1^{2}] + [(1 – p) x 0^{2}] = p

Now, V(X_{i}) = E(X_{i}^{2}) – p^{2} = p – p^{2} = p(1 – p).

Finally, V(X) = V(∑_{i}X_{i}) = ∑_{i}V(X_{i}) = ∑_{i}p(1 – p) = np(1 – p).

If X1, . . . , Xn are random variables then we define the sample mean to be

and the sample variance to be

### Covariance

Let X and Y be random variables with mean μ

_{X}and μ_{Y}and standard deviation σ_{X}and σ_{Y}. Define the covariance between X and Y byCov(X, Y) = E[(X – μ

_{X}) (Y – μ_{Y})]

and the correlation by

Covariance satisfies the following property

Cov(X, Y) = E(XY) – E(X)E(Y)

### Conditional Expectation

The conditional expectation of X given Y = y is

If r(x, y) is a function of x and y then

Conditional expectation corresponds to the mean X among those times in which Y = y.