While studying statistical inference and data-analysis, I came across this question. I have been able to show part (a) of this question already myself, but I don't know how to solve part (b). Can anyone help me with that?
(a) Show that $$ \text{Cor}(\mathbf{a}^\top \mathbf{X}_1, \mathbf{b}^\top \mathbf{X}_2) = \frac{\mathbf{a}^\top \boldsymbol{\Sigma}_{12} \mathbf{b}}{\sqrt{\mathbf{a}^\top \boldsymbol{\Sigma}_{11} \mathbf{a}} \sqrt{\mathbf{b}^\top \boldsymbol{\Sigma}_{22} \mathbf{b}}} $$
(b) Use appropriate transformations to show that $$\max_{\mathbf{a}\neq\mathbf{0}, \mathbf{b}\neq\mathbf{0}} \text{Cor}(\mathbf{a}^\top \mathbf{X}_1, \mathbf{b}^\top \mathbf{X}_2) = \max_{\mathbf{u}\neq\mathbf{0}, \mathbf{v}\neq\mathbf{0}} \frac{(\mathbf{u}^\top \mathbf{M} \mathbf{v})^2}{(\mathbf{u}^\top \mathbf{u})(\mathbf{v}^\top \mathbf{v})} $$
Thanks in advance.