$$\begin{array}{ll} \text{maximize} & \mbox{tr} (A^T B A)\\ \text{subject to} & A^T A = I\end{array}$$
where the maximization is over $A$.
I know that the solution is eigenvectors of $B$, but I don't know how to arrive at it. In particular, constructing the Lagrangian is not straightforward because the constraint is a matrix equation while the objective function is scalar.