Example: Line Segment 2-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,y_1)$ and $(x_2,y_2)$ is:
$$
\left\{
\begin{array}{c}
x = x_1 + \xi (x_2 - x_1) \\
y = y_1 + \xi (y_2 - y_1)
\end{array} \right.
\qquad \mbox{where:} \qquad 0 \le \xi \le 1
$$
It is assumed that weights are uniformly distributed across this line segment:
$w(\xi) = 1$. The midpoint of the line segment is:
$$
\overline{x} = \int_0^1 x \, dx = x_1 + (x_2-x_1) \int_0^1 \xi \, d\xi =
x_1 + (x_2-x_1) \half = \half (x_1 + x_2)
$$
Quite analogously for $\overline{y}$. Therefore:
$$
\overline{x} = \half (x_1 + x_2) \EN
\overline{y} = \half (y_1 + y_2)
$$
The second moments of inertia are:
$$
\overline{x^2} = \int_0^1 x^2 \, dx =
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 + x1^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
$$
Quite analogously for $\overline{y^2} - \overline{y}^2$. Therefore:
$$
\sigma_{xx} = \frac{1}{12} \left( x_1 - x_2 \right)^2 \EN
\sigma_{yy} = \frac{1}{12} \left( y_1 - y_2 \right)^2
$$
Cross moments of intertia are a somewhat different piece of cake. MAPLE has been
employed here for the purpose of being error proof:
$ \overline{x y} - \overline{x} \, \overline{y} = $
simplify(x_1*y_1 + x_1*(y_2-y_1)/2 + y_1*(x_2-x_1)/2
+ (x_2-x_1)*(y_2-y_1)/3 - (x_2+x_1)*(y_2+y_1)/4);
Giving:
1/12 x_1 y_1 - 1/12 x_1 y_2 - 1/12 y_1 x_2 + 1/12 x_2 y_2
$$
\hieruit \sigma_{xy} = \overline{x y} - \overline{x} \, \overline{y} =
\frac{1}{12} (x_2 - x_1) (y_2 - y_1)
$$