Mathematical Foundations

IV.16 · Probability

How can averages of a skewed source acquire a nearly Gaussian shape?

Generate many independent sample blocks, retain their actual observations, and standardize their means. Change block size and repetition count separately to distinguish limiting shape from histogram noise.

Watch repeated means change shape

Original Exponential(rate 1) population · PDF density
Original Exponential(rate 1) population · PDF densityIdeal exponential population. Mean 1, variance 1. The pseudo-random experiment approximates this mathematical sampling model.1.150246

One observation X · nonnormal, right-skewed density · positive tail beyond 6 has mass e⁻⁶ ≈ 0.00247875

Standardized sample means · histogram density and dashed normal reference
Standardized sample means · histogram density and dashed normal reference240 iid-model sample means, n=8, seed 42. Histogram mass inside [−4,4) is 1, with 0 below and 0 at or above the window. Each sample uses its own next n draws from one deterministic pseudo-random stream, approximating the iid model. A finite sampling distribution is not exactly Gaussian. Centered standardized means use sqrt(n)(mean−μ)/σ. Histogram density divides each count by all 240 repetitions and bin width 1/3; tails are not renormalized away.0.531875-3.833333333333333: approximately 0-3.5: approximately 0-3.166666666666667: approximately 0-2.8333333333333335: approximately 0-2.5: approximately 0-2.166666666666667: approximately 0.0125-1.8333333333333335: approximately 0.0375-1.5000000000000002: approximately 0.1-1.1666666666666667: approximately 0.25-0.8333333333333335: approximately 0.3875-0.5000000000000002: approximately 0.3125-0.16666666666666674: approximately 0.46250.16666666666666652: approximately 0.3250.49999999999999956: approximately 0.350.833333333333333: approximately 0.23751.1666666666666665: approximately 0.16251.4999999999999996: approximately 0.11251.833333333333333: approximately 0.12.1666666666666665: approximately 0.0752.4999999999999996: approximately 0.0252.833333333333333: approximately 0.0253.1666666666666665: approximately 0.01253.4999999999999996: approximately 0.01253.833333333333333: approximately 0-4-2024

z = √n(mean−μ)/σ · bar area is observed fraction · normal reference has theoretical variance one

Inspect the first three actual samples
Sample 1 · 8 observations

0.290814, 0.0922524, 0.861048, 0.251741, 0.471061, 0.025999, 0.592906, 0.126085

Sum ≈ 2.71191; mean ≈ 0.338988; standardized mean -1.86962

Sample 2 · 8 observations

2.07, 5.22772, 1.9187, 0.692501, 1.02722, 1.97657, 0.907504, 0.0951354

Sum ≈ 13.9154; mean ≈ 1.73942; standardized mean 2.09139

Sample 3 · 8 observations

0.151067, 2.9975, 2.58436, 2.20246, 0.799638, 0.199081, 0.798698, 0.29971

Sum ≈ 10.0325; mean ≈ 1.25406; standardized mean 0.7186

Below −4= 0
Inside [−4,4)= 1
At or above 4= 0

The model samples iid observations using successive seeded pseudo-random draws. A simulation is an illustration, not a proof of convergence.

240 iid-model sample means, n=8, seed 42. Histogram mass inside [−4,4) is 1, with 0 below and 0 at or above the window. Each sample uses its own next n draws from one deterministic pseudo-random stream, approximating the iid model. A finite sampling distribution is not exactly Gaussian. Centered standardized means use sqrt(n)(mean−μ)/σ. Histogram density divides each count by all 240 repetitions and bin width 1/3; tails are not renormalized away.

Original population mean
1
Original population variance
1
Mean variance under iid assumptions
0.125
Mean variance in this sampling design
0.125
Observed average of repeated means
1.029629
Empirical spread of repeated means (divide by R)
0.131213
Observed histogram area inside window
1

= exact model quantity · ≈ numerical companion or observed estimate

from 0 to 4294967295, whole numbers only

from 1 to 100, whole numbers only

from 10 to 1000, whole numbers only

