GIC interview question

Deriving the solution of simple linear regression,