# Prove using correlation to do t-test is equivalent to the standard t-test formula in linear regression?

$\newcommand{\Cor}{\operatorname{Cor}} \newcommand{\Cov}{\operatorname{Cov}}$My question is why the following expression holds?

$$t = \frac{\hat{\beta_1}}{\operatorname{se}(\beta_1)} = \frac{\Cor(Y,X)\sqrt{n-2}}{\sqrt{1 - \Cor^2(Y,X)}}$$

Here is what I got so far:

\begin{align} \frac{\hat{\beta_1}}{\operatorname{se}(\beta_1)} &= \frac{\frac{\Cov(Y,X)}{S_x^2}}{\operatorname{se}(\beta_1)}\\ &= \frac{\frac{\Cov(Y,X)}{S_x^2}}{\sqrt{\frac{\sum(\hat{Y_i} - Y_i)^2}{n-2}\cdot\frac{1}{\sum(X_i - \overline{X})^2}}}\\ &= \frac{\frac{\Cov(Y,X)}{S_x^2}\sqrt{n-2}}{\sqrt{\frac{\sum(\hat{Y_i} - Y_i)^2}{\sum(X_i - \overline{X})^2}}}\label{a}\tag{1} \end{align}

\begin{align} \frac{\Cor(Y,X)\sqrt{n-2}}{\sqrt{1 - \Cor^2(Y,X)}} &= \frac{\frac{\Cov(Y, X)}{S_xS_y}\sqrt{n-2}}{\sqrt{1 - \left(\frac{\Cov(Y, X)}{S_xS_y}\right)^2}} \label{b}\tag{2} \end{align}

From $\ref{a}$ and $\ref{b}$, we then need to show:

\begin{align} \frac{1}{S_x\sqrt{\frac{\sum(\hat{Y_i} - Y_i)^2}{\sum(X_i - \overline{X})^2}}} &= \frac{1}{S_y\sqrt{1 - \left(\frac{\Cov(Y, X)}{S_xS_y}\right)^2}}\\ &=\frac{1}{S_y\frac{\sqrt{S_x^2S_y^2 -\Cov^2(Y, X)}}{S_xS_y}}\\ &=\frac{1}{\frac{\sqrt{S_x^2S_y^2 -\Cov^2(Y, X)}}{S_x}}\label{c}\tag{3} \end{align}

I tried to expand the $\Cov(Y, X)$ term and left $SSE$ and $SSX$ terms in $\ref{c}$, but there is no any further process.

I am wondering how to continue from $\ref{c}$, or my initial direction of the proof is not correct?

The trick is the following equation:$$\sum(\hat{Y_i} - Y_i)^2 = SSE = (1 - R^2)SST$$

This is why there is a $\sqrt{1 - \Cor^2(Y,X)}$ term in $(2)$. The whole proof is below:

\begin{align} t &= \frac{\hat{\beta_1}}{\operatorname{se}(\beta_1)}\\ &= \frac{\frac{\Cov(Y,X)}{S_x^2}}{\sqrt{\frac{\sum(\hat{Y_i} - Y_i)^2}{n-2}\cdot\frac{1}{\sum(X_i - \overline{X})^2}}}\\ &= \frac{\frac{\Cov(Y,X)}{S_x^2}}{\sqrt{\frac{(1 - R^2)SST}{n-2}\cdot\frac{1}{\sum(X_i - \overline{X})^2}}}\\ &= \frac{\frac{\Cov(Y,X)}{S_x^2}}{\sqrt{\frac{(1 - R^2)S_y^2(n-1)}{n-2}\cdot\frac{1}{S_x^2(n-1)}}}\\ &= \frac{\frac{\Cov(Y,X)}{S_x^2}}{\frac{S_y}{S_x}\frac{\sqrt{1 - R^2}}{\sqrt{n - 2}}}\\ &= \frac{\frac{\Cov(Y,X)}{S_yS_x}\sqrt{n-2}}{\sqrt{1 - R^2}}\\ &= \frac{\Cor(Y,X)\sqrt{n-2}}{\sqrt{1 - \Cor^2(Y,X)}} \end{align}