240 iid-model sample means, n=8, seed 42. Histogram mass inside [−4,4) is 1, with 0 below and 0 at or above the window. Each sample uses its own next n draws from one deterministic pseudo-random stream, approximating the iid model. A finite sampling distribution is not exactly Gaussian.
E[X‾n]=μ=1,Var⁡iid(X‾n)=σ2n=0.125E[\overline X_n]=\mu=1,\quad\operatorname{Var}_{\mathrm{iid}}(\overline X_n)=\frac{\sigma^2}{n}=0.125
n(X‾n−μ)σ→dN(0,1)for iid, 0<σ2<∞\frac{\sqrt n(\overline X_n-\mu)}{\sigma}\xrightarrow{d}\mathcal N(0,1)\quad\text{for iid, }0<\sigma^2<\infty
hj=countjR Δz,Δz=13h_j=\frac{\mathrm{count}_j}{R\,\Delta z},\quad\Delta z=\frac13

Specify the original nonnormal population

Mean 1, variance 1. Each sample uses its own next n draws from one deterministic pseudo-random stream, approximating the iid model. A finite sampling distribution is not exactly Gaussian.

E[X]=1,Var⁡(X)=1E[X]=1,\quad\operatorname{Var}(X)=1

Compare a non-Gaussian population, actual sample blocks, repeated sample means, and their standardized histogram beside a standard-normal reference. Increase n separately from repetitions.

Predict which control changes the finite-sample mean distribution and which mainly changes how noisily its histogram estimates it. Inspect the first sample blocks before trusting the bell-shaped picture.

Intuition: study many means, not one running path

The previous chapter followed a single growing average. Here we repeatedly draw blocks of the same size nn and calculate one mean per block. Their collection has a distribution of its own. The source can remain skewed while the standardized mean distribution becomes more nearly Gaussian as nn grows.

A raw mean’s spread shrinks with nn. To compare shape across block sizes, remove its theoretical center and divide by its theoretical standard deviation. This standardization keeps the reference spread fixed; it does not force observed bars to match a normal curve.

Definition

Let X1,X2,…X_1,X_2,\ldots be iid with finite mean μ\mu and finite positive variance σ2\sigma^2. For the mean of a block of size nn, define

Zn=Xˉn−μσ/n=∑j=1nXj−nμσn.Z_n=\frac{\bar X_n-\mu}{\sigma/\sqrt n} =\frac{\sum_{j=1}^nX_j-n\mu}{\sigma\sqrt n}.

The classical Central Limit Theorem states Zn→dN(0,1)Z_n\xrightarrow{d}\mathcal N(0,1). Convergence in distribution means that, at every real zz here, P(Zn≤z)\mathbb P(Z_n\leq z) tends to the standard-normal CDF Φ(z)\Phi(z). It does not make finite-nn observations exactly Gaussian or specify a universal accuracy threshold such as n=30n=30.

If σ2=0\sigma^2=0, the source is constant almost surely and this standardization is undefined. A normal overlay must not be presented as a valid standardized limit in that state.

Mechanics: one stream, contiguous sample blocks

Choose Bernoulli, Uniform[0,1)[0,1), or rate-11 exponential observations. All have known finite moments; the exponential source supplies a clearly nonnormal skewed population. Block size ranges from 11 to 100100, and repetitions from 1010 to 10001000, bounding an iid run at 100000100000 draws.

The canonical run uses the rate-11 exponential source, seed 4242, block size n=8n=8, and 240240 repetitions. A uint32 seed drives the same explicit LCG used in the LLN chapter. Each iid block consumes its own contiguous portion of one stream. Open the sample details to inspect the first three complete actual samples retained along with their sums and means; all repeated means are standardized using the population moments. Reset restores canonical parameters, and replay reproduces the full run.

The dependence preset uses a uniform source and repeats one draw throughout each block. Its displayed iid standardization is explicitly a violated reference. In that example the block mean is just the single draw and the correct mean variance is σ2\sigma^2, not σ2/n\sigma^2/n.

Derivation: why the center and scale take this form

Under iid assumptions, linearity and zero cross-covariances give

E[Xˉn]=μ,Var⁡(Xˉn)=σ2n.\mathbb E[\bar X_n]=\mu,\qquad \operatorname{Var}(\bar X_n)=\frac{\sigma^2}{n}.

Subtracting μ\mu centers the mean, and division by σ/n\sigma/\sqrt n gives E[Zn]=0\mathbb E[Z_n]=0 and Var⁡(Zn)=1\operatorname{Var}(Z_n)=1. These moment identities explain the scaling but do not prove the Gaussian limit. Many nonnormal distributions also have mean zero and variance one; convergence in distribution is the additional theorem.

