Skip to content
BIASED

Multiple integrals and change of variables

Block 1 of 7~2 min

The integral as a limit of sums

The topic Matrix calculus gave us gradients of losses such as ∥Ax−b∥2\lVert Ax - b\rVert^2 and softmax cross-entropy in a few lines. But a loss is an average over data. When the data come from a distribution, that average is an integral, taken over as many variables as a data point has coordinates. This topic learns to compute such integrals.

Start in the plane. Cut a rectangle RR into small cells of area ΔA\Delta A, pick a point (xi,yj)(x_i, y_j) in each, and add up. As the cells shrink, the sum tends to the double integral:

∬Rf(x,y) dA=lim⁡ΔA→0∑i,jf(xi,yj) ΔA.\iint_R f(x, y)\, dA = \lim_{\Delta A \to 0} \sum_{i, j} f(x_i, y_j)\, \Delta A .

If f≥0f \ge 0, this is the volume under the graph of ff over RR, just as a 1-D integral is an area under a curve.

In probability, ff is a joint density p(x,y)p(x, y). It is non-negative, its integral over the whole plane is 11, and the probability that the random point (X,Y)(X, Y) lands in a region RR is

P((X,Y)∈R)=∬Rp(x,y) dA.P\big((X, Y) \in R\big) = \iint_R p(x, y)\, dA .

A density is not a probability. A cell of area ΔA\Delta A near (x,y)(x, y) has probability about p(x,y) ΔAp(x, y)\,\Delta A, so pp itself may exceed 11. The uniform density on the rectangle [0,2]×[0,1][0, 2] \times [0, 1] equals 12\tfrac12: the rectangle has area 22 and the total must be 11.

The running example of this topic is the density

p(x,y)=x+y,(x,y)∈[0,1]2.p(x, y) = x + y, \qquad (x, y) \in [0, 1]^2 .

Outside the square p=0p = 0. Points near the corner (1,1)(1, 1) are more likely than points near the origin. That it really integrates to 11 we will check once we can compute double integrals.

Answers are saved on the server and tied to this browser until you sign in.