Combining Random Variables Visualizer
Run the Combining Random Variables Visualizer Fullscreen
Edit this MicroSim in the p5.js Editor
About This MicroSim
Here's one of the trickiest concepts in random variables: when you combine independent random variables, the means behave as expected (add for sum, subtract for difference), but the variances ALWAYS ADD - even when you're subtracting!
This visualization helps you see why this is true and builds intuition for how combined distributions look.
How to Use
- Drag the sliders to adjust the mean and standard deviation of X and Y
- Switch between Sum and Difference to see how the operation affects the result
- Watch the combined distribution update in real-time
- Study the calculation panel to see the formulas in action
The Key Insight
When combining independent random variables:
For Means:
- E(X + Y) = E(X) + E(Y)
- E(X - Y) = E(X) - E(Y)
For Variances:
- Var(X + Y) = Var(X) + Var(Y)
- Var(X - Y) = Var(X) + Var(Y) <- Same formula!
Why do variances add even when subtracting? Because variability comes from both sources, regardless of whether we're adding or subtracting. The uncertainty doesn't cancel out - it compounds!
Standard Deviation Formula
Since variances add, standard deviations combine "Pythagorean style":
This means the combined SD is always LESS than the sum of the individual SDs (unless one is zero).
Learning Objectives
After using this MicroSim, you'll be able to:
- Calculate the mean of a sum or difference of independent random variables
- Explain why variances add for both sums AND differences
- Compute the standard deviation of combined random variables
- Avoid the common mistake of thinking Var(X - Y) = Var(X) - Var(Y)
Lesson Plan
Introduction (3 minutes)
Ask: "If Quiz 1 has mean 75 and Quiz 2 has mean 80, what's the mean total score?" (Easy: 155) Then: "If the standard deviations are 10 and 12, what's the SD of the total?" (Tricky!)
Guided Exploration (10 minutes)
- Set both X and Y to have mean 50 and SD 10
- Observe the sum: mean = 100, but SD is NOT 20
- Calculate: SD = sqrt(100 + 100) = sqrt(200) = 14.14
- Switch to difference - mean changes to 0, but SD stays the same!
- This is the key insight: subtracting doesn't reduce variability
Common Misconception
Many students think:
- Var(X + Y) = Var(X) + Var(Y) (Correct)
- Var(X - Y) = Var(X) - Var(Y) (WRONG!)
The visualization makes it clear why this is wrong - when you take a difference, the uncertainty from both variables still contributes to the overall uncertainty.
Discussion Questions
- Why doesn't variability cancel when we subtract random variables?
- If X and Y have the same mean and SD, what is E(X - Y)? What is SD(X - Y)?
- Can the combined SD ever be larger than the sum of individual SDs?
Sylvia Says
"Think of it like noise - when you add two noisy signals, the noise combines. When you subtract two noisy signals, the noise STILL combines! That's why variances always add. SD follows the Pythagorean theorem - it's like the hypotenuse of a right triangle!"
Embedding This MicroSim
1 | |
Technical Notes
- Built with p5.js 1.11.10
- Uses canvas-based sliders and buttons
- Normal curves drawn using the PDF formula
- Responsive width design
- Drawing height: 400px, Control height: 100px
References
- Chapter 13: Random Variables
- Concepts: Combining Random Variables, Sum of Random Variables, Difference of RVs, Variance of Random Variable