An equivalent sum formulation subtracts nμn\mu and divides by σn\sigma\sqrt n. Confusing sum and mean scales changes the variance of the standardized result and can create a misleadingly narrow or wide histogram.

Worked examples

Four rate-11 exponential observations with sum 66 have mean 3/23/2. Their population mean and standard deviation are both 11, so

Z4=4(32−1)=1.Z_4=\sqrt4\left(\frac32-1\right)=1.

This is one standardized mean, not a proof about its distribution. For Bernoulli probability 1/41/4 and n=100n=100, the repeated means have theoretical expectation 1/41/4 and variance 3/16003/1600.

Worked example: Watch repeated means change shape

Original Exponential(rate 1) population · PDF density
Original Exponential(rate 1) population · PDF densityIdeal exponential population. Mean 1, variance 1. The pseudo-random experiment approximates this mathematical sampling model.1.150246

One observation X · nonnormal, right-skewed density · positive tail beyond 6 has mass e⁻⁶ ≈ 0.00247875

Standardized sample means · histogram density and dashed normal reference
Standardized sample means · histogram density and dashed normal reference240 iid-model sample means, n=8, seed 42. Histogram mass inside [−4,4) is 1, with 0 below and 0 at or above the window. Each sample uses its own next n draws from one deterministic pseudo-random stream, approximating the iid model. A finite sampling distribution is not exactly Gaussian. Centered standardized means use sqrt(n)(mean−μ)/σ. Histogram density divides each count by all 240 repetitions and bin width 1/3; tails are not renormalized away.0.531875-3.833333333333333: approximately 0-3.5: approximately 0-3.166666666666667: approximately 0-2.8333333333333335: approximately 0-2.5: approximately 0-2.166666666666667: approximately 0.0125-1.8333333333333335: approximately 0.0375-1.5000000000000002: approximately 0.1-1.1666666666666667: approximately 0.25-0.8333333333333335: approximately 0.3875-0.5000000000000002: approximately 0.3125-0.16666666666666674: approximately 0.46250.16666666666666652: approximately 0.3250.49999999999999956: approximately 0.350.833333333333333: approximately 0.23751.1666666666666665: approximately 0.16251.4999999999999996: approximately 0.11251.833333333333333: approximately 0.12.1666666666666665: approximately 0.0752.4999999999999996: approximately 0.0252.833333333333333: approximately 0.0253.1666666666666665: approximately 0.01253.4999999999999996: approximately 0.01253.833333333333333: approximately 0-4-2024

z = √n(mean−μ)/σ · bar area is observed fraction · normal reference has theoretical variance one

Inspect the first three actual samples
Sample 1 · 8 observations

0.290814, 0.0922524, 0.861048, 0.251741, 0.471061, 0.025999, 0.592906, 0.126085

Sum ≈ 2.71191; mean ≈ 0.338988; standardized mean -1.86962

Sample 2 · 8 observations

2.07, 5.22772, 1.9187, 0.692501, 1.02722, 1.97657, 0.907504, 0.0951354

Sum ≈ 13.9154; mean ≈ 1.73942; standardized mean 2.09139

Sample 3 · 8 observations

0.151067, 2.9975, 2.58436, 2.20246, 0.799638, 0.199081, 0.798698, 0.29971

Sum ≈ 10.0325; mean ≈ 1.25406; standardized mean 0.7186

Below −4= 0
Inside [−4,4)= 1
At or above 4= 0

The model samples iid observations using successive seeded pseudo-random draws. A simulation is an illustration, not a proof of convergence.

240 iid-model sample means, n=8, seed 42. Histogram mass inside [−4,4) is 1, with 0 below and 0 at or above the window. Each sample uses its own next n draws from one deterministic pseudo-random stream, approximating the iid model. A finite sampling distribution is not exactly Gaussian. Centered standardized means use sqrt(n)(mean−μ)/σ. Histogram density divides each count by all 240 repetitions and bin width 1/3; tails are not renormalized away.

Original population mean
1
Original population variance
1
Mean variance under iid assumptions
0.125
Mean variance in this sampling design
0.125
Observed average of repeated means
1.029629
Empirical spread of repeated means (divide by R)
0.131213
Observed histogram area inside window
1

= exact model quantity · ≈ numerical companion or observed estimate

