Quadratic Forms and Idempotent Matrices