Intermediate step is missing the squared - Regression Models - Relation between R^2 and r

Missing the squared numerator

```latex
$$\frac{\sum_{i=1}^n  (\hat Y_i - \bar Y)^2}{\sum_{i=1}^n (Y_i - \barY)^2}
= \hat \beta_1^2  \frac{\sum_{i=1}^n(X_i - \bar X)^2}{\sum_{i=1}^n (Y_i- \bar Y)^2}$$
```
where
```latex
$$(\hat Y_i - \bar Y) = \hat \beta_1  (X_i - \bar X)$$
```