from 0 to 4294967295, whole numbers only

from 1 to 100, whole numbers only

from 10 to 1000, whole numbers only

240 iid-model sample means, n=8, seed 42. Histogram mass inside [−4,4) is 1, with 0 below and 0 at or above the window. Each sample uses its own next n draws from one deterministic pseudo-random stream, approximating the iid model. A finite sampling distribution is not exactly Gaussian.
E[X‾n]=μ=1,Var⁡iid(X‾n)=σ2n=0.125E[\overline X_n]=\mu=1,\quad\operatorname{Var}_{\mathrm{iid}}(\overline X_n)=\frac{\sigma^2}{n}=0.125
n(X‾n−μ)σ→dN(0,1)for iid, 0<σ2<∞\frac{\sqrt n(\overline X_n-\mu)}{\sigma}\xrightarrow{d}\mathcal N(0,1)\quad\text{for iid, }0<\sigma^2<\infty
hj=countjR Δz,Δz=13h_j=\frac{\mathrm{count}_j}{R\,\Delta z},\quad\Delta z=\frac13

Specify the original nonnormal population

Mean 1, variance 1. Each sample uses its own next n draws from one deterministic pseudo-random stream, approximating the iid model. A finite sampling distribution is not exactly Gaussian.

E[X]=1,Var⁡(X)=1E[X]=1,\quad\operatorname{Var}(X)=1

Inspect actual blocks, their means, and standardized values. Compare small and larger n for a skewed source, then change repetitions while preserving the finite-n theoretical distribution.

For a fixed-window histogram with 12001200 repetitions, a width-1/31/3 bin containing 6060 observations has density 60/(1200×1/3)=3/2060/(1200\times1/3)=3/20 and area 1/201/20. If 11401140 observations lie inside the window, the displayed histogram area is 19/2019/20; the remaining empirical mass 1/201/20 belongs to separately reported tails.

Executable reference code

The standard-library program generates contiguous sample blocks, retains three actual samples, computes sums and means, and handles zero variance explicitly. It verifies literal seeded blocks, replay, dependence, count conservation, and the full bounded workload without requiring favorable random agreement with the normal reference.

The NumPy program exposes a two-dimensional block array and averages along its sample axis. Its histogram first filters to the declared half-open window: NumPy otherwise includes the final right edge in the last bin. It divides counts by all repetitions and bin width, avoiding density=True renormalization of retained observations.

code/python/probability_clt.py
"""Bounded repeated means, honest fixed-window density, and an iid counterexample."""
from math import erfc
from math import log1p, sqrt


def uniforms(seed):
    if type(seed) is not int or not 0 <= seed <= 0xffffffff:
        raise ValueError("Seed must be a uint32 integer")
    state=seed
    while True:
        state=(1664525*state+1013904223)&0xffffffff
        yield state/4294967296


def population(source, p=50):
    if source not in ('bernoulli','uniform','exponential'):
        raise ValueError("Unknown population")
    if isinstance(p,bool) or not isinstance(p,(int,float)) or not 0 <= p <= 100 or abs(p*100-round(p*100))>1e-8:
        raise ValueError("Probability percent must be in [0,100] with at most two decimals")
    q=p/100
    mean,variance={'bernoulli':(q,q*(1-q)),'uniform':(.5,1/12),'exponential':(1.,1.)}[source]
    draw=lambda u: float(u<q) if source=='bernoulli' else u if source=='uniform' else -log1p(-u)
    return mean,variance,draw


def experiment(source='exponential',p=50,seed=42,n=8,reps=240,dependent=False):
    if type(n) is not int or not 1<=n<=100 or type(reps) is not int or not 10<=reps<=1000:
        raise ValueError("Require n in [1,100] and repetitions in [10,1000]")
    if type(dependent) is not bool:
        raise ValueError("Dependent flag must be boolean")
    mu,variance,draw=population(source,p)
    rng=uniforms(seed)
    means,sums,first=[],[],[]
    for rep in range(reps):
        if dependent:
            sample=[draw(next(rng))]*n
        else:
            sample=[draw(next(rng)) for _ in range(n)]
        if rep<3:
            first.append(sample)
        total=sum(sample)
        sums.append(total)
        means.append(total/n)
    if variance==0:
        return means,sums,first,None,None,None,None,variance
    z=[sqrt(n)*(x-mu)/sqrt(variance) for x in means]
    counts=[0]*24
    under=over=0
    for value in z:
        if value < -4:
            under+=1
        elif value >= 4:
            over+=1
        else:
            counts[min(23,int((value+4)*3))]+=1
    width=1/3
    density=[count/(reps*width) for count in counts]
    assert sum(counts)+under+over==reps
    assert abs(sum(density)*width-sum(counts)/reps)<1e-14
    actual_mean_variance=variance if dependent else variance/n
    return means,sums,first,z,counts,density,(under,over),actual_mean_variance


