In linear algebra, an idempotent matrix is a matrix which, when multiplied by itself, yields itself.[1][2] That is, the matrix is idempotent if and only if . For this product to be defined, must necessarily be a square matrix. Viewed this way, idempotent matrices are idempotent elements of matrix rings.