Skip to content

Commit 51fa2b7

Browse files
fixes
1 parent 1dbe977 commit 51fa2b7

File tree

2 files changed

+122
-14
lines changed

2 files changed

+122
-14
lines changed

posts/clt-intuitive-derivation/index.qmd

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ draft: false
1717

1818
The **Central Limit Theorem (CLT)** answers an important question: Why does the **bell curve** (or Normal Distribution) show up everywhere in the real world?
1919

20-
![The Normal Distribution, showing the 68-95-99.7 rule.](images/normal_distribution.png){fig-alt="Normal Distribution bell curve diagram showing the 68-95-99.7 rule with standard deviations from the mean" width="60%"}
20+
![The Normal Distribution, showing the 68-95-99.7 rule.](images/normal_distribution.png){fig-alt="Normal Distribution bell curve diagram showing the 68-95-99.7 rule with standard deviations from the mean" width="600"}
2121

2222
Specifically, the theorem describes what happens when you take a random variable, $X$, and repeat the experiment many times to get a series of outcomes, $X_1, X_2, \dots, X_m$. What does the distribution of their **sum** ($S_m = X_1 + \dots + X_m$) or their **average** ($\bar{X}_m = S_m/m$) look like when $m$ is very large?
2323

@@ -41,35 +41,52 @@ The individual randomness gets "averaged out," and a predictable, universal shap
4141

4242
## **Encoding Probabilities (The PGF)**
4343

44-
First, we need a way to mathematically describe our single die. We'll package its probabilities into a special polynomial called a **Probability Generating Function (PGF)**. This isn't just a convenient trick; it's a cornerstone of **[combinatorics](https://en.wikipedia.org/wiki/Combinatorics)** for solving counting problems.
44+
To get to the heart of the Central Limit Theorem, we need a mathematical tool to describe what happens when we sum up many random variables, like the rolls of a die. Let's try to build such a tool from scratch.
4545

46-
### A gentler start: probabilities as polynomials
46+
The core challenge is this: when we add the scores from two dice, their outcomes *add*, but their independent probabilities *multiply*. How can we find a mathematical representation that captures this dual behavior?
4747

48-
Imagine you want to count the number of ways to form 10 Rupees using a collection of 1, 2, and 5 Rupee coins. This is a classic combinatorial problem. A powerful way to solve it is to represent the available coins as polynomials:
48+
Let's focus on the outcomes first. Suppose we represent an outcome value $a$ by $f(a)$. We want combining two outcomes $a$ and $b$ to correspond to the outcome $a+b$. If we combine representations by multiplying, then we require $f(a)\,f(b)=f(a+b)$.
49+
50+
This functional equation has a standard solution: take $f(a)=x^a$ for some base $x$. Then $x^a x^b = x^{a+b}$, exactly as required.
51+
52+
This gives us the key. We can represent an outcome $k$ with the term $x^k$. The variable $x$ is just a formal placeholder. Now, where do the probabilities fit in? A probability $p_k$ is the weight of the outcome $k$, so the most natural place to put it is as a coefficient: $p_k x^k$.
53+
54+
To represent the entire die, which can take on any of the values $\{1, 2, 3, 4, 5, 6\}$, we can simply sum up these weighted terms. This creates a polynomial, which packages all the information about our random variable into a single expression. This is the **Probability Generating Function (PGF)**.
55+
56+
For a discrete random variable $X$ that takes integer values with probabilities $p_k=\Pr(X=k)$, we formally define its PGF as:
57+
58+
$$H(x)=\sum_k p_k\,x^k.$$
59+
60+
Before applying this representation to dice, a quick analogy from counting clarifies why polynomials are the right container.
61+
62+
### A gentler start: an analogy from counting
63+
64+
Before diving deeper into probabilities, let's see this polynomial trick in a simpler context: counting combinations. This idea is a cornerstone of **[combinatorics](https://en.wikipedia.org/wiki/Combinatorics)** for solving counting problems.
65+
66+
Imagine you want to count the number of ways to form 10 Rupees using a collection of 1, 2, and 5 Rupee coins. This is a classic combinatorial problem. We can represent the available coins as polynomials:
4967

5068
- **1 Rupee Coins:** $(1 + x^1 + x^2 + \dots)$
5169
- **2 Rupee Coins:** $(1 + x^2 + x^4 + \dots)$
5270
- **5 Rupee Coins:** $(1 + x^5 + x^{10} + \dots)$
5371

