# What is the formula for the variance of a probability distribution?

##### 1 Answer

Often a shorthand notation is used, where the limits of summation (or integration) are omitted, and sometimes the subscripts;

For a **discrete** Random Variable X, where:

# sum_(i=1)^n P(x_i) = sum P(X=x) = sum P(x) = 1#

then the Expectation is defined by:

# E(X) = sum_(i=1)^n \ x_i \ P(X=x_i) = sum xP(x) #

Then the variance is defined by:

# Var(X) = E(X^2) - {E(X)}^2 #

# " " = sum_(i=1)^n \ x_i^2 \ P(X=x_i) - {sum_(i=1)^n \ x_i \ P(X=x_i)}^2 #

# " " = sum x^2P(x) - {sum xP(x)}^2 #

We get similar results for a **continuous** Random Variable

# P( a le X le b) = int_a^b \ f(x) \ dx = 1#

and the Expectation, is defined by (and shorthand):

# E(X) = int_a^b \ xf(x) \ dx = int_D \ xf(x) \ dx #

and the variance is defined by:

# Var(X) = E(X^2) - {E(X)}^2 #

# " " = int_a^b \ x^2f(x) \ dx - {int_a^b \ xf(x) \ dx}^2 #

# " " = int_D \ x^2f(x) \ dx - {int_D \ xf(x) \ dx}^2 #