Example: Line Segment 1-D
$
\def \half {\frac{1}{2}}
\def \kwart {\frac{1}{4}}
\def \hieruit {\quad \Longrightarrow \quad}
\def \EN {\quad \mbox{and} \quad}
$
The equation of a line segment between $x_1$ and $x_2$ is:
$$
x = x_1 + \xi (x_2 - x_1)
\qquad \mbox{where:} \qquad 0 \le \xi \le 1 \hieruit dx = (x_2 - x_1) d\xi
$$
It is assumed that weights are uniformly distributed across this line segment:
$w(\xi) = 1$. The midpoint of the line segment is then:
$$
\overline{x} = \frac{\int_{x_1}^{x_2} x \, dx}{\int_{x_1}^{x_2} dx}
= \frac{ \int_0^1 \left[ x_1 + (x_2-x_1) \xi \right] (x_2 - x_1) d\xi}
{(x_2 - x_1)} =
$$ $$
x_1 + (x_2-x_1) \int_0^1 \xi \, d\xi =
x_1 + (x_2-x_1) \half = \half (x_1 + x_2)
$$
The second moments of inertia is:
$$
\overline{x^2} = \int_0^1 x^2 \, d\xi =
x_1^2 + 2 x_1 (x_2-x_1) \int_0^1 \xi \, d\xi
+ (x_2-x_1)^2 \int_0^1 \xi^2 \, d\xi =
$$ $$
x_1^2 + 2 x_1 (x_2-x_1) \half + (x_2-x_1)^2 \frac{1}{3} =
x_1^2 + x_1 x_2 - x_1^2 + x_2^2/3 - 2 x_1 x_2 / 3 + x_1^2/3 =
$$ $$
\frac{1}{3} \left( x_1^2 + x_2^2 + x_1 x_2 \right) \hieruit
$$ $$
\overline{x^2} - \overline{x}^2 =
\frac{1}{3} \left( x_1^2 + x_2^2 + x_1 x_2 \right)
- \kwart \left( x_1^2 + x_2^2 + 2 x_1 x_2 \right) =
$$ $$
\frac{1}{12} \left( x_1^2 + x_2^2 - 2 x_1 x_2 \right) =
\frac{1}{12} \left( x_1 - x_2 \right)^2
$$
Summarizing:
$$
\mu_x = \half (x_1 + x_2) \EN
\sigma_{xx} = \frac{1}{12} \left( x_2 - x_1 \right)^2
$$