def main():
    r=experiment(n=1,reps=10,source='bernoulli')
    assert r[2]==[[1.],[1.],[0.]] and r[3][:3]==[1.,1.,-1.]
    assert r==experiment(n=1,reps=10,source='bernoulli')
    paired=experiment(n=2,reps=10,source='bernoulli')
    assert paired[2][0]==[1.,1.] and paired[2][1]==[0.,1.]
    assert experiment(p=0,source='bernoulli')[3] is None
    assert experiment(p=100,source='bernoulli')[4] is None
    dependent=experiment(n=10,reps=10,source='bernoulli',dependent=True)
    assert all(len(set(sample))==1 for sample in dependent[2])
    assert dependent[-1]==.25  # Not .25/10: the entries are perfectly dependent.
    assert 2*(1-.5*erfc(-4/sqrt(2)))>0  # Normal tails are small but nonzero.
    for source in ('bernoulli','uniform','exponential'):
        for n in (1,100):
            r=experiment(source,n=n,reps=1000)
            assert len(r[0])==1000 and len(r[2][0])==n
            assert sum(r[4])+sum(r[6])==1000
    for kwargs in ({'n':0},{'n':101},{'reps':9},{'reps':1001},{'seed':-1}):
        try:
            experiment(**kwargs)
        except ValueError:
            pass
        else:
            raise AssertionError("Invalid experiment accepted")
    print("First actual samples:",paired[2],"means:",paired[0][:3])
    print("Bin density = count/(all repetitions × width); omitted tails stay visible.")
    print("Increase n to study CLT shape; repetitions reduce histogram noise.")
    print("Zero variance: no standardization. Dependent blocks: no iid CLT claim.")


if __name__=='__main__':
    main()
code/python/probability_clt_numpy.py
"""NumPy blocks and histogram; the upper endpoint 4 belongs to overflow."""
import numpy as np
from math import log1p, sqrt


def uniforms(seed):
    if type(seed) is not int or not 0 <= seed <= 0xffffffff:
        raise ValueError("Seed must be a uint32 integer")
    state=seed
    while True:
        state=(1664525*state+1013904223)&0xffffffff
        yield state/4294967296


def population(source, p=50):
    if source not in ('bernoulli','uniform','exponential'):
        raise ValueError("Unknown population")
    if isinstance(p,bool) or not isinstance(p,(int,float)) or not 0 <= p <= 100 or abs(p*100-round(p*100))>1e-8:
        raise ValueError("Probability percent must be in [0,100] with at most two decimals")
    q=p/100
    mean,variance={'bernoulli':(q,q*(1-q)),'uniform':(.5,1/12),'exponential':(1.,1.)}[source]
    draw=lambda u: float(u<q) if source=='bernoulli' else u if source=='uniform' else -log1p(-u)
    return mean,variance,draw


def experiment(source='exponential',p=50,seed=42,n=8,reps=240,dependent=False):
    if type(n) is not int or not 1<=n<=100 or type(reps) is not int or not 10<=reps<=1000 or type(dependent) is not bool:
        raise ValueError("Require bounded integer n/reps and a boolean dependence flag")
    mu,variance,_=population(source,p)
    draws=reps if dependent else n*reps
    u=np.fromiter(uniforms(seed),dtype=float,count=draws)
    x=(u<p/100).astype(float) if source=='bernoulli' else u if source=='uniform' else -np.log1p(-u)
    blocks=np.repeat(x[:,None],n,axis=1) if dependent else x.reshape(reps,n)
    means=blocks.mean(axis=1)
    sums=blocks.sum(axis=1)
    if variance==0:
        return means,sums,blocks[:3],None,None,None,None,variance
    z=np.sqrt(n)*(means-mu)/np.sqrt(variance)
    inside=(z>=-4)&(z<4)
    edges=np.linspace(-4,4,25)
    counts,_=np.histogram(z[inside],bins=edges)
    density=counts/(reps*(1/3))  # density=True would incorrectly renormalize retained data.
    tails=(int(np.sum(z < -4)),int(np.sum(z >= 4)))
    assert int(counts.sum())+sum(tails)==reps
    np.testing.assert_allclose(np.sum(density)/3,np.mean(inside),rtol=0,atol=1e-14)
    return means,sums,blocks[:3],z,counts,density,tails,variance if dependent else variance/n


