# Finding the distribution of $\frac{1}{\sigma^2}\Big( \sum_i^m (X_i-\bar{X})^2+\sum_j^m (Y_i-\bar{Y})^2 \Big)$ where $X_i$ is from a normal sample

Let $X_1,...,X_m$ and $Y_1,...,Y_n$ be independent random samples from normal distributions $N(\mu_1,\sigma^2)$, $N(\mu_2,\sigma^2)$ respectively, where all parameters are unknown.

Let $$S^2=(m+n-2)^{-1}\Big( \sum_i^m (X_i-\bar{X})^2+\sum_j^m (Y_i-\bar{Y})^2 \Big)$$

Can anyone help me find the distributions of:

$$(m+n-2)S^2/\sigma^2\tag{1}$$ And $$\frac{\bar{X}-\bar{Y}-(\mu_1-\mu_2)}{\sqrt{S^2(\frac{1}{m}+\frac{1}{n})}}\tag{2}$$

For $(2)$ I am having no real luck at all. With $(1)$ I have the obvious step of writing $$(m+n-2)S^2/\sigma^2=\frac{1}{\sigma^2}\Big( \sum_i^m (X_i-\bar{X})^2+\sum_j^m (Y_i-\bar{Y})^2 \Big)$$ On the RHS is there some connection with the variance of $X$ and $Y$?

$$(m+n-2)S^2/\sigma^2=\frac{1}{\sigma^2}\Big( \frac{\alpha^2}{m-1}+\frac{\beta^2}{n-1}\Big)$$ Where $\alpha^2,\beta^2$ are the sample variance for $X$ and $Y$ which we can relate to the addition of 2 chi square distributions? i.e. $\chi_{m-1}^2+\chi_{n-1}^2=\chi_{m+n-2}^2$

-

Your notation $\sum_j^m (Y_i-\bar{Y})^2$ is a bit odd. Maybe you meant $\sum_{j=1}^m (Y_j-\bar{Y})^2$ or $\sum_1^m (Y_i-\bar{Y})^2$?
Anyway, if you know that $$\frac{1}{\sigma^2} \sum_{i=1}^n (X_i - \bar X)^2 \sim \chi^2_{n-1},$$ (and you seem to suggest that you do know that) then exactly the same reasoning leads to $$\frac{1}{\sigma^2} \sum_{i=1}^m (Y_i - \bar Y)^2 \sim \chi^2_{m-1},$$ and then, since they're independent, their sum is distributed at $\chi^2_{n+m-2}$.
The numerator in (2) is distributed as $N\left( 0, \dfrac{\sigma^2}{n} + \dfrac{\sigma^2}{m} \right)$. So that numerator divided by $\sigma$ is distibuted as $N\left( 0, \dfrac 1n + \dfrac 1m\right)$. Hence that numerator divided by $\sigma\sqrt{\dfrac 1n + \dfrac 1m}$ is distributed as $N(0,1)$. Since you've divided by $\sigma$ both on top and on the bottom, the $\sigma$ cancels out and you've actually got a statistic, i.e. a random variable whose value can be found by knowing the $X$s and the $Y$s without knowing $\sigma$ or the $\mu$s.
Hence you've got $$\frac{Z}{\sqrt{\chi^2/\mathrm{d.f.}}}.$$ Moreover (the harder part, maybe?) the numerator and denominator are independent. To see that, notice that $(\bar X, X_i-\bar X)$ are not merely a pair of normally distributed random variables, but the pair is jointly normally distributed, since both components are linear combinations of the same set of independent normals. That implies they're independent if they're uncorrelated. So compute their covariance.