Category Archives: Linear Algebra

Hat Matrix: Sum of Elements

Let H := X(X^tX)^{-1}X^t be the hat matrix corresponding to the linear regression problem with design matrix X of full rank. Prove that the elements of any column (or row) of H sum up to 1.

Proof. The matrix H is the projection matrix onto the column space of X. But the first column of X is all ones; denote it by u. This implies that Hu = u, because a projection matrix is idempotent. The i-th coordinate of Hu is the sums of elements of the i-th row of H, so we claim is true for rows. By the symmetry of H, it must also be true for columns. We are done.