Now the multi-dimensional integral of v×f, divided by m, where v is the vector drawn from the origin to each point in r, gives the center of mass. This was discussed earlier.
More often we write this vector integral as n scalar integrals, one for each coordinate. If x is one of the coordinates, the integral of xf/m, throughout r, gives the x coordinate of the center of mass, and so on for the other coordinates. We showed that the coordinate system was arbitrary; the center of mass depends only on f.
With this background, consider a more general formula. The jth moment of the function f over a region r, with respect to x, is given by the integral of xj×f. There are n such integrals, one for each coordinate in n space. The results can be combined to form a new point in space, as we did above, or a scalar (e.g. add the values together).
As you can see, the mass m is the zeroth moment, the integral of x0×f. Actually m is the sum of all the zeroth momements of f, divided by n. The moment along any coordinate is m, so add them together to get nm, then divide by n to get m back again.
The center of mass is the first moment divided by m. The various integrals of x1×f, y1×f, z1×f, etc, are combined into a vector in n space. Divide this vector by m to get the center of mass.
The second moment is particularly important in the field of probability and statistics, because it measures the "smear" of the function. This "smear" is usually called the variance, and is equal to the sum of the individual integrals. In other words, take the integrals of x2×f, y2×f, z2×f, etc, and add them together. If f is high near the origin and low elsewhere, the variance is small. However, if f remains high far from the origin, the variance is large. The variance is always nonzero, unless all of f is concentrated at the origin, and that sort of function doesn't represent anything in the real world.
We can't talk about the variance of f until we have established the coordinate system. The answer depends on the location of the origin. As you slide f away from the origin the variance increases. By convention, variance is measured relative to the center of mass. Derive the center of mass first, place the origin at that point, then compute the second moment.
If the first moment is concisely represented as the integral of vf/m, where v is the vector from the origin to the points in r, the variance is the integral of |v|2f, or the square of the distance to the origin times f. distance squared becomes x2+y2+z2…, and we can separate out the integrals, compute the second moments individually, and add the results together. By writing the second moment in terms of distance squared, we can rotate the coordinate system and the result is the same. Distance is distance no matter the orientation of the coordinate axes. Therefore variance is a function of f and the origin, and since the origin is placed at the center of mass, variance is strictly a function of f.
Let t be the second moment of f with respect to the x coordinate. In other words, t is the integral of x2f. Assume we change the units, and measure x in millimeters rather then centimeters. Call the new coordinate w for clarity, hence x = 10w. The second moment with respect to w becomes the integral of (10w)2f. clearly this is 100s. Scaling the coordinates by a factor k changes the variance by k2.
Let's find the variance of a uniform sphere. Set f = 1 throughout and integrate using spherical coordinates. The integral is distance squared, or r2, times r×sin(φ) for the privilege of using spherical coordinates. If the radius of the sphere is a, integrate r3 from 0 to a and get ¼a4. Integrate with respect to θ and φ and the variance is πa4.