If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

# Deriving the variance of the difference of random variables

Sal derives the variance of the difference of random variables. Created by Sal Khan.

## Want to join the conversation?

• At , shouldn't the formula for the variance be divided by n?
• Good question! The variance of a random variable is E[(X - mu)^2], as Sal mentions above. What you're thinking of is when we estimate the variance for a population [sigma^2 = sum of the squared deviations from the mean divided by N, the population size] or when estimating the variance for a sample [s^2 = sum of the squared deviations from the mean divided by n-1, where n = the sample size].

See here for more details: http://en.wikipedia.org/wiki/Variance
• how did he factor to get (-1)^2? for the variance at around ?
• Hi p1cony ,
to answer your question let me just make sure you get the basic idea of what he did
if we have an algabraic expression (numbers and variables multiplied together formig terms &the terms are separated by + or - signs) we can take a common factor by dividing each term by the common factor
for example : (5a+10b) = 5(a+2b)

if the algebric expression was squared we can still take a common factor but it'll have to be squared
for example : (5a+10b)^2 = ((5)^2) (a+2b)^2

another basic idea is that if we took (-1) as a common factor from an expression , it will change the sign ( if + becomes - and if - becomes +) of every term in that expression because its the same thing as dividig each term by (-1)
for example (5a+10b) = -1(-5a-10b)

so , what he did is just apply all of these basics in only .one step , he took a common factor (-1)^2 from a squared algebric expression
E((-Y-E(-Y))^2)= (-1)^2 * E((Y+E(-Y))^2)
• What is the video (if there's a video) in which they define the variance of X as the expected value of (X-Ux)^2 ?? It is not in the expected value video.
• At in the video Variance of a Population it is mentioned what variance is. He uses the capital sigma, which looks like an E, but it is the same idea.
• At , Sal defines Z=X+Y. What does it mean to add random variables? What are you adding together?

Thanks!
Beth
• This honestly confused me at first too, but a few weeks after learning this it seems so obvious :P

You are literally taking the result of one random variable, then adding it to the result of another. You can imagine this as rolling two die and then summing the results, or rolling a die then summing to the result either 7 or 65 based of whether a coin that you flipped was heads or tails, etc.
It's the individual results of two random events, converted into numbers, then added together.

The probability dist of the first random variable tells you the probability of each of the possible values of that variable, and the probability dist for the second ran variable does the same. But when you sum two random variables, you take an individual instance of both random variables (e.g. X = 2, Y = -33), and then literally sum them (X + Y, in this case, would be 2 + (-33) = -31).

I'm only spending so much time elaborating this bc I was confused on this too. If anyone else is still confused, you'll get it eventually ( -.-)b
• Is there some reason we are not dividing by n or (n-1) in the computation of variance--y'know--like we have been doing for the entire playlist. If its because E() imples this division, why are we not explicitily citing that?
• Expected value divides by n, assuming we're looking at a real dataset of n observations. But we might not be. For example, if a random variable x takes the value 1 in 30% of the population, and the value 0 in 70% of the population, but we don't know what n is, then E(x) = .3(1) + .7(0) = .3. No n is necessary if we have a probability mass function like this (or probability distribution function, for continuous random variables).
• How comes now that the Variance = E((X-mu)^2)? Didn't Sal say in a previous video that the Variance = P(X)(X-mu)^2?
Most of the Statistics & Probability course is really confusing so far... Didn't have this much struggle since the Integral course.
• I have the same question. Do you now know the answer to this?
• Can someone show me this with numbers please?

If you had two independent random variables X and Y. With X having a standard deviation of 19 and Y having a standard deviation of 6. How do you workout the diference X - Y?

Is it: 361 + 36 = 397

Then: sqroot397 = 19.9

??
• Yes, you are correct. If Z = X - Y
Then Var (Z) = Var (X) + Var (Y) [as shown above]
So Var (Z) = 19^2 + 6^2 = 361 + 36 = 397
And StandDev (Z) = SqRt( Var (Z) ) = SqRt ( 397) = 19.92
• Starting at ~, it is announced that E(-y) = -E(y), can you please prove this or point to a proof?
• E(-y) = E(0 - y) = E(0) - E(y) = -E(y).
• What was supposed to come before this video? I just watched through Hypothesis testing with one sample, and figured this one would follow directly from the ones before, but this Var stuff just sort of comes out of nowhere. A little framing would be nice.
• Before we can do hypothesis testing with two means, we need to know the variance of the difference of means. Looking at the sequence for Inferential Statistics (link below), it makes sense to me. It may seem a little odd at first, but just go with it, and things should fall into place in your head.