def main():
    r=experiment(source='bernoulli',n=1,reps=10)
    np.testing.assert_array_equal(r[2],[[1],[1],[0]])
    np.testing.assert_array_equal(r[3][:3],[1,1,-1])
    np.testing.assert_array_equal(r[0],experiment(source='bernoulli',n=1,reps=10)[0])
    pair=experiment(source='bernoulli',n=2,reps=10)
    np.testing.assert_array_equal(pair[2][:2],[[1,1],[0,1]])
    assert experiment(source='bernoulli',p=0)[3] is None
    dependent=experiment(source='bernoulli',n=10,reps=10,dependent=True)
    assert np.all(dependent[2]==dependent[2][:,:1]) and dependent[-1]==.25
    for source in ('bernoulli','uniform','exponential'):
        for n in (1,100):
            r=experiment(source,n=n,reps=1000)
            assert len(r[0])==1000 and int(r[4].sum())+sum(r[6])==1000
            np.testing.assert_allclose(r[1]/n,r[0],rtol=0,atol=1e-14)
    # np.histogram includes the final right edge; filter it out explicitly first.
    boundary=np.array([-5.,-4.,0.,4.,5.])
    kept=boundary[(boundary>=-4)&(boundary<4)]
    counts,_=np.histogram(kept,bins=np.linspace(-4,4,25))
    assert counts.sum()==2 and np.sum(boundary>=4)==2 and np.sum(boundary < -4)==1
    for kwargs in ({'n':0},{'reps':9},{'seed':2**32},{'p':float('inf')}):
        try:
            experiment(**kwargs)
        except ValueError:
            pass
        else:
            raise AssertionError("Invalid experiment accepted")
    print("Actual repeated means ≈",pair[0][:6],"first samples:",pair[2])
    print("Finite-n Bernoulli means remain on a lattice, however many repetitions are drawn.")
    print("Classical iid CLT requires finite positive variance; Cauchy does not qualify.")


if __name__=='__main__':
    main()

Explore

Start with a skewed exponential source and n=1n=1. Predict its standardized shape, then increase nn while checking the actual first sample blocks. Look for reduced skew without assuming the noisy histogram must improve monotonically at every chosen size.

Compare the short preset at n=1n=1 with the large preset at n=30n=30, then hold nn fixed and increase repetitions. The theoretical mean distribution stays the same; its empirical histogram becomes a better estimate, subject to sampling variation. Switch to Bernoulli: finite-nn means remain on a lattice. More repetitions reveal that lattice more clearly rather than turning it into a continuous distribution.

Inspect the dependence example and compare its actual mean variance with the iid reference. At Bernoulli probability 00 or 11, identify the zero denominator and explain why there are deterministic means but no defined standardized histogram.

Common mistakes and counterexamples

The LLN concerns a mean approaching its target; the CLT concerns the distribution of its centered, rescaled fluctuations. Neither says the original observations become Gaussian. The population plot remains a separate object throughout the experiment.

Perfect within-block dependence breaks the iid variance calculation. If every entry equals YY, then Xˉn=Y\bar X_n=Y and the iid reference n(Y−μ)/σ\sqrt n(Y-\mu)/\sigma has variance nn, not 11. An iid Cauchy population violates the classical theorem’s finite-variance and finite-mean assumptions; averaging it does not justify this Gaussian standardization.

There is no universal finite sample size at which every source becomes “normal enough.” Tail behavior, skew, event of interest, and desired accuracy matter. One seeded histogram supplies an illustration rather than evidence that all theorem assumptions hold or that an asymptotic approximation is accurate for a particular application.

Numerical considerations

The stage uses 2424 equal-width bins on [−4,4)[-4,4), each of width 1/31/3. Values below −4-4 and values at or above 44 are counted separately. Bin density is

