# Distribution of sum of squared deviations

So, given $$X_1, \ldots, X_n \stackrel{iid}{\sim} N(\mu, \sigma^2)$$, I want to find the joint distribution of $$\bar{X} = \frac{1}{n}\sum_{i=1}^n x_i$$ and $$S^2 = \sum_{i=1} (X_i - \bar{X})^2$$ (it is intentional that there is no 1/n or 1/(n-1) in this expression). Now, I know that $$\bar{X}$$ and $$S^2$$ are independent, that $$\bar{X} \sim N(\mu, \sigma^2/n)$$ and $$S^2/\sigma^2 \sim \chi^2(n-1)$$. So it would be easy if I wanted to find the joint distribution of $$\bar{X}$$ and $$S^2/\sigma^2$$, but I don't want that.

I know I can write down $$Y = S^2/\sigma^2$$ and then say $$f_Y(y) = \frac{1}{2^{(n-1)/2}\Gamma(\frac{n-1}{2})} y^{(n-1)/2} e^{-y/2}.$$

So then how do I get the distribution of $$S^2$$ from this? Is it as easy as writing $$f_{S^2}(s) = \frac{1}{2^{(n-1)/2}\Gamma(\frac{n-1}{2})} (s^2/\sigma^2)^{(n-1)/2} e^{-(s^2/\sigma^2)/2}$$

or is there more that I have to do?

Then, once I have this pdf I know I can just multiply the two PDFs to get the joint distribution. But is this distribution for $$S^2$$ correct? Do I have to multiply by a factor of $$|\frac{d}{ds} \frac{s^2}{\sigma^2}|$$? This is one thing that I thought I may have to do, but I am not sure.

• This is easier than you might think, because you are just rescaling the marginals. But your formulas aren't quite correct, because you have ignored the probability element. See, in particular, the "Scaling" section in my post at stats.stackexchange.com/a/495347/919.
– whuber
Jan 29, 2021 at 23:58
• @whuber Thanks, but I am not sure I really understand--I think that the derivative at the end of my question is the same as the scaling factor you've mentioned in the linked post. My understanding of the derivative here (and in higher-dimensional transformations, the Jacobian) is that they represent how the transformation "stretches" the space. So is my instinct to use this derivative correct? Jan 30, 2021 at 0:23

Let's ease the notation a bit and say we want the PDF of $$Z=\alpha Y$$, ($$\alpha\geq 0)$$, and we know $$f_Y(y)$$. Then, $$F_Z(z)=P(Z\leq z)=P(Y\leq z/\alpha)=F_Y(z/\alpha)$$
If we differentiate both sides by $$z$$, LHS will be $$f_Z(z)$$, and RHS will be $$\frac{f_Y(z/\alpha)}{\alpha}$$.
In this question, $$\alpha=\sigma^2$$, $$Z=S^2$$, and you already calculated $$f_Y(z/\alpha)$$, but forgot about the factor $$1/\alpha=1/\sigma^2$$.