Law of total variance
In probability theory, the law of total variance (conditional variance formula) states that if X and Y are random variables on the same probability space, and the variance of X is finite, then
var(Y)=var[E(Y|X)] + E[var(Y|X)]
This can be proved easily.
The first term is the unexplained component of the variance; the second is the explained component of the variance. The conditional expected value E( X | Y ) is a random variable in its own right, whose value depends on the value of Y. Notice that the conditional expected value of X given the event Y = y is a function of y.
This formula can be applied widely. An example to see: http://www.statisticalexperts.com/statexp/2006/10/10/simple-linear-regression/