Variance and covariance

Definition (variance) open_in_new

For an integrable random variable $X$ having mean $\mu\in\R$, the variance of $X$ is $$ \operatorname{var}(X) = \expect\big((X-\mu)^2\big). $$

Equivalently (derivation), $$ \operatorname{var}(X) = \expect(X^2) - \expect(X)^2. $$

We see that $\expect(X)^2 \leq \expect(X^2)$, so square-integrable implies integrable.

For $X$ integrable discrete with mean $\mu$, $$\operatorname{var}(X) = \sum_n (x_n-\mu)^2\,\prob(X=x_n).$$

Definition (standard deviation) open_in_new

The standard deviation of an integrable random variable $X$ is $\sqrt{\operatorname{var}(X)}$.

Definition (covariance) open_in_new

For square-integrable random variables $X$, $Y$ with means $\mu$, $\nu$, the covariance is defined by $$ \operatorname{cov}(X,Y) = \expect\big((X-\mu)(Y-\nu)\big). $$ (Derivation that $(X-\mu)(Y-\nu)$ is integrable)

Equivalently (derivation), $$ \op{cov}(X,Y) = \expect(XY) - \expect(X)\expect(Y). $$

Definition (correlation) open_in_new

The correlation of two square-integrable random variables $X,Y$ is $$ \begin{align*} \op{corr}(X,Y) = \frac{\cov(X,Y)}{\sqrt{\var(X)}\sqrt{\var(Y)}}. \end{align*} $$

Cauchy-Schwarz inequality implies $\op{corr}(X,Y)\in[-1,1]$.

Lemma (variance of sum) open_in_new

For square-integrable random variables $X,Y$, $$ \op{var}(X+Y) = \op{var}(X) + 2\op{cov}(X,Y) + \op{var}(Y). $$

Proof

Lemma (independent implies zero covariance) open_in_new

If $X,Y$ are independent, then $\op{cov}(X,Y)=0$.

Proof: $\expect(XY) = \expect(X) \expect(Y)$.

Converse not true: example.

Variance of indicator function open_in_new

For all $A\in\mathcal F$, if $\prob(A) = p$, then $$ \begin{align*} \op{var}(1_A) &= \expect({1_A}^2) - \expect(1_A)^2 \\ &= p - p^2. \end{align*} $$

Definition (variance of multivariate random variable) open_in_new

The variance of a random variable $\v X=(X_1, X_2, \ldots, X_n)$ in $\R^n$ is its covariance matrix $$ \begin{align*} \op{var}(\v X) = (\op{cov}(X_i, X_j))_{i,j=1}^n = \expect\big[ (\v X-\expect(\v X))(\v X-\expect(\v X))^T \big]. \end{align*} $$