I am trying to prove that $R^2 $ statistic $=$ the square of the correlation between X and Y
For simplicity, I am able to assume that $\bar{x} = \bar{y} = 0$
What I have so far:
$R^2 = \frac{\sum_{i = 1}^{n} (y_{i} - \bar{y})^2 - \sum_{i=1}^{n} (y_{i}- \hat{y})^2} {\sum_{i=1}^{n}(y_{i} - \bar{y})^2} $
$(cor(X, Y))^2 = (\frac{\sum_{i=1}^{n}(x_{i} - \bar{x})(y_{i} - \bar{y})} {\sqrt{\sum_{i=1}^{n}(x_{i} - \bar{x})^2} \sqrt{\sum_{i=1}^{n}(y_{i} - \bar{y})^2}})^2 = \frac{?}{\sum_{i=1}^{n}(x_{i})^2\sum_{i=1}^{n}(y_{i})^2}$
I am stuck on how to square the numerator to try to prove this case. I read online that in order to square summations, you must add an additional variable $j$ where $i < j$ in the second summation. However I am confused on how to use that information in this case. I know the proof is probably trivial