Sum of squares model proof

#1
Hello everyone :)

I'm trying my best to prove the formula for the sum of squares model (please excuse how badly i'm going to write this)

Betahat'X'Y-n(ybar)squared

so far i have that it is equal to (yhat-ybar)'(yhat-ybar) so i just need to show that they equal eachother.

I know that both yhat transpose and yhat = X(X'X)-1X'
It just isn't working out for me at all and if i could get some help I would be extremely extremely grateful :)