Main content

### Course: Statistics and probability > Unit 9

Lesson 4: Combining random variables- Mean of sum and difference of random variables
- Variance of sum and difference of random variables
- Intuition for why independence matters for variance of sum
- Deriving the variance of the difference of random variables
- Combining random variables
- Combining random variables
- Example: Analyzing distribution of sum of two normally distributed random variables
- Example: Analyzing the difference in distributions
- Combining normal random variables
- Combining normal random variables

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Variance of sum and difference of random variables

Intuition for why the variance of both the sum and difference of two independent random variables is equal to the sum of their variances.

## Want to join the conversation?

- why we can't take the sum of standard deviation? why we can only take the sum of variance?(6 votes)
- If X and Y are independent, then Var(X + Y) = Var(X) + Var(Y) and Var(X - Y) = Var(X) + Var(Y).

However, this does not imply that the same is true for standard deviation, because in general the square root of the sum of the squares of two numbers is usually not the sum of the two numbers. Note that

SD(X + Y) = sqrt[Var(X) + Var(Y)] = sqrt{[SD(X)]^2 + [SD(Y)]^2}, which is not SD(X) + SD(Y).

SD(X - Y) = sqrt[Var(X) + Var(Y)] = sqrt{[SD(X)]^2 + [SD(Y)]^2}, which is not SD(X) + SD(Y).

Have a blessed, wonderful day!(15 votes)

- In this video I couldn't get my head around what X-Y looks like in real life. X+Y is easy: its just pouring a bowl of cereal - but what does X-Y mean?(4 votes)
- Suppose that X is a random variable that represents how many times a person scratches their head in a 24 hours period and Y is a random variable that represents the number of times a person scratches their nose in the same time period.

X+Y represents the sum, meaning how many times they scratch their head and nose combined.

X-Y represents the difference, meaning how many**more**times they scratch their head compared to their nose.(15 votes)

- I don't get that both Var(X + Y) and Var (X - Y) equal Var(X) + Var (Y). In what way?

Thank you.(2 votes)- It's because Var(−𝑌) = Var(𝑌).

−𝑌 has the exact same distribution as 𝑌, only mirrored.(7 votes)

- At7:25:

E(X+Y) = 20 oz

Var(X+Y) = 1 but........ 18 <= X+Y <= 22 that means the actual variance is 2 ( 2oz above the mean "20oz" and 2oz below the mean) and not 1. How come?(4 votes) - What if it's not independent? How do we derive the E(X+Y) and VAR(X+Y)?(2 votes)
- Interesting question! If we don’t assume that X and Y are independent, it is still always true that E(X+Y) = E(X)+E(Y). However, it is not necessarily true that Var(X+Y) = Var(X)+Var(Y). Instead, the more general rule Var(X+Y) = Var(X)+2Cov(X,Y)+Var(Y) is always true, where Cov(X,Y) is the covariance of X and Y, which is defined as E(XY)-E(X)E(Y).

Have a blessed, wonderful day!(3 votes)

- Sal here tried to give the intuition of why we add the variance in both cases. Didn't he use range to explain it. As 15<=X=<17 represents the range not the variance. Isn't variance the square of the difference between observed values and mean, and how can it be taken in a similar sense to range?

Is there any other way to get intuition about adding up variance?(2 votes)- if you push Z (a value representing a standard deviation, and thus a variance of a measurement) to the small and large enough values (say -4 and 4), you can be certain that there are no measurable values below and above this spectrum

and you can call it a range

in other words, a range is an extreme version of variance. and it's a lot simpler to do the math with a range than variable in many cases. that's why Sal used a range to explain this concept on variable a bit more simply, i believe(2 votes)

- If the variance of both X+Y and X-Y is Var(X)+Var(Y), what happens if you keep combining and separating the cereal box and the bowl of cereal? Intuitively the variance won't go to infinity but according to the video it would? Or will they not be independent anymore once you combine the box of cereal with the bowl of cereal?(2 votes)
- yes it goes to infinity (only if you keep doing this infinitely for sure)

1. you can think of a variance as an error from the "true" value of an object being measured

var(X+Y) = an error from measuring X, measuring Y, then adding them up

var(X-Y) = an error from measuring X, measuring Y, then subtracting Y from X

2. if you do this once, you may have var(X+Y)+var(X-Y) as your total error and they are not cancelling out one another, probably unlike your intuition (there's no such thing as a negative error or variance)

3. if you do this infinitely many times, your total errors must climb to infinity. (unless you had the golden hand of making no error at all) though you keep having just one box of cereal, some of which would be in the bowl depending on the timing of your halting this infinite experiment

variance doesn't tell you the "true" value of something, but how far your measurement is from it. so the more measurements, the larger the error(1 vote)

*If Var(X+Y)= Var(X)+ Var(Y)**And Variance=(Standard Deviation Square)^2*

Then why can't we take the**standard deviations of both random variables and calculate their squares and add them up**? That would give us the variance, right?

Let's take the example shown in the video

σ(X)= 0.8 oz

Var(X)= (σ(X))²

∴ Var(X)= (0.8)²=0.64

σ(Y)= 0.6 oz

Var(Y)= (σ(Y))²

∴ Var(Y)= (0.6)²=0.36

Var(X+Y)= Var(X)+Var(Y)=0.64+0.36

∴Var(X+Y)=1

We can also calculate the standard deviation of X+Y using this variance-

Variance= σ²

σ= √variance

σ(X+Y)= √var(X+Y)= √1

∴σ(X+Y)= 1?**Why isn't the variance calculated this way**

🎊Happy New Year🎊

Thank you(2 votes)- The variance of the sum of two random variables is indeed the sum of their individual variances, as stated by Var(X + Y) = Var(X) + Var(Y). The reason we square the standard deviations to calculate variances is a mathematical convention that simplifies calculations and maintains consistency with the properties of variances. However, you can indeed calculate the variance by squaring the standard deviations and adding them up, as you've correctly shown. Both methods should yield the same result(1 vote)

- What about overlapping variances?

E.g.

Cereal was 15 < x 17

Bowl was 14 < x < 16(2 votes)- -1(=15-16) < range(Cereal - bowl) < 3(=17-14)

3 - (-1) = 4

which gives you the same range(1 vote)

- Does this apply to continuous random variables too?(1 vote)
- Yes, for continuous random variables, it is still true that the variance of a sum or difference of independent random variables is the sum of their variances.(2 votes)

## Video transcript

- So, we've defined two
random variables here. The first random variable X is the weight of the cereal in a random box of our
favorite cereal, Mathies, a random closed box of our
favorite cereal, Mathies. And we know a few other things about it. We know what the expected value of X is, it is equal to 16 ounces. In fact, they tell it to us on a box, they say, you know, net weight, 16 ounces. Now, when you see that on a cereal box, it doesn't mean that every box is going to be exactly 16 ounces. Remember you have a discrete
number of these flakes in here, they might have slightly
different densities, slightly different shapes depending how they get
packed into this volume, so there is some variation which you can measure
with standard deviation. So, the standard deviation, let's just say for the sake of argument, for the random variable X is 0.8 ounces and just to build our intuition a little bit later in this video, let's say that this,
the random variable X, is always stays
constrained within a range, that if it goes above a certain weight or below a certain weight, then the company that produces
it just throws out that box. And so, let's say that
our random variable X is always greater than
or equal to 15 ounces and it is always less than
or equal to 17 ounces, just for argument. This'll help us build
our intuition later on. Now, separately, let's consider a bowl, we're always gonna consider
the same size bowl, let's consider just a four ounce bowl because the expected value of Y, if you took a random one of these bowls, always the same bowl, or if you took the same bowl and someone filled it with Mathies, the expected weight of
the Mathies in that bowl is going to be four ounces. But once again, there's going to be some variation, depends who filled it
in, how it packed in, did they shake it while
they were filling it? There could be all sorts of things that could make some variation here. And so, for the sake of argument, let's say that variation can be measured by standard deviation, it's 0.6 ounces. And let's say whoever
the bowl fillers are, they are also, they don't like bowls that
are too heavy or too light, and so they'll also throw out bowls, so we can say that Y can, its maximum value that it'll ever take on is five ounces and the minimum value that
it could ever take on, let's say, it is three ounces. So, given all of this information, what I wanna do is let's just say I take
a random box of Mathies and I take a random filled bowl, and I wanna think about
the combined weight in the closed box and the filled bowl. So, what I wanna think about is, really, X plus Y. I wanna think about the sum
of the random variables. So, in previous videos, we already know that the
expected value of this is just gonna be the sum
of the expected values of each of the random variables. So, it would be the expected value of X plus the expected value of Y, and so it'd be 16 plus four ounces, in this case, this would be equal to 20 ounces. But what about the variation? Can we just add up the
standard deviations? If I wanna figure out
the standard deviation of X plus Y, how can I do this? Well, it turns out that you can't just add up
the standard deviations, but you can add up the variances. So, it is the case that
the variance of X plus Y is equal to the variance of X plus the variance of Y. And so, this is gonna have
an X right over here, X, and then we have plus Y and our Y. And actually, both of these assume independent random variables. So, it assumes, assumes X and Y are independent, I'm gonna write it in caps. In a future video, I'm going to give you
hopefully a better intuition for why this must be true, that they are independent in order to make this claim right over here. I'm not going to prove it in this video, but we could build a
little bit of intuition. Here, for each of these random variables, we have a range of two ounces over which this random variable can take and that's true for both of them. But what about this sum? Well, this sum here could get as high as, so let me write it this way, so X plus Y, X plus Y, what's the maximum
value that it could take on? Well, if you get a heavy
version of each of these, then it's going to be 17 plus five. So, this has to be less than 22 ounces, that's going to be
greater than or equal to, well, what's the lightest
possible scenario? Well, if you get a 15 ouncer here and you get a three ouncer here, and it is 18 ounces. And so, notice, now, the variation for the sum is larger. We have a range that this
thing can take on now of four while the range for each of these was just two. Or another way you could think about it is these upper and lower ends of the range are further from the mean than these upper and
lower ends of the range were from their respective means. So, hopefully, this gives you an intuition for why this makes sense. Let me ask you another question: what if I were to say what about the variance, what about the variance of X minus Y? What would this be? Would you subtract the variances of each of the random variables here? Well, let's just do the
exact same exercise. Let's take X minus Y, X minus Y and think about it. What would be the lowest value that X minus Y could take on? Well, the lowest values, if you have a low X and you have a high Y, so it'd be 15 minus five, so this would be 10 right over here, that would be the lowest value that you could take on and what would be the highest value? Well, the highest values,
if you have a high X and a low Y, so 17 minus three is 14. So, notice, just as we saw in this case of the sum, even in the difference, your variability seems to have increased. This is still going to be, the extremes are still further than the mean of the difference, the mean of the difference
would be 16 minus four is 12. These extreme values are two away from 12. And this is just to give us an intuition. Once again, it's not a rigorous proof. So, it actually turns
out that in either case, when you're taking the
variance of X plus Y or X minus Y, you would sum the variances assuming X and Y are
independent variables. Now, with that out of the way, let's just calculate
the standard deviation of X plus Y. Well, we know this, let me just write it
using this sigma notation, so another way of writing
the variance of X plus Y is to write the standard deviation of X plus Y squared and that's going to be
equal to the variance of X plus the variance of Y. Now, what is the variance of X? Well, that's the standard
deviation of X squared, 0.8 squared, this is 0.64, 0.64. The standard deviation of Y is 0.6, you square it to get the variance, that's 0.36. You add these two up and you are going to get one. So, the variance of the sum is one, and then if you take the
square root of both of these, you get the standard deviation of the sum is also going to be one. And that just happened to work out because we're dealing with the
scenario where the variance, where the square root
of one is, well, one. So, this hopefully builds your intuition, whether we are adding or subtracting to independent random variables. The variance of that
sum or the difference, the variability will increase. In the next video, we'll go into some depth talking about getting an intuition for why independence is an important condition for making this statement, this claim.