8. In the quadrilateral pyramid $S-ABCD$, the base is a square with side length $4a$, and the side edges $SA=SB=SC=SD=8a$, $M$ and $N$ are the midpoints of edges $SA$ and $SC$, respectively. Find the distance $d$ between the skew lines $DM$ and $BN$.
8. As shown in Figure $20-20$, with the center $O$ of the square base as the origin, and lines parallel to the base and $O S$ as the $x, y, z$ axes, we establish a rectangular coordinate system. Then, $B(2 a,-2 a, 0), D(-2 a, 2 a, 0), M(-a, -a, \sqrt{14} a), N(a, a, \sqrt{14} a)$,
Since $\overrightarrow{B N}=(-a, 3 a, \sqrt{14} a), \overrightarrow{D M}=(a,-3 a, \sqrt{14} a)$,
Let $\boldsymbol{n}=(x, y, z)$ be a direction vector of the common perpendicular to $D M$ and $B N$, then from $\overrightarrow{B N} \cdot \boldsymbol{n}=\boldsymbol{x}-$ $3 y-\sqrt{14} z=0, \overrightarrow{D M} \cdot n=x-3 y+\sqrt{14} z=0$ we get $n=(3,1,0)$, since $\overrightarrow{M N}=(2 a, 2 a, 0)$, the distance $d$ between the skew lines $D M$ and $B N$ is $d=\frac{|\overrightarrow{M N} \cdot n|}{|n|}=\frac{4 \sqrt{10} a}{5}$.