Lesson 1.9: The Calculus of Center and Spread
We now upgrade our tools to handle the continuous world. This lesson shows how to calculate the Expected Value and Variance by replacing discrete summation (∑) with continuous integration (∫). We will rigorously derive these essential formulas and apply them to prove the moments of the Uniform distribution, laying the groundwork for analyzing all continuous models.
Part 1: Upgrading Your Toolkit from Sums to Integrals
The concepts of "mean" and "variance" are universal. The only thing that changes between the discrete and continuous worlds is the mathematical tool we use to calculate them.
The Great Translation: From Σ to ∫
This table is the key to the entire lesson. Everything we do is a direct translation of what we learned in Lesson 1.5.
| Concept | Discrete Tool (PMF) | Continuous Tool (PDF) |
|---|---|---|
| Expected Value E[X] | ||
| Expected Value E[g(X)] |
Part 2: Expected Value - The Center of Mass of an Area
Expected Value (Continuous)
The Expected Value () is the integral of weighted by the probability density over all possible values of .
Example: Proving the Mean of a Uniform Distribution
Let's use our new tool on the simplest continuous case: the Uniform distribution , where the PDF is a flat line at for , and 0 everywhere else. Logically, the balancing point of a perfect rectangle should be its exact middle, . Let's prove it.
Calculation: E[X] for U(a, b)
Step 1: Set up the integral. We only need to integrate over where the PDF is non-zero.
Step 2: Factor out the constant term.
Step 3: Evaluate the integral of x. The antiderivative of is .
Step 4: Simplify the algebra. Use the difference of squares identity, .
The calculus confirms our intuition perfectly.
Part 3: Variance - The Spread of an Area
The Two-Step Plan for Variance
- Calculate the second moment, , by integrating .
- Plug and (from Part 2) into the variance formula.
The Second Moment (Continuous)
Using the general rule , we set .
Example: Proving the Variance of a Uniform Distribution
Calculation: Var(X) for U(a, b)
Step 1: Calculate . The antiderivative of is .
Using the identity :
Step 2: Plug into the variance formula. We know .
Finding a common denominator and simplifying the algebra...
- Derivatives Pricing: The expected payoff of a financial option is literally the integral of the payoff function multiplied by the risk-neutral PDF of the underlying asset's price. The Black-Scholes formula is a famous closed-form solution to such an integral.
- Continuous Loss Functions: In machine learning, when we assume the errors of a model follow a continuous distribution (like the Normal distribution), the process of minimizing the loss function is implicitly finding the parameters that best match the expected value and variance derived through these integral methods.
This isn't just abstract calculus; this is the daily work of a quantitative professional.
What's Next? The Continuous Toolbox
We have now fully upgraded our mathematical machinery to handle the continuous world. We know what PDFs are and how to use integration to find their moments.
It is time to build our toolbox. Just as we had the Binomial and Poisson for discrete counts, we need a set of standard, named distributions for continuous measurements. The next lesson introduces the most common and useful continuous PDFs.