I've been reading "A primer of multivariate statistics" by Richard J. Harris, page 546, which shows how to derive the Hotelling $T^2$ statistic, after seeing this related but different question (I have the degrees of freedom $n_1$ and $n_2$ in mine).
The following is left as an exercise for the student as it is outside the scope of a course I did last year:
Let $Y=a^TX$, where $a$ is a constant vector and $X$ is a sample member. Also $\mathcal{N(a^T\mu,a^T\Sigma a)}$
Show that
$\displaystyle\max_{\substack{a}}{\space} t^2(a)=\displaystyle\max_{\substack{a}}\space\frac{n_1n_2[a^T(\bar{x}_1-\bar{x}_2)]^2}{(n_1+n_2)a^TS_Ua}=\frac{n_1n_2}{n_1+n_2}(\bar{x}_1-\bar{x}_2)^TS_U^{-1}(\bar{x}_1-\bar{x}_2)$
which is known as the two-sample Hotelling $T^2$ statistic.
My notes say that the maximum is achieved for:
$a^*=S_U^{-1}(\bar{x}_1-\bar{x}_2)$
I can't find a proof for this despite much searching and it's not something I can work out on my own.
My thinking is that we differentiate with respect to $a$, set equal to zero and solve for $a$, and then substitute back into the original?
I can't see how one would differentiate that though and if that is how a proof is done?