5472
When you multiply these polynomials, voila! The coefficient of $x^{10}$ in the final product gives you the exact number of ways to make change for 10 Rupees.
5573

56-
Why does this work? The exponents *add*, just like the coin values do. The polynomial multiplication automatically explores every single combination of choices for you.
74+
Why does this work? The exponents *add*, just like the coin values do. The polynomial multiplication automatically explores every single combination of choices for you. A PGF does the exact same thing, but the coefficients are probabilities instead of just 1s for counting.
5775

58-
A PGF does the exact same thing, but for probabilities. For a discrete random variable $X$ that takes integer values with probabilities $p_k=\Pr(X=k)$, we define:
59-
$$H(z)=\sum_k p_k\,z^k.$$
76+
#### Why is this natural?
6077

61-
Why is this natural?
78+
- **Labels, not powers:** The exponent $k$ is just a label for the outcome $X=k$. The polynomial is a fancy storage system where the coefficient of $x^k$ holds the probability of the outcome $k$.
79+
- **Convolution by multiplication:** This is the killer feature. If $X$ and $Y$ are independent, the probability that $X+Y=n$ is found by summing over all pairs of outcomes that add to $n$: $\sum_k \Pr(X=k)\Pr(Y=n-k)$. This operation is called a **[convolution](https://en.wikipedia.org/wiki/Convolution)**. When you multiply the PGFs $H_X(x)$ and $H_Y(x)$, the rule for multiplying polynomials does *exactly the same calculation*. The coefficient of $x^n$ in the product is precisely that sum! So, for sums of independent variables, the PGF of the sum is the product of the PGFs:
80+
$$H_{X+Y}(x)=H_X(x)\,H_Y(x).$$
81+
- **From coins to dice:** For a biased coin where heads $=1$ and tails $=0$, with $\Pr(1)=p$, the PGF is $H(x) = (1-p)x^0 + px^1$. For two flips, the PGF is $H(x)^2 = (1-p)^2 + 2p(1-p)x^1 + p^2x^2$. The coefficients are the binomial probabilities! This idea scales perfectly to dice or any other discrete distribution.
6282

63-
- **Labels, not powers:** The exponent $k$ is just a label for the outcome $X=k$. The polynomial is a fancy storage system where the coefficient of $z^k$ holds the probability of the outcome $k$.
64-
- **Convolution by multiplication:** This is the killer feature. If $X$ and $Y$ are independent, the probability that $X+Y=n$ is found by summing over all pairs of outcomes that add to $n$: $\sum_k \Pr(X=k)\Pr(Y=n-k)$. This operation is called a **[convolution](https://en.wikipedia.org/wiki/Convolution)**. When you multiply the PGFs $H_X(z)$ and $H_Y(z)$, the rule for multiplying polynomials does *exactly the same calculation*. The coefficient of $z^n$ in the product is precisely that sum! So, for sums of independent variables, the PGF of the sum is the product of the PGFs:
65-
$$H_{X+Y}(z)=H_X(z)\,H_Y(z).$$
66-
- **From coins to dice:** For a biased coin where heads $=1$ and tails $=0$, with $\Pr(1)=p$, the PGF is $H(z) = (1-p)z^0 + pz^1$. For two flips, the PGF is $H(z)^2 = (1-p)^2 + 2p(1-p)z^1 + p^2z^2$. The coefficients are the binomial probabilities! This idea scales perfectly to dice or any other discrete distribution.
83+
For distributions that can take negative integer values, the PGF becomes a **[Laurent series](https://en.wikipedia.org/wiki/Laurent_series)** with negative powers, like $H(x) = \sum_{k=-\infty}^{\infty} p_k x^k$. All the logic, including the convolution property and the Cauchy integral extractor, works exactly the same!
6784

68-
For distributions that can take negative integer values, the PGF becomes a **[Laurent series](https://en.wikipedia.org/wiki/Laurent_series)** with negative powers, like $H(z) = \sum_{k=-\infty}^{\infty} p_k z^k$. All the logic, including the convolution property and the Cauchy integral extractor, works exactly the same!
85+
Let's now instantiate this for a fair six-sided die. To match common conventions in generatingfunctionology, we'll switch the placeholder from $x$ to $z$ when we write the die's blueprint $h(z)$ and use coefficient extraction $[z^n]$.
6986

7087
For a standard fair die, the outcomes are $\{1, 2, 3, 4, 5, 6\}$, each with probability $\tfrac{1}{6}$. The blueprint function is:
7188
$$
72-
h(z) = \frac{1}{6}z^1 + \frac{1}{6}z^2 + \frac{1}{6}z^3 + \frac{1}{6}z^4 + \frac{1}{6}z^5 + \frac{1}{6}z^6
89+
h(z) = \frac{1}{6}z^1 + \frac{1}{6}z^2 + \frac{1}{6}z^3 + \frac{1}{6}z^4 + \frac{1}{6}z^5 + \frac{1}{6}z^6
7390
$$
7491

7592
### **The Magic of Multiplication**

styles.css

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,6 +1576,97 @@ mjx-container, .MathJax {
15761576
animation: gradientShift 10s ease infinite;
15771577
}
15781578

1579+
/* Override Quarto's column-page-left positioning for title banner */
1580+
.quarto-title-banner .quarto-title.column-page-left,
1581+
.quarto-title-banner .quarto-title.column-page,
1582+
.quarto-title-banner .column-page-left,
1583+
.quarto-title-banner .column-page {
1584+
max-width: 100% !important;
1585+
width: 100% !important;
1586+
margin-left: 0 !important;
1587+
margin-right: 0 !important;
1588+
padding-left: 0 !important;
1589+
padding-right: 0 !important;
1590+
grid-column: 1 / -1 !important; /* Full width in grid */
1591+
}
1592+
1593+
/* Center the title content */
1594+
.quarto-title-banner .quarto-title {
1595+
display: flex !important;
1596+
flex-direction: column !important;
1597+
align-items: center !important;
1598+
text-align: center !important;
1599+
width: 100% !important;
1600+
max-width: 100% !important;
1601+
}
1602+
1603+
/* Ensure title banner children are centered */
1604+
.quarto-title-banner .quarto-title > * {
1605+
text-align: center !important;
1606+
margin-left: auto !important;
1607+
margin-right: auto !important;
1608+
}
1609+
1610+
/* Override page-columns container in banner */
1611+
.quarto-title-banner .page-columns,
1612+
.quarto-title-banner .quarto-title-banner-page-columns {
1613+
display: flex !important;
1614+
flex-direction: column !important;
1615+
align-items: center !important;
1616+
max-width: 100% !important;
1617+
width: 100% !important;
1618+
margin: 0 !important;
1619+
padding: 0 !important;
1620+
}
1621+
1622+
/* Fix post title alignment - Override column-body for posts */
1623+
.quarto-title-banner .quarto-title.column-body,
1624+
.quarto-title-banner .column-body,
1625+
.quarto-title.column-body {
1626+
max-width: 100% !important;
1627+
width: 100% !important;
1628+
margin-left: 0 !important;
1629+
margin-right: 0 !important;
1630+
padding-left: 0 !important;
1631+
padding-right: 0 !important;
1632+
display: flex !important;
1633+
flex-direction: column !important;
1634+
align-items: center !important;
1635+
text-align: center !important;
1636+
grid-column: 1 / -1 !important; /* Break out of grid */
1637+
}
1638+
1639+
/* Override the page-columns grid that contains the title */
1640+
.quarto-title-banner .page-columns {
1641+
display: flex !important;
1642+
flex-direction: column !important;
1643+
align-items: center !important;
1644+
grid-template-columns: none !important;
1645+
}
1646+
1647+
/* Specifically target column-body within page-columns */
1648+
.page-columns .column-body {
1649+
grid-column-start: unset !important;
1650+
grid-column-end: unset !important;
1651+
margin: 0 auto !important;
1652+
max-width: 100% !important;
1653+
}
1654+
1655+
/* Force title elements to center in post banners */
1656+
.quarto-title-banner .column-body h1.title,
1657+
.quarto-title-banner .column-body .subtitle,
1658+
.quarto-title-banner .column-body .lead {
1659+
text-align: center !important;
1660+
width: 100% !important;
1661+
}
1662+
1663+
/* Center categories in post banners */
1664+
.quarto-title-banner .column-body .quarto-categories {
1665+
display: flex !important;
1666+
justify-content: center !important;
1667+
width: 100% !important;
1668+
}
1669+
15791670
@keyframes gradientShift {
15801671
0%, 100% { background-position: 0% 50%; }
15811672
50% { background-position: 100% 50%; }

0 commit comments

Comments
 (0)