hk=ckRΔ,∑khkΔ=RinsideR,h_k=\frac{c_k}{R\Delta},\qquad \sum_kh_k\Delta=\frac{R_{\mathrm{inside}}}{R},

where RR is all repetitions and Δ\Delta is bin width. The histogram area is the retained empirical fraction, not automatically one. The analytic standard-normal reference is normalized over the entire real line and has positive tail mass outside every finite window; its omitted mass beyond ±4\pm4 is approximately 0.0000633424840.000063342484.

The normal overlay uses the Gaussian density and CDF policy from the preceding distribution chapter; CDF approximations have a stated absolute error budget of 10−910^{-9}, so a difference has budget 2×10−92\times10^{-9}. This numerical error is separate from Monte Carlo noise, finite-nn approximation error, binning, finite drawing bounds, and pseudo-random stream limitations. None is removed by aligning plotted heights manually.

Engineering and ML connections

The CLT motivates approximate Gaussian descriptions of accumulated independent finite-variance noise and some Monte Carlo estimation errors. The raw average’s standard-deviation scale is σ/n\sigma/\sqrt n; using it requires checking the dependence and moment assumptions, and the approximation’s usefulness depends on the event being estimated.

Batch averages in learning systems often contain correlated observations, and heavy-tailed quantities can violate classical assumptions. The normal reference is a model to assess, not a consequence of drawing a smooth curve over data. Statistical confidence procedures build additional decisions on this probability foundation in the next part of the book.

Exercises

Calculate standardization and histogram area exactly where possible. Explain what each sampling control changes and which assumption a counterexample violates.

calculation

Center and scale a repeated mean

Four iid exponential rate-1 observations have sum 6. Population μ = 1 and σ = 1. Give their mean and z = √n(mean − μ)/σ.

calculation

Predict the repeated-mean distribution

For independent Bernoulli(1/4) draws and block size n=100, give E[mean] and Var(mean).

calculation

Preserve histogram tail mass

Use 1200 repetitions and 24 bins on [−4,4), each of width 1/3. One bin contains 60 standardized means; 1140 means lie inside the window. Give that bin density, its area, total displayed histogram area, and omitted empirical mass.

explanation

Separate n from repetitions

The source is Bernoulli with probability 1/4. Which change targets the standardized mean’s asymptotic shape rather than only histogram noise?

Choose one answer

explanation

Recognize a dependence counterexample

Each block repeats a single random draw n times. A graph still computes the iid reference z. What can be claimed?

Choose one answer

Summary and checkpoints

The classical iid CLT standardizes repeated means using finite positive population variance and describes their limiting distribution. Check that you can recover a standardized value from an actual sum, separate n from repetitions, preserve histogram tail mass, handle zero variance and dependence, and keep one finite simulation distinct from a theorem.

The map of the book

97 of 97 chapters written · eight Parts

demo Foundation demo Try the live vector example Open as a page

Part I

Mathematical Language

The notation and mental objects everything else uses.

9 of 9 chapters written

  1. I.1 Scalars, quantities, units, powers and roots available
  2. I.2 Coordinates and points available
  3. I.3 Vectors: components, magnitude, and direction reference chapter available
  4. I.4 Algebraic expressions, equations and inequalities available
  5. I.5 Functions as input → transformation → output available
  6. I.6 Essential function families available
  7. I.7 Sets, intervals, and relations available
  8. I.8 Indexed quantities and summation available
  9. I.9 The notation map for ML available

Part II

Linear Algebra

Matrices as transformations: the strongest foundation in the book.

19 of 19 chapters written

  1. II.1 Vector addition and subtraction available
  2. II.2 Scalar multiplication and vector scaling available
  3. II.3 Norms, magnitude, and normalization available
  4. II.4 Dot product, angle, and orthogonality available
  5. II.5 Projection and distance to a direction available
  6. II.6 Linear combinations and span available
  7. II.7 Linear independence, basis, and coordinates available
  8. II.8 Matrices as linear transformations available
  9. II.9 Matrix × vector available
  10. II.10 Matrix × matrix as composition available
  11. II.11 Transpose and orthogonality available
  12. II.12 Determinant: orientation and area/volume scaling available
  13. II.13 Linear systems as intersecting constraints available
  14. II.14 Gaussian elimination and row operations available
  15. II.15 Rank and invertibility available
  16. II.16 Inverse matrices available
  17. II.17 Eigenvalues and eigenvectors available
  18. II.18 Orthogonal bases and least-squares geometry available
  19. II.19 Singular Value Decomposition available

Part III

Calculus

Change, local approximation, and sensitivity made visible.

15 of 15 chapters written

  1. III.1 Limits through approach available
  2. III.2 Continuity and local behavior available
  3. III.3 Derivative as secant → tangent available
  4. III.4 Derivative as rate of change and local linear model available
  5. III.5 Derivative rules available
  6. III.6 Chain rule available
  7. III.7 Multivariable functions and partial derivatives available
  8. III.8 Gradient and directional derivatives available
  9. III.9 Jacobian available
  10. III.10 Computational graphs and automatic differentiation available
  11. III.11 Hessian and curvature available
  12. III.12 Integrals as accumulation available
  13. III.13 Fundamental derivative/integral connection available
  14. III.14 Numerical differentiation available
  15. III.15 Numerical integration available

Part IV

Probability

Uncertainty through sample spaces, evidence, and repetition.

16 of 16 chapters written

  1. IV.1 Random experiments, outcomes, and sample spaces available
  2. IV.2 Events and probability mass available
  3. IV.3 Counting and finite probability where needed available
  4. IV.4 Conditional probability as restricted sample space available
  5. IV.5 Independence available
  6. IV.6 Bayes' theorem as probability-mass update available
  7. IV.7 Random variables available
  8. IV.8 PMF, PDF, and CDF available
  9. IV.9 Bernoulli and Binomial distributions available
  10. IV.10 Uniform and Gaussian distributions available
  11. IV.11 Expectation available
  12. IV.12 Variance and standard deviation available
  13. IV.13 Joint, marginal, and conditional distributions available
  14. IV.14 Covariance and correlation available
  15. IV.15 Law of Large Numbers available
  16. IV.16 Central Limit Theorem available

Part V

Statistics

From observed data to estimates, intervals, and likelihood.

10 of 10 chapters written

  1. V.1 Data summaries: mean, median, mode available
  2. V.2 Spread: variance, standard deviation, robust interpretation available
  3. V.3 Population, sample, and sampling variability available
  4. V.4 Estimators and estimation available
  5. V.5 Confidence intervals through repeated sampling available
  6. V.6 Covariance matrices and multivariate spread available
  7. V.7 Regression fundamentals available
  8. V.8 Likelihood available
  9. V.9 Maximum Likelihood Estimation available
  10. V.10 Maximum A Posteriori estimation available

Part VI

Optimization

Learning as repeated parameter updates governed by an objective.

10 of 10 chapters written

  1. VI.1 Objective functions and optimization landscapes available
  2. VI.2 Local vs global optima and stationary points available
  3. VI.3 Convexity available
  4. VI.4 Gradient descent flagship chapter available
  5. VI.5 Learning rate and convergence behavior available
  6. VI.6 Momentum available
  7. VI.7 Stochastic and mini-batch gradient descent available
  8. VI.8 Adam intuition available
  9. VI.9 Constraints and projected/penalized intuition available
  10. VI.10 Numerical stopping and optimization diagnostics available

Part VII

Information Theory

Logarithms, entropy, and the loss behind token prediction.

8 of 8 chapters written

  1. VII.1 Logarithms and log probabilities in computation available
  2. VII.2 Self-information available
  3. VII.3 Entropy available
  4. VII.4 Cross entropy and negative log-likelihood available
  5. VII.5 KL divergence available
  6. VII.6 Logits and softmax available
  7. VII.7 Numerical stability: log-sum-exp and stable softmax available
  8. VII.8 From token logits to language-model loss available

Part VIII

Numerical Computing

Why equivalent expressions behave differently on real machines.

10 of 10 chapters written

  1. VIII.1 Floating-point representation available
  2. VIII.2 Rounding and representation error available
  3. VIII.3 Error propagation and conditioning available
  4. VIII.4 Catastrophic cancellation available
  5. VIII.5 Overflow and underflow available
  6. VIII.6 Stable algorithms available
  7. VIII.7 Numerical linear algebra realities available
  8. VIII.8 Sparse matrices and sparse structure available
  9. VIII.9 Vectorized computation available
  10. VIII.10 Reproducibility, random seeds, and nondeterminism available