Solution (source code)

= Solution

Expand the <dot product> and <cross product> in Cartesian components:
$$
\begin{aligned}
\mathbf u\cdot(\mathbf v\times\mathbf w)
&=u_1v_2w_3-u_1v_3w_2+u_2v_3w_1-u_2v_1w_3+u_3v_1w_2-u_3v_2w_1\\
&=(u_2v_3-u_3v_2)w_1+(u_3v_1-u_1v_3)w_2+(u_1v_2-u_2v_1)w_3\\
&=(\mathbf u\times\mathbf v)\cdot\mathbf w.
\end{aligned}
$$
The two expressions are the same <scalar triple product>, or <determinant> with columns $\mathbf u,\mathbf v,\mathbf w$:
$$
\boxed{\mathbf u\cdot(\mathbf v\times\mathbf w)=(\mathbf u\times\mathbf v)\cdot\mathbf w.}
$$
The equality also holds when this <determinant> is zero.