Numerical Integration and Computing π

This interactive course presentation explores numerical integration methods and the famous computation of √(π/2) from MIT's Single Variable Calculus course (18.01, Lecture 25).

Introduction

Numerical integration is a fundamental technique in calculus that allows us to approximate definite integrals when analytical solutions are difficult or impossible to find. This presentation covers two primary numerical methods—the Trapezoidal Rule and Simpson's Rule—and demonstrates their application through practical examples.

We'll also explore one of the most elegant computations in mathematics: finding the value of √(π/2) through multiple integration techniques and visualizations.

Numerical Integration Methods

The Trapezoidal Rule

The Trapezoidal Rule approximates the area under a curve by dividing it into trapezoids. For a function f(x) on the interval [a,b] divided into n subintervals, the formula is:

abf(x)dxΔx[f(x0)2+f(x1)+f(x2)+...+f(xn1)+f(xn)2]\int_{a}^{b} f(x) dx \approx \Delta x \left[ \frac{f(x_0)}{2} + f(x_1) + f(x_2) + ... + f(x_{n-1}) + \frac{f(x_n)}{2} \right]

Where Δx = (b-a)/n and the pattern of coefficients is (1/2, 1, 1, ..., 1, 1/2).

Simpson's Rule

Simpson's Rule provides a more accurate approximation by fitting parabolas through sets of three points. For a function f(x) on the interval [a,b] divided into n subintervals (where n is even), the formula is:

abf(x)dxΔx3[f(x0)+4f(x1)+2f(x2)+4f(x3)+...+2f(xn2)+4f(xn1)+f(xn)]\int_{a}^{b} f(x) dx \approx \frac{\Delta x}{3} \left[ f(x_0) + 4f(x_1) + 2f(x_2) + 4f(x_3) + ... + 2f(x_{n-2}) + 4f(x_{n-1}) + f(x_n) \right]

The pattern of coefficients is (1, 4, 2, 4, 2, ..., 4, 1).

Example: Integrating 1/x from 1 to 2

Let's examine a practical example of numerical integration, using the integral:

12dxx\int_{1}^{2} \frac{dx}{x}

This integral has a known analytical solution:

12dxx=ln(x)12=ln(2)ln(1)=ln(2)0.693147\int_{1}^{2} \frac{dx}{x} = \ln(x) \bigg|_{1}^{2} = \ln(2) - \ln(1) = \ln(2) \approx 0.693147

Applying the Trapezoidal Rule

For this example, we'll divide the interval [1,2] into just 2 sub-intervals, giving 3 points: x = 1, x = 3/2, and x = 2.

The function values at these points are:

Applying the Trapezoidal Rule formula:

12dxx12[121+23+1212]0.96\int_{1}^{2} \frac{dx}{x} \approx \frac{1}{2} \left[ \frac{1}{2} \cdot 1 + \frac{2}{3} + \frac{1}{2} \cdot \frac{1}{2} \right] \approx 0.96

This approximation gives about 0.96, which is quite far from the exact value of 0.693147.

Applying Simpson's Rule

Using the same points and applying Simpson's Rule:

12dxx16[1+423+12]=16[1+83+12]0.6944444\int_{1}^{2} \frac{dx}{x} \approx \frac{1}{6} \left[ 1 + 4 \cdot \frac{2}{3} + \frac{1}{2} \right] = \frac{1}{6} \left[ 1 + \frac{8}{3} + \frac{1}{2} \right] \approx 0.6944444

This gives approximately 0.6944444, which is remarkably close to the exact value of 0.693147.

Error Analysis for Simpson's Rule

The error in Simpson's Rule is proportional to (Δx)⁴:

SimpsonsExactO((Δx)4)|Simpson's - Exact| \approx O((\Delta x)^4)

This means:

Simpson's Rule works so well because:

Computing √(π/2)

One of the most famous computations in calculus is finding the value of √(π/2), which appears in probability theory and statistics as part of the normal distribution.

The Bell Curve and Its Area

The Gaussian function (bell curve) is defined as:

f(x)=ex2f(x) = e^{-x^2}

The area under this curve from negative infinity to positive infinity is:

Q=ex2dxQ = \int_{-\infty}^{\infty} e^{-x^2} dx

Through a clever mathematical technique involving double integrals and polar coordinates, we can show that:

Q2=πQ^2 = \pi

Therefore:

Q=πQ = \sqrt{\pi}

And the half-integral:

0ex2dx=π2\int_{0}^{\infty} e^{-x^2} dx = \frac{\sqrt{\pi}}{2}

Three-Dimensional Visualization

The key insight comes from considering the double integral:

e(x2+y2)dxdy\iint e^{-(x^2+y^2)} dx dy

This can be evaluated in two ways:

  1. As the product of two single integrals: (ex2dx)(ey2dy)=QQ=Q2\left(\int_{-\infty}^{\infty} e^{-x^2} dx\right) \cdot \left(\int_{-\infty}^{\infty} e^{-y^2} dy\right) = Q \cdot Q = Q^2

  2. Using polar coordinates: 02π0er2rdrdθ=2π0rer2dr=π\int_{0}^{2\pi} \int_{0}^{\infty} e^{-r^2} r dr d\theta = 2\pi \int_{0}^{\infty} r e^{-r^2} dr = \pi

Therefore, Q² = π, which means Q = √π.

Applications in Mathematics and Science

The numerical integration methods and special integrals discussed have numerous applications:

  1. Scientific Computing: When analytical solutions are not available, numerical methods provide approximations for complex physical systems.

  2. Statistics and Probability: The Gaussian integral is fundamental to probability theory, particularly in defining the normal distribution.

  3. Engineering: For solving complex problems in fluid dynamics, heat transfer, and structural analysis.

  4. Physics: For calculating quantities like work, energy, and momentum in complex systems.

Practice Problems

To reinforce your understanding of numerical integration methods, try these practice problems:

  1. Use the Trapezoidal Rule with n = 4 to approximate ∫₀¹ x² dx.
  2. Use Simpson's Rule with n = 4 to approximate the same integral and compare with the exact answer.
  3. Estimate the error in each approximation based on the error formulas discussed.

Conclusion

Numerical integration methods provide powerful tools for approximating definite integrals. Simpson's Rule, in particular, offers remarkable accuracy with relatively little computational effort. The computation of √(π/2) demonstrates how integration techniques can reveal profound mathematical truths and connections.

These methods form a comprehensive toolkit for solving integration problems, both analytically and numerically, with applications across mathematics, science, and engineering.