Completing the square for 2x2, 3x2, ... terms