Solution (source code)

= Solution

For $A\mathbf u=\lambda B\mathbf u$ and $A\mathbf v=\mu B\mathbf v$, symmetry gives
$$
\lambda\mathbf u^TB\mathbf v=(A\mathbf u)^T\mathbf v=\mathbf u^TA\mathbf v=\mu\mathbf u^TB\mathbf v.
$$
If $\lambda\ne\mu$, \b[$\mathbf u^TB\mathbf v=0$]: the eigenvectors are orthogonal in the <inner product> induced by $B$.