Variance of the sum of independent random variables
January 7th, 2009 at 10:06 pmYesterday I was trying to brush up my skills in probability and came upon this formula on the Wikipedia page about variance:

The article calls this the Bienaymé formula and gives neither proof nor a link to one. Googling this formula proved equally fruitless in terms of proofs.
So, I set out to find why this works. It took me a few hours of digging through books and removing dust from my University-learned probability skills of 8 years ago, but finally I’ve made it. Here’s how.
Note: the Wikipedia article states the Bienaymé formula for uncorrelated variables. Here I’ll prove the case of independent variables, which is a more useful and frequently used application of the formula. I’m also proving it for discrete random variables – the continuous case is equivalent.
Expected value and variance
We’ll start with a few definitions.
Formally, the expected value of a (discrete) random variable X is defined by:
![E[X]=\sum_{x}^{}{xp_{X}(x)} E[X]=\sum_{x}^{}{xp_{X}(x)}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-127871b985a6b07998ea4a9478d42a7d.gif)
Where
is the PMF of X,
. For a function
:
![E[g(X)]=\sum_{x}^{}{g(x)p_{X}(x)} E[g(X)]=\sum_{x}^{}{g(x)p_{X}(x)}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-66e3f4e71aabab62ae30eb1f18c95f18.gif)
The variance of X is defined in terms of the expected value as:
![var(X)=E[(X-E[X])^{2}] var(X)=E[(X-E[X])^{2}]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-90bfa98fc1ded868a87fd85285aedcea.gif)
From this we can also obtain:
![var(X)=\sum_{x}^{}{(x-E[X])^{2}p_{X}(x)} var(X)=\sum_{x}^{}{(x-E[X])^{2}p_{X}(x)}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-74f968c1728967adba9854f1bf5ff2fd.gif)
![=\sum_{x}^{}{x^{2}-2xE[X]+(E[X])^{2})p_{X}(x)} =\sum_{x}^{}{x^{2}-2xE[X]+(E[X])^{2})p_{X}(x)}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-068b8ec09f76961832d5485d42ae7ce4.gif)
![=\sum_{x}{x^{2}p_{X}(x)-2E[X]\sum_{x}xp_{X}(x)}+(E[X])^{2}\sum_{x}p_{X}(x) =\sum_{x}{x^{2}p_{X}(x)-2E[X]\sum_{x}xp_{X}(x)}+(E[X])^{2}\sum_{x}p_{X}(x)](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-c351f2f9a4c25835886c94e6557b87ac.gif)
![=E[X^{2}]-2(E[X])^{2}+(E[X])^{2} =E[X^{2}]-2(E[X])^{2}+(E[X])^{2}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-b315b36054642f376cfc739645f88172.gif)
![=E[X^{2}]-(E[X])^{2} =E[X^{2}]-(E[X])^{2}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-c2b123179a4de1d5deee5a992de87121.gif)
Which is more convenient to use in some calculations.
Linear function of a random variable
From the definitions given above it can be easily shown that given a linear function of a random variable:
, the expected value and variance of Y are:
![E[Y]=aE[X]+b E[Y]=aE[X]+b](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-3fe4d64a4c4443318d84cd1d4cfa05dd.gif)
![var(Y)=a^{2}var[X] var(Y)=a^{2}var[X]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-d635073cac68f54a5351f5d988dc9b5f.gif)
For the expected value, we can make a stronger claim for any g(x):
![E[ag(X)+b]=aE[g(x)]+b E[ag(X)+b]=aE[g(x)]+b](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-f43718fe0965ecf53ddfb7f69b088b5b.gif)
Multiple random variables
When multiple random variables are involved, things start getting a bit more complicated. I’ll focus on two random variables here, but this is easily extensible to N variables. Given two random variables that participate in an experiment, their joint PMF is:

The joint PMF determines the probability of any event that can be specified in terms of the random variables X and Y. For example if A is the set of all pairs
that have a certain property, then:

Note that from this PMF we can infer the PMF for a single variable, like this:



The expected value for functions of two variables naturally extends and takes the form:
![E[g(X,Y)]=\sum_{x}\sum_{y}{g(x,y)p_{X,Y}(x,y)} E[g(X,Y)]=\sum_{x}\sum_{y}{g(x,y)p_{X,Y}(x,y)}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-6513d53db2a98fb67ab2c862fc26f408.gif)
Sum of random variables
Let’s see how the sum of random variables behaves. From the previous formula:
![E[X+Y]=\sum_{x}\sum_{y}{(X+Y)p_{X,Y}(x,y)}= E[X+Y]=\sum_{x}\sum_{y}{(X+Y)p_{X,Y}(x,y)}=](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-a2d5970882e93530cb1bf19b3a657f97.gif)

But recall equation (1). The above simply equals to:

![=E[X]+E[Y]\qquad (2) =E[X]+E[Y]\qquad (2)](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-5ca260798633f0f1e6f9381ee857d730.gif)
We’ll also want to prove that
. This is only true for independent X and Y, so we’ll have to make this assumption (assuming that they’re independent means that
).
![E[XY]=\sum_{x}\sum_{y}{xyp_{X,Y}(x,y)} E[XY]=\sum_{x}\sum_{y}{xyp_{X,Y}(x,y)}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-2ec0d1844ba3774959899598e635b9d3.gif)
By independence:
![E[XY]=\sum_{x}\sum_{y}{xyp_{X}(x)p_{Y}(y)} E[XY]=\sum_{x}\sum_{y}{xyp_{X}(x)p_{Y}(y)}](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-41cbd7000fdd02252dab9e601535ca4f.gif)

![=E[X]E[Y]\qquad (3) =E[X]E[Y]\qquad (3)](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-b553d97d5c151d505ac8fb65c87b28fd.gif)
A very similar proof can show that for independent X and Y:
![E[g(X)h(Y)]=E[g(X)]E[h(Y)] E[g(X)h(Y)]=E[g(X)]E[h(Y)]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-c9591e49c7bf17129da2e78b803378e7.gif)
For any functions g and h (because if X and Y are independent, so are g(X) and h(y)).
Now, at last, we’re ready to tackle the variance of X + Y. We start by expanding the definition of variance:
![var(X+Y)=E[(X+Y-E[X+Y])^{2}] var(X+Y)=E[(X+Y-E[X+Y])^{2}]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-9e1f9303a1cdb4b08df68601e28253c0.gif)
By (2):
![=E[(X+Y-E[X]-E[Y])^{2}] =E[(X+Y-E[X]-E[Y])^{2}]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-94d2ddd8d5a593dba14d55275ec8d5b5.gif)
![=E[((X-E[X]) + (Y – E[Y]))^{2}] =E[((X-E[X]) + (Y – E[Y]))^{2}]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-8ee480d8e73e709aa82df470706bd4e3.gif)
![=E[(X)-E[X])^{2}]+E[(Y-E[Y])^{2}] =E[(X)-E[X])^{2}]+E[(Y-E[Y])^{2}]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-f387e355ff7ebc2bdb2ca58da3964ae6.gif)
![+2E[(X-E[X])(Y-E[Y])] +2E[(X-E[X])(Y-E[Y])]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-7505d8fad2b5c1734f446351dd5046ef.gif)
Now, note that the random variables
and
are independent, so:
![E[(X-E[X])(Y-E[Y])]=E[(X-E[X])]E[(Y-E[Y])] E[(X-E[X])(Y-E[Y])]=E[(X-E[X])]E[(Y-E[Y])]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-5ac97669f6ba08a2189065a8dea15175.gif)
But using (2) again:
![E[X-E[X]]=E[X]-E[E[X]] E[X-E[X]]=E[X]-E[E[X]]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-4450aa4a7d54deec459c3181bbf5d5ae.gif)
is obviously just
, therefore the above reduces to 0.
So, coming back to the long expression for the variance of sums, the last term is 0, and we have:
![var(X+Y)=E[(X)-E[X])^{2}]+E[(Y-E[Y])^{2}] var(X+Y)=E[(X)-E[X])^{2}]+E[(Y-E[Y])^{2}]](http://eli.thegreenplace.net/wp-content/ql-cache/quicklatex-ffafc4b4b83e374f8b935d45374c3247.gif)

As I’ve mentioned before, proving this for the sum of two variables suffices, because the proof for N variables is a simple mathematical extension, and can be intuitively understood by means of a “mental induction”.
Therefore:

For N independent variables
. 
Related posts:

September 10th, 2009 at 17:48
Thank you very much for the proof, I was looking for it.
Just a little typo, there is a missing ( in the equation after ‘From this we can also obtain’
October 18th, 2009 at 01:25
Thanks, too. This would be nice to link to the wikipedia variance article, as a reference for the Bienaymé formula.
January 25th, 2010 at 00:13
Hello, great job on doing this. I really think a link or part of this should be added to the wikipedia page.
Just a correction: Under the subtitle “Linear function of a random variable” you state that Var[Y] = a^2 * E[X] which is wrong. I worked it out and it should be Var[Y] = a^2 * Var[X], and confirmed the same result in the wikipedia entrance of Variance.
I will definitely link this page from the “useful links” of my probabilistic learning class.
January 25th, 2010 at 05:46
@Mario, thanks for the correction. Typo fixed.
February 4th, 2010 at 22:58
I googled for “variance sum random variable proof” and your page came up as the top result. Thanks for this (: