I am currently trying to solve the following problem which will ultimately help me finish a larger proof. Here is the equality that I am trying to calculate:
Here is my thought process so far. I will have to algebratically work with the sum on the left hand side of the equation, until all the $y_{i}^2$ terms can be collected into a single sum, and same with all the $y_{i}y_{j}$ terms (s.t $i\neq j$. But I am getting stuck on where to begin here, factoring the square and using the linearity property of summations seems to be wrong when trying to work to the right side. Is there some algebraic trick that I'm not recognizing?

Expanding the quadratic gives:
$$\begin{equation} \begin{aligned} \sum_i (y_i - \bar{y})^2 &= \sum_i (y_i^2 - 2 \bar{y} y_i + \bar{y}^2) \\[6pt] &= \sum_i y_i^2 - 2 \bar{y} \sum_i y_i + n \bar{y}^2 \\[6pt] &= \sum_i y_i^2 - 2n \bar{y}^2 + n \bar{y}^2 \\[6pt] &= \sum_i y_i^2 - n \bar{y}^2. \\[6pt] \end{aligned} \end{equation}$$
Now, substituting the sample mean with its definition as a sum gives:
$$\begin{equation} \begin{aligned} \sum_i (y_i - \bar{y})^2 &= \sum_i y_i^2 - n \Big( \frac{1}{n} \sum_i y_i \Big)^2 \\[6pt] &= \sum_i y_i^2 - \frac{1}{n} \Big( \sum_i y_i \Big)^2 \\[6pt] &= \sum_i y_i^2 - \frac{1}{n} \sum_i \sum_j y_i y_j \\[6pt] &= \sum_i y_i^2 - \frac{1}{n} \sum_i y_i^2 - \frac{1}{n} \sum_{i \neq j} y_i y_j \\[6pt] &= \frac{n-1}{n} \sum_i y_i^2 - \frac{1}{n} \sum_{i \neq j} y_i y_j. \\[6pt] \end{aligned} \end{equation}$$