From 4abdc6dda978afd7c3895ca757e303c501d46c66 Mon Sep 17 00:00:00 2001
From: andyeisenberg <125768484+andyeisenberg@users.noreply.github.com>
Date: Thu, 1 Jan 2026 14:07:45 +0000
Subject: [PATCH] A bit more variance
---
source/ch-Expected-Value.ptx | 56 ++++++++++++++++++++++++++++++++++--
1 file changed, 54 insertions(+), 2 deletions(-)
diff --git a/source/ch-Expected-Value.ptx b/source/ch-Expected-Value.ptx
index 38170fe..f9bf897 100644
--- a/source/ch-Expected-Value.ptx
+++ b/source/ch-Expected-Value.ptx
@@ -42,7 +42,8 @@
For example, the expected value of a fair 6-sided die roll R is:
- \E(R) = \frac{1 + 2 + \dotsb + 6}{6} = \frac{21}{6} = \frac{7}{2}.
+ \E(R) \amp = 1 \left(\frac{1}{6}\right) + 2 \left(\frac{1}{6}\right) + 3 \left(\frac{1}{6}\right) + 4 \left(\frac{1}{6}\right) + 5 \left(\frac{1}{6}\right) + 6 \left(\frac{1}{6}\right)
+ \amp = \frac{1 + 2 + \dotsb + 6}{6} = \frac{21}{6} = \frac{7}{2}.
@@ -196,7 +197,7 @@
So, both \sum x_i \Pr(X = x_i) and \int_a^b x f(x)\ dx should be understood as taking the products of values with their probabilities and then summing up those products.
-
+
Let X be uniform on the interval [a, b].
@@ -587,6 +588,57 @@
+
+
+
+ Let R be the value of a fair 6-sided die roll.
+ We've seen in that \E(R) = \frac{7}{2}.
+ To find \E\left(R^2\right):
+
+ \E\left(R^2\right) \amp = 1^2 \left(\frac{1}{6}\right) + 2^2 \left(\frac{1}{6}\right) + 3^2 \left(\frac{1}{6}\right) + 4^2 \left(\frac{1}{6}\right) + 5^2 \left(\frac{1}{6}\right) + 6^2 \left(\frac{1}{6}\right)
+ \amp = 1 \left(\frac{1}{6}\right) + 4 \left(\frac{1}{6}\right) + 9 \left(\frac{1}{6}\right) + 16 \left(\frac{1}{6}\right) + 25 \left(\frac{1}{6}\right) + 36 \left(\frac{1}{6}\right)
+ \amp = \frac{91}{6}.
+
+ Then
+
+ \Var(R) = \E\left(R^2\right) - \left(\E(R)\right)^2 = \frac{91}{6} - \frac{49}{4} = \frac{35}{12}.
+
+
+
+
+
+
+ Notice that in the \E\left(R^2\right) calculation, we're just taking the basic structure of the \E(R) calculation and squaring the R values.
+ The analogous calculation for a continuous random variable looks similar:
+
+
+
+
+
+ Let X be uniform on the interval [a, b].
+ So X has the pdf f(x) = \frac{1}{b - a}, and we saw in that \E(X) = \frac{a + b}{2}.
+ Now:
+
+ \E\left(X^2\right) \amp = \int_a^b x^2 f(x)\ dx
+ \amp = \int_a^b \frac{x^2}{b - a} \ dx
+ \amp = \frac{1}{b-a} \left(\frac{x^3}{3}\right)\bigg|_a^b
+ \amp = \frac{1}{b-a} \left( \frac{b^3}{3} - \frac{a^3}{3} \right)
+ \amp = \frac{1}{b - a}\left( \frac{(b - a)(a^2 + ab + b^2)}{3}\right)
+ \amp = \frac{a^2 + ab + b^2}{3}.
+
+ Then:
+
+ \Var(X) \amp = \E\left(X^2\right) - \left(\E(X)\right)^2
+ \amp = \frac{a^2 + ab + b^2}{3} - \frac{(a+b)^2}{4}
+ \amp = \frac{a^2 + ab + b^2}{3} - \frac{a^2 + 2ab + b^2}{4}
+ \amp = \frac{4a^2 + 4ab + 4b^2}{12} - \frac{3a^2 + 6ab + 3b^2}{12}
+ \amp = \frac{a^2 - 2ab + b^2}{12}
+ \amp = \frac{(a - b)^2}{12}.
+
+
+
+
+