Let $\textrm{x}_{11},\ldots,\textrm{x}_{1n_1}$ and $\textrm{x}_{21},\ldots,\textrm{x}_{2n_2}$ be two observed samples where $\textrm{x}_{ij}$ is a $p$ vector from $\sim N_p (\mu_1,\Sigma)$ and $\sim N_p(\mu_2,\Sigma)$ for the two samples respectevely.
From these samples I can find: $\bar{\textrm{x}}_1,\bar{\textrm{x}}_2,S_1,S_2$
where $$S_1=\frac{1}{n_1} \sum_j (\textrm{x}_{1j}-\bar{\textrm{x}}_1)(\textrm{x}_{1j}-\bar{\textrm{x}}_1)'$$ $$S_2=\frac{1}{n_2} \sum_j (\textrm{x}_{2j}-\bar{\textrm{x}}_2)(\textrm{x}_{2j}-\bar{\textrm{x}}_2)'$$ I have that if I let $\mu_1-\mu_2=\delta,$ $$ \bar{\textrm{x}}_1-\bar{\textrm{x}}_2 \sim N_p\left( \delta, \frac{n_1+n_2}{n_1n_2}\Sigma \right)$$
Assume weighted covariance matrix $S=\frac{1}{n_1+n_2}(n_1S_1+n_2S_2)$.
How is the $S$ distributed? I know it should be Wishart distribution, but I'm not sure how. I think that $n_1S_1 \sim (n_1,\Sigma)$ or $(n_1-1,S_1)$ if $S_1$ is an estimate of $\Sigma$ and the same argument for $n_2S_2 \sim (n_2,\Sigma)$ My guess is: $S\sim (n_1+n_2-2,\Sigma)$, but I don't fully understand why.
Now I'm having trouble with with $T^2$ distribution. My notes only tell me what to do when $\textrm{x}\sim N(\mu,\Sigma)$. But in our case $ \bar{\textrm{x}}_1-\bar{\textrm{x}}_2 \sim N_p(\delta, \frac{n_1+n_2}{n_1n_2}\Sigma)$. Thus I tried to bring it into the form $N(\mu,\Sigma)$.
$$\frac{\sqrt{n_1n_2}(\bar{\textrm{x}}_1-\bar{\textrm{x}}_2)}{\sqrt{n_1+n_2}} \sim N_p(\delta, \Sigma)$$ and by the theorem in the book I should try:
$$t^2=(n_1+n_2-2) \left(\frac{\sqrt{n_1n_2} (\bar{\textrm{x}}_1-\bar{\textrm{x}}_2)}{\sqrt{n_1+n_2}} -\delta\right) S^{-1} \left( \frac{\sqrt{n_1n_2} (\bar{\textrm{x}}_1-\bar{\textrm{x}}_2)}{\sqrt{n_1+n_2}}-\delta\right)'$$
But my book has the solution:
$$t^2=\frac{n_1n_2(n_1+n_2-2)}{(n_1+n_2)^2}(\bar{\textrm{x}}_1-\bar{\textrm{x}}_2-\delta)S^{-1}(\bar{\textrm{x}}_1-\bar{\textrm{x}}_2-\delta)'\sim T^2_{p,n_1+n_2-2}$$