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.

## Statistics and probability

### Unit 9: Lesson 3

Transforming random variables

# Impact of transforming (scaling and shifting) random variables

AP.STATS:
VAR‑5 (EU)
,
VAR‑5.F (LO)
,
VAR‑5.F.1 (EK)
Linear transformations (addition and multiplication of a constant) and their impacts on center (mean) and spread (standard deviation) of a distribution.

## Want to join the conversation?

• I get why adding k to all data points would shift the prob density curve, but can someone explain why multiplying the data by a constant would stretch and squash the graph?
• Scaling a density function doesn't affect the overall probabilities (total = 1), hence the area under the function has to stay the same one.

If you multiply the random variable by 2, the distance between min(x) and max(x) will be multiplied by 2. Hence you have to scale the y-axis by 1/2.

For instance, if you've got a rectangle with x = 6 and y = 4, the area will be x*y = 6*4 = 24. If you multiply your x by 2 and want to keep your area constant, then x*y = 12*y = 24 => y = 24/12 = 2. Scaling the x by 2 = scaling the y by 1/2.

If you didn't scale down your y-axis, then your cumulative probabilities will be >1, which is not possible.
• Why does k shift the function to the right and not upwards?
• Because an upwards shift would imply that the probability density for all possible values of the random variable has increased (at all points). But this would consequently be increasing the area under the probability density function, which violates the rule that the area under any probability density function must be = 1 . Furthermore, the reason the shift is instead rightward (or it could be leftward if k is negative) is that the new random variable that's created simply has all of its initial possible values incremented by that constant k. 0 goes to 0+k. 1 goes to 1+k. 2 goes to 2+k, etc, but the associated probability density sort of just slides over to a new position without changing in its value.
• What if you scale a random variable by a negative value? If we scale multiply a standard deviation by a negative number we would get a negative standard deviation, which makes no sense. I think you should multiply the standard deviation by the absolute value of the scaling factor instead.
• @rdeyke Let's consider a Random Variable X with mean 2 and Variance 1 (Standard Deviation also natuarally is then 1).

The mean gets multiplied by the constant k, let's say it is -2. As originally, your mean was 2, now new mean would be -2*2 = -4

Next comes the Variance. Variance is scaled by k squared. Hence, it would be multiplied by (-2)^2 which is 4. The Standard Deviation is always the positive root of the Variance, and hence, the SD in this case would come out to be 2.
• What do the horizontal and vertical axes in the graphs respectively represent?
• The graphs are density curves that measure probability distribution.
The horizontal axis represents the random variable (e.g. X).
The vertical axis represents the probability outcome for each possible value of the random variable.
• In real life situation, when are people add a constant in to the random variable
• At , the graph of the variable Z is flatted because it was scaled up and must keep the same area. So how is it possible to Z have a bigger mean than X's one?
Sal says Z(mean) = k times X(mean)
• What does it mean adding k to the random variable X? Does it mean that we add k to all values X (i.e. possible outcomes of X)?
• I think that is a good question. I think since Y = X+k and Sal was saying that Y is also a random variable, the equation is meant to show that Y is an incremented version of X. For eg. If X was representing the amount of rain falling in April, Y would be the amount of rain in mm falling in April plus some constant number 'k', let's say the number is 2.5. Thus the normal distribution for X is shifted 2.5mm to the right. Hope this helps.
• In the second half, when we are scaling the random variable, what happens to the Y value when you scale it by multiplying it with k?
(1 vote)
• In the second half, Sal was actually scaling "X" by a value of "k". The resulting distribution was called "Y". If you scaled Y then you would get yet another "stretched" version of that graph (as relating to Y this time, not X).
(1 vote)
• So what happens to the function if you are multiplying X and also shifting it by addition?
(1 vote)
• What will happens if we apply the following expression to x:

y(i) = a * x(i) + (1-a) * y(i-1)

How can we analytically calculate the probability density function of y?
(1 vote)