22.6 Integral Calculus
Earlier chapters used continuous random variables without asking how their probabilities are computed. We described a normal distribution by its density (Section 2.1.3), wrote an expected loss as an average over that density, and treated both as given. In this section we ask how to add up a quantity that is spread continuously over an interval.
The standard normal distribution, the familiar bell curve, shows why continuous summation requires care. A standard normal random variable has density . At the curve reaches height , yet the probability of landing on zero is , and the same is true for every other single point. Intervals, on the other hand, do carry probability: . Geometrically, that number is the area under between and , and is the constant that makes the total area under the curve equal to . Where does come from, and how do we compute ?
These questions reach well beyond the bell curve. Every probability and every expected loss over a continuous variable is an area of this kind. Training a model through random sampling, as variational autoencoders and policy-gradient methods do, also requires differentiating such an area with respect to a model parameter.
Our strategy is simple: cut the area into thin slices, add their areas, and let the slices shrink to zero. The limit is the integral. The fundamental theorem of calculus then replaces this infinite addition with the reverse of differentiation, which settles most integrals in a single line. It does not settle the bell curve, whose normalizing constant requires a detour through two dimensions. Three results anchor the section: the fundamental theorem (22.6.3), the multivariable change-of-variables formula (22.6.11), and the Gaussian integral (22.6.13). If you already have first-year calculus at hand, you can skim through to Section 22.6.2.2. Differentiating an integral with respect to a parameter builds on all of these tools and has a section of its own in Section 22.7. We leave out measure theory and the Lebesgue integral, pointing interested readers to Section 22.8.
22.6.1 The Definite Integral#
22.6.1.1 Riemann Sums#
A probability density gives probability per unit length, so over a short interval of width the probability is approximately density times width. Over a longer interval, we cut it into thin slices, multiply height by width on each slice, and add the results. Nothing in this idea is specific to densities: the same recipe works for any function.
Let us start with a case we can work out by hand. Take on and divide the interval into slices of equal width . On the -th slice , we approximate the area by a rectangle whose height is the value of at the left endpoint, . Adding all rectangles gives
where the middle step uses the classical identity . As grows, the rectangle sums converge to , missing the limit by roughly , an error of first order in the slice width .
The helper function left_sum implements this left-endpoint rule for any
function : divide into slices of width and evaluate
at the left end of each slice, as shown in Figure 22.6.1. We will
use left_sum for every grid sum in this section, starting with a quick check
on .
def left_sum(f, a, b, eps):
"""Left-endpoint Riemann sum of f on [a, b] with slices of width eps."""
x = a + eps * np.arange(round((b - a) / eps)) # left ends of the slices
return float(np.sum(eps * f(x)))
for N in [10, 100, 1000]:
print(f'N={N:<5} left sum={left_sum(lambda x: x**2, 0, 1, 1 / N):.6f} '
f'formula={1/3 - 1/(2*N) + 1/(6*N**2):.6f}')
N=10 left sum=0.285000 formula=0.285000
N=100 left sum=0.328350 formula=0.328350
N=1000 left sum=0.332834 formula=0.332834
The numerical sums match the closed-form formula to every printed digit.
The definition. Nothing in this construction requires equal slice widths or left endpoints. More generally, a partition cuts into subintervals, a tag picks one sample point inside each slice, and the mesh measures the width of the widest slice. A bounded function is Riemann integrable on if there is a single number that every tagged sum approaches as the mesh shrinks to zero, regardless of how the tags are chosen:
In short, the definite integral is the common limit of the slice sums as the slices become arbitrarily thin. Our hand calculation above establishes . Every continuous function on is Riemann integrable, and so is every bounded function with finitely many jump discontinuities (Rudin, 1976). Some pathological bounded functions, such as the indicator of the rational numbers, fail to have a Riemann integral; the Lebesgue integral (Section 22.8) extends integration to them while agreeing with the Riemann integral whenever the latter exists.
Two elementary properties follow straight from the definition and will power the proofs below. First, the integral is monotone: if everywhere on , then every tagged sum of is no larger than the corresponding tagged sum of , and taking limits preserves the inequality, giving . Second, it is additive over subintervals: for any , , because any partition that includes the point splits cleanly into a partition of and a partition of .
The running example. Until we reach the Gaussian integral, we will carry one concrete example through the section:
We will see why its value is once we establish the evaluation rule (22.6.4). Figure 22.6.1 illustrates left-endpoint rectangles under this curve at three slice widths.
Left-endpoint rectangles under on for slice widths , , and . Each slice takes the height of at its left endpoint, and the rectangle sums approach the area as .
How quickly do the left sums converge to ? For on the error was . If first-order convergence is typical, making the slices ten times thinner should reduce the error by a factor of ten. Let us check by printing the error alongside .
f = lambda x: x / (1 + x**2)
truth = math.log(5) / 2
for eps in [1e-1, 1e-2, 1e-3, 1e-4]:
s = left_sum(f, 0, 2, eps)
print(f'eps={eps:.0e} sum={s:.6f} truth-sum={truth - s:.2e} '
f'0.2*eps={0.2 * eps:.0e}')
print(f'truth = (1/2) log 5 = {truth:.6f}')
eps=1e-01 sum=0.783785 truth-sum=2.09e-02 0.2*eps=2e-02
eps=1e-02 sum=0.802710 truth-sum=2.01e-03 0.2*eps=2e-03
eps=1e-03 sum=0.804519 truth-sum=2.00e-04 0.2*eps=2e-04
eps=1e-04 sum=0.804699 truth-sum=2.00e-05 0.2*eps=2e-05
truth = (1/2) log 5 = 0.804719
Each time shrinks by a factor of ten, the error shrinks by ten as well, and every sum sits below the true value. The constant happens to be half of . This is no coincidence, and we will derive the formula behind it as soon as the fundamental theorem is in place.
22.6.1.2 Signed Area#
Rectangles below the horizontal axis have negative height and enter the Riemann sum with a minus sign. The integral therefore measures signed area: regions where contribute negatively, as in . By convention, integrating from right to left also negates the result, . This convention ensures that additivity holds regardless of how , , and are ordered. Figure 22.6.2 illustrates both conventions on a single curve.
Signed area. Lobes above the axis count positively and the lobe below counts negatively, so totals the shaded regions with their signs; reversing the limits traverses the same area from right to left and negates the total.
22.6.2 The Fundamental Theorem#
22.6.2.1 The Theorem#
Adding slices gave for only because happens to have a closed form. For our running example, the left sum is , and no algebraic identity collapses it. We need a way to evaluate integrals without adding slices at all.
The breakthrough comes from treating the upper limit as a variable. Fix a base point and define the area-so-far function
which records the signed area accumulated from out to . This single function encodes every definite integral of : by additivity, the area over any interval is simply the difference of two accumulated areas,
as shown in Figure 22.6.3. Finding therefore solves the whole problem.
The area under from to as the difference of two areas accumulated from the base point at the plot's left edge: .
How does change when we nudge slightly to the right? Figure 22.6.4 shows the accumulated area up to alongside the thin strip of width added by moving to . That strip is nearly a rectangle of height , so . Dividing by suggests that .
The area-so-far under from to (light), and the strip added by moving to (dark). The strip is close to the dashed rectangle of height , so .
Theorem (Fundamental theorem of calculus). Let be Riemann integrable on , let , and let be continuous at a point . Then is differentiable at and
In words, the rate at which area accumulates equals the current height of the curve.
Proof. Nudge by and look at the added area. By (22.6.2) and additivity, the change is a single sliver,
Let and be the tightest constant bounds on over this sliver; both are finite because an integrable function is bounded. Since throughout , monotonicity of the integral traps the sliver's area between two rectangles of width :
Now divide through by . Because is continuous at , for any the entire interval eventually lies inside the region where . Both and therefore converge to as , and the squeeze forces . When , the sliver sits to the left of , and the same bounds hold with both sign flips canceling in the difference quotient. That limit is .
Notice that the proof used only monotonicity and additivity, the two properties we read off the definition. The theorem turns the problem of finding an area into the problem of finding an antiderivative, a function satisfying , which we can often read straight off the derivative table in Section 22.1.2. Any antiderivative yields the definite integral via the evaluation rule: if is continuous on and on all of , then
Why does any antiderivative work, not just ? Because and share the same derivative on , so their difference has derivative zero and must be constant by the mean value theorem (Section 22.1.3). That additive constant cancels out in .
The requirement "on all of " is essential. Since , blindly applying the rule gives , a negative answer for a strictly positive integrand. The rule does not apply here because breaks down at , where neither function is defined; in fact the integral diverges (Section 22.6.2.2).
Read backwards, every derivative formula becomes an integral: gives without a single slice, and gives . For our running example, try . By the chain rule, , so
confirming the limit our Riemann sums were approaching.
The error of the left rule. The evaluation rule also explains where the constant in the left-sum error came from. On the slice starting at , a first-order expansion gives . Integrating over shows that the true area of the slice exceeds its rectangle by roughly . Summing these triangular excesses across all slices yields times a left sum of , which approximates . To first order in ,
For on this gives , matching the leading error term we found by hand. For the running example, and give . This estimate is numerical analysis rather than pure calculus, yet it accounts for the residual error in three more experiments in this section and serves as the baseline against which random sampling is judged in Section 24.5.1.7.
The fundamental theorem actually tells us more than : the area-so-far function must equal at every . Let us verify this by computing as a cumulative left sum across and comparing it with at every grid point. The two will not match to machine precision, because the left sum on carries the bias . That bias is largest where peaks, at where , so the maximum discrepancy across the interval should be .
G = lambda x: np.log(1 + x**2) / 2 # antiderivative of f
for eps in [1e-2, 1e-3, 1e-4]:
x = eps * np.arange(round(2 / eps)) # left ends of the slices of [0, 2]
F = np.cumsum(eps * f(x)) # F[k]: left sum on [0, x_k + eps]
gap = np.abs(F - (G(x + eps) - G(0))).max()
print(f'eps={eps:.0e} max over x of |F(x) - (G(x) - G(0))| = {gap:.2e}')
eps=1e-02 max over x of |F(x) - (G(x) - G(0))| = 2.51e-03
eps=1e-03 max over x of |F(x) - (G(x) - G(0))| = 2.50e-04
eps=1e-04 max over x of |F(x) - (G(x) - G(0))| = 2.50e-05
At every slice width, the maximum discrepancy is , just as predicted. The cumulative sum tracks the antiderivative across the entire interval, not only at the right endpoint .
22.6.2.2 Improper Integrals#
The normal, exponential, and many other probability densities live on unbounded domains, whereas (22.6.1) defines integrals only over a finite interval . We extend the definition the same way we built it, by taking a limit. The improper integral over is
the area accumulated out to in the limit of large . If this limit exists and is finite, the integral converges; otherwise it diverges. To integrate over the entire real line, we split at any convenient point into two one-sided improper integrals, and both must converge independently. A symmetric limit is not enough: for every , yet , so does not exist.
The power law (with exponent ) is the standard benchmark for deciding whether a tail decays fast enough to enclose finite area. Applying the evaluation rule on and taking gives
(At the expression reads ; the definite integral is , which is the limit of the formula as and diverges as .) Thus whereas : the dividing line between finite and infinite area lies right at .
Power laws are the canonical heavy-tailed distributions (Section 24.1, which also examines how heavy tails affect averages). For a density with tail , the normalizing constant is finite only when , and the mean, tested by applying the same criterion to , is finite only when .
The same limiting device handles an integrand that blows up at an endpoint: . For the power law , the condition reverses:
while the integral diverges for . At , for instance, shoots to infinity at , yet the area under it is only . Near infinity, a power law must fall faster than to have finite area; near zero, it must grow more slowly than .
When we approximate an improper integral numerically, two distinct errors enter: we cut off the domain at a finite , and we sum slices of finite width . For , we can separate the two. Below we print the exact partial integral (from the antiderivative ) next to a left sum with .
for b in [1, 2, 5, 10, 20]:
left = left_sum(lambda x: np.exp(-x), 0, b, 1e-3)
print(f'b={b:<3} left sum={left:.6f} exact 1-e^-b={1 - math.exp(-b):.6f}')
b=1 left sum=0.632437 exact 1-e^-b=0.632121
b=2 left sum=0.865097 exact 1-e^-b=0.864665
b=5 left sum=0.993759 exact 1-e^-b=0.993262
b=10 left sum=1.000455 exact 1-e^-b=0.999955
b=20 left sum=1.000500 exact 1-e^-b=1.000000
The exact partial integrals converge to rapidly: the truncation error from stopping at is , already below the sixth decimal place by . The left sums, however, settle near rather than . That residual is discretization error, our left-rule bias . To leading order the two errors simply add: pushing higher removes truncation error, while shrinking removes discretization error.
22.6.2.3 Integration by Parts#
Every differentiation rule, read through the evaluation rule, yields a matching integration rule. The product rule becomes integration by parts.
For continuously differentiable functions and on ,
where is shorthand for . The proof takes one line: by the product rule, is an antiderivative of , so (22.6.4) gives , and subtracting from both sides yields (22.6.6).
What this formula does is shift a derivative from one factor onto the other at the cost of a boundary term. It pays off whenever the new integrand is simpler than . Choosing and (so and ), applying (22.6.6) on , and letting gives
The boundary term vanishes because at both endpoints, leaving the improper integral we just evaluated. This integral is the mean of the exponential distribution (Section 24.3).
Because expectations are integrals of products, a recurring trick in probability and machine learning is to shift a derivative off an intractable factor and onto a tractable one. The bell curve shows this technique at its cleanest. Consider the unnormalized bell weight , which satisfies . Let be continuously differentiable with as , and suppose the two integrals below converge. Integrating by parts on and then taking and separately yields
Under the bell weight, multiplying by has the same effect as differentiating . Both hypotheses hold for every polynomial . Taking gives : the mean of under the bell weight is , regardless of what the normalizing constant turns out to be (we will show it is in (22.6.14)). Taking gives , so the mean of is . Once is normalized into the standard normal density , this becomes , known as Stein's identity for the standard normal. Shifting a derivative from an unknown factor onto a known one is also the key step behind score matching (Section 26.6, (Hyvärinen, 2005)). In , the corresponding rule moves a divergence instead of a one-dimensional derivative; Section 26.5.2.1 introduces the divergence, the Laplacian, and that multivariable identity where they are first needed.
22.6.2.4 Substitution#
Reading the chain rule backwards through the evaluation rule produces the substitution rule. Suppose is continuously differentiable on and is continuous on an interval containing , with antiderivative . By the chain rule, , so
Read from right to left, this is the change-of-variables formula
In words, an integral over can be rewritten as an integral over provided we multiply the integrand by the local stretch factor . Note that does not even need to be monotone.
A single thin slice makes the stretch factor transparent. Partition into slices of width . The map carries the slice at to a slice of width approximately at , where the curve has height . Its area is therefore , which is the quantity the -integral sums (Figure 22.6.5).
A thin sliver under the substitution . Left, the side (the right-hand side of the formula): a sliver of width at and height . Right, the side: its image, of width and the same height. Matching the two areas requires the factor .
In practice, substitution works by spotting the pattern inside an integrand. In , set so : the integrand is , and
Here the factor supplied the that substitution needs. Remove that and we are left with , which has no elementary antiderivative and is the very integral behind the bell curve's normalizer . To evaluate it in (22.6.13), we will obtain the missing factor by moving to two dimensions and switching to polar coordinates.
22.6.3 Multiple Integrals#
From this point on we quote two standard theorems without proof, both from (Folland, 1999): Fubini's theorem and the multivariable change-of-variables formula.
22.6.3.1 Double Integrals and Fubini's Theorem#
Because our route to passes through two dimensions, we first extend integration from intervals to regions of the plane. Consider the two-dimensional bell surface over the square , which encloses a volume above the base plane. We approximate that volume just as we approximated areas: tile the base with squares, erect on each square a column of height , and sum the column volumes (Figure 22.6.6). For a function on a rectangle , the limit of these box sums as is the double integral , the signed volume beneath the surface.
The bell surface over the square . Tiling the base with squares () and placing a box of height on each approximates the volume under the surface; the highlighted column of boxes at a fixed corresponds to one inner sum in Fubini's theorem.
How can we compute such a volume using our one-dimensional tools? Any finite sum can be totaled in whatever order we like. Indexing the grid squares by along and along , we can sum the boxes column by column (Figure 22.6.7):
The inner sum is the left-endpoint approximation to , the cross-sectional area of the surface at (the highlighted column in Figure 22.6.6), and the outer sum integrates that slice area across .
Totalling a grid of cells with corner , indexed by along and along . (1) Sum each column, at fixed , over . (2) Add the column totals from left to right. Reordering a finite sum changes nothing; this discrete fact underlies iterated integration.
Reordering a finite grid sum is elementary, but ensuring that the equality survives the limit requires a theorem and a condition. Fubini's theorem states that if is absolutely integrable on , meaning , then the double integral equals either iterated integral:
In geometric terms, a volume can be computed slice by slice in either direction. When , the same equality holds with no integrability check at all, allowing all three sides to equal (Tonelli's theorem). Probability densities, squared losses, and other nonnegative integrands therefore require no verification; for a signed integrand, however, we must check first. Fubini's theorem is at work whenever we marginalize a variable out of a joint density or swap an expectation with another integral.
The most common special case is a product integrand . Because is constant with respect to , it pulls straight out of the inner integral, , leaving
A product integrand integrates factor by factor. Crucially, the two-dimensional bell factors in this way, , and our evaluation of the Gaussian integral below rests on this observation.
The absolute-integrability hypothesis is not a mere formality. Consider on . A quick differentiation shows that , so the evaluation rule gives for , and integrating over yields . Yet , so integrating in the reverse order gives . The two orders disagree because : near the origin, grows like the inverse square of the distance, and its total volume diverges.
When the domain is not a rectangle, is defined by zero-extension: set to outside and integrate over any rectangle that contains .
22.6.3.2 Change of Variables in Many Dimensions#
The one-dimensional stretch factor generalizes naturally to higher dimensions, and linear maps already show the form it must take. A linear map scales every area or volume by the absolute value of its determinant (Section 21.2), while the sign of the determinant merely tracks orientation. For example, the map with has determinant and stretches the unit disc (of area ) into the ellipse , whose area is therefore .
Locally, a smooth nonlinear map looks linear, with its Jacobian matrix serving as the linear approximation; the volume scale factor simply varies from point to point. Let be open and let be a -diffeomorphism onto its image: is continuously differentiable and injective, and its Jacobian (the matrix of partial derivatives from Section 22.4) satisfies everywhere on . Injectivity prevents the map from folding space onto itself, and a nonzero determinant prevents it from flattening a region to a lower dimension. Under these conditions, for any absolutely integrable ,
An infinitesimal cube of volume at maps to an infinitesimal parallelepiped of volume at , and the Jacobian determinant adjusts the integrand for that local distortion. Figure 22.6.8 places the one- and two-dimensional pictures side by side.
Left: one-dimensional substitution scales a segment of length by . Right: in two dimensions, a linear map sends the unit square to a parallelogram whose area is the volume factor .
Why does (22.6.11) carry the absolute value rather than ? Because the left-hand side integrates over an unoriented set, not between ordered endpoints. In one dimension, the order of the limits carries the sign: if is decreasing, the limits in (22.6.8) run backwards while , so the two minus signs cancel and we can equivalently integrate over the image interval with . Regions in have no natural ordering, so only this unsigned form generalizes.
When is a probability density, (22.6.11) tells us how a density transforms under a smooth invertible map, which is how a normalizing flow computes the density of its output (Section 24.2).
22.6.3.3 The Gaussian Integral#
The normalizing constant of the bell curve comes from the
one-dimensional integral . Here the
fundamental theorem cannot give us a closed form: an antiderivative certainly
exists because is continuous, but it is a fundamentally new function
that cannot be written in terms of elementary ones. Surprisingly, the integral
over the entire real line can still be evaluated in closed form by taking a
detour through two dimensions. The argument takes three steps and is the most
elegant calculation in the section. (Normalized, the antiderivative is the
error function , which tends to as by the result we are about
to prove; standard libraries provide it as math.erf.)
I. Square and factor. On the square , the product rule (22.6.10) gives . Letting on both sides yields
The square of our one-dimensional integral is simply the volume under the two-dimensional bell, and that surface is rotationally symmetric around the origin.
II. Polar coordinates. Rotational symmetry invites polar coordinates, , on the open set , where the map is injective. Its Jacobian determinant is
Geometrically, a polar cell with radial side and arc length has area approximately (Figure 22.6.9), reflecting the fact that cells farther from the origin are wider. Crucially, this factor supplies the missing factor from our substitution example .
A polar grid with one cell shaded: radial side and arc side , giving an area of approximately . Switching to polar coordinates multiplies the integrand by .
III. Integrate. Applying (22.6.11) and using the antiderivative of , we obtain
Taking the positive square root of (22.6.12) gives
Thus the total area under is .
Three technical points make this argument completely rigorous. First, because the integrand is nonnegative, integrals over expanding squares and over expanding discs converge to the same limit: every disc fits inside some square and every square inside some disc, so the shape of the growing region does not matter. Second, the polar map omits the nonnegative ray , which has zero area and contributes nothing to the integral. Third, we apply the change of variables on the bounded rectangles , where the integrand is bounded and continuous, and let afterward.
The normalizing constant of the standard normal now follows from a single substitution. Setting in (22.6.8) gives
Dividing the bell by scales its total area to , which is where the constant in the standard normal density comes from.
Let us check step I numerically: do the expanding squares really exhaust the plane and converge to ? The code below computes the two-dimensional grid sum over at alongside the exact square volume and the limiting value .
eps = 0.01
for b in [1, 2, 3, 6]:
g = -b + eps * np.arange(round(2 * b / eps)) # left ends of the slices
x, y = np.meshgrid(g, g, indexing='ij')
grid = np.sum(eps**2 * np.exp(-x**2 - y**2))
print(f'b={b} grid sum={grid:.6f} pi*erf(b)^2={math.pi * math.erf(b)**2:.6f}'
f' pi={math.pi:.6f}')
b=1 grid sum=2.230949 pi*erf(b)^2=2.230985 pi=3.141593
b=2 grid sum=3.112266 pi*erf(b)^2=3.112270 pi=3.141593
b=3 grid sum=3.141454 pi*erf(b)^2=3.141454 pi=3.141593
b=6 grid sum=3.141593 pi*erf(b)^2=3.141593 pi=3.141593
The grid sums track closely and climb to ; by , the volume left outside the square is only about . Agreement to four or more decimal places at has a simple explanation: for an even integrand on a symmetric interval, the left rule's first-order bias vanishes identically.
We can now compute the standard normal probability as well. Substituting turns the area under into an error function:
Both questions we asked about the bell curve are now answered, and the apparent paradox that while disappears: a density measures probability per unit length, and a single point is an interval of length zero.
One question from the opening remains open. Training a model through random sampling requires knowing how an area of this kind changes when a parameter of the density moves, and for that we need to differentiate an integral.
22.6.4 Summary#
The definite integral is the limit of sums of thin slices, measuring signed area under a curve. The fundamental theorem of calculus replaces that limit with antidifferentiation: because the area-so-far function satisfies , any antiderivative gives . Integration by parts and substitution are the product and chain rules read backwards. In multiple dimensions, Fubini's theorem reduces volume integrals to iterated one-dimensional integrals, and the change-of-variables stretch factor becomes , the local volume distortion; combined with polar coordinates, this yields and the standard normal normalizing constant .
22.6.5 Exercises#
-
Activations as accumulated areas. Let be the unit step, with for and for . Let be the standard Gaussian density and its distribution function.
- Show that . Which hypothesis of the fundamental theorem (22.6.3) fails at ? What are the one-sided derivatives of the integral there?
- Write to conclude that . Then substitute to show that .
- The GELU activation of Section 4.1 is . Derive its
derivative, find the points where the derivative is largest and
smallest, and evaluate it there with
math.erf. In which interval does the slope of GELU lie, and how does that interval compare with the slopes and of ReLU?
-
Heavy tails. The Pareto density with tail index is for and otherwise. The Cauchy density is on .
- Show that the Pareto density is normalized for every . For which are and finite? Compute where it is finite.
- Show that the Cauchy density is normalized, using the antiderivative of .
- Show that for the Cauchy density and every . Why does the Cauchy density nevertheless have no mean under the definition of that follows (22.6.5)? How fast does grow with ?
-
Gamma function by parts. The Gamma function is . For the integrand is unbounded at , and the integral near is defined by a limit, , as in Section 22.6.2.2.
- For which does the integral converge at ? Compare the condition with the test for in Section 22.6.2.2.
- Integrate by parts (22.6.6) at a general to show that , and conclude that for every integer . Where does the argument use ? Use the result to compute the variance of the exponential density on , whose mean we computed in Section 22.6.2.3.
- Substitute and use the Gaussian integral (22.6.13) to evaluate .
- The product rule (22.6.10), applied times, gives . In polar form the same integral is , where is the surface area of the unit sphere in . Show that the radial integral is and deduce . Integrate over to show that the unit ball has volume . Evaluate for and explain why . A midpoint grid with three points per axis on the cube has points; what fraction of them lies inside the unit ball, and what does that say about grids in high dimensions?
-
Swapping the order. Fubini's theorem (22.6.9), together with zero-extension for regions that are not rectangles, lets us choose the order of integration.
- The inner integral of has no elementary antiderivative. Sketch the triangular region of integration, reverse the order, and evaluate the integral in closed form.
- Let have density . Write inside and swap the two integrals to show that . Why is the swap valid even when ? Check the formula on the density for .
-
Gaussian normalizers and moments. The text normalizes the standard normal and computes its moments with the Stein identity (22.6.7) for the bell weight. Let with .
- Substitute and use (22.6.14) to show that is normalized. Which and does the density have?
- Let have density , and let be continuously differentiable with as . Use and integration by parts to show that
Deduce that and .
- Let be a covariance matrix with invertible . Use the change of variables in (22.6.11) and the product rule (22.6.10) to show that