The internally studentised residuals $r_i$

Suppose $$Y = X \beta + \epsilon$$ where $$\epsilon \sim N(0, \sigma^2I)$$. Show that for the internally studentised residuals $$r_i$$ defined as $$r_i = \frac{\hat{\epsilon}_i}{\hat{\sigma}\sqrt{1-h_{ii}}}$$ the expression $$\frac{r_i^2}{(n-p)}$$ has the $$Beta(\frac{1}{2},\frac{(n-p-1)}{2})$$ distribution where $$p = rank(X)$$.

How can I prove it?

I have the following hints:

(i) Recall that the $$Beta(p,q)$$ distribution is defined as the distribution of $$\frac{U}{U+V}$$ where $$U$$ and $$V$$ are independent, and $$U \sim Gamma(p,\lambda), V \sim Gamma(q,\lambda)$$.

(ii) Let $$e_i$$ be the $$n$$-dimensional vector whose only nonzero component is a $$1$$ in the $$i$$-th position, and note that $$\hat{\epsilon}_i = e_i^T (I-H)Y$$.

(iii) Define $$P = I - H$$ and $$P_1 = \frac{Pe_i e_i^TP}{1-h_{ii}}$$ and $$U = Y'P_1Y$$ and $$V = Y'(P-P_1)Y$$. Show that $$U$$ and $$V$$ are independent and have Gamma distributions.