Solution (source code)

= Solution

Let $J_{ij}=\int_B x_ix_j\,d^3x$. Rotational symmetry makes $J$ an <isotropic second-rank tensor>, so $J_{ij}=C\delta_{ij}$. Contracting the indices and integrating in <spherical coordinates> gives
$$
3C=\int_Br^2\,d^3x=4\pi\int_0^1r^4dr=\frac{4\pi}5.
$$
The <isotropic second moment of a ball> therefore gives
$$
\boxed{I=M_{ij}J_{ij}=\frac{4\pi}{15}\operatorname{tr}M.}
$$
Only the scalar part of $M$ contributes; its <antisymmetric tensor> and symmetric-traceless parts give zero.