S(\alpha, \beta) = \left( \sum_i^n x_i^2 \right) \alpha^2 + n\beta^2 + 2 \left( \sum_i^n x_i \right)\alpha \beta - 2 \left( \sum_i^n x_i y_i \right)\alpha - 2 \left( \sum_i^n y_i \right)\beta + \sum_i^n y_i^2