In mathematics, an **elementary matrix** is a matrix which differs from the identity matrix by one single elementary row operation. The elementary matrices generate the general linear group GL_{n}(**F**) when **F** is a field. Left multiplication (pre-multiplication) by an elementary matrix represents **elementary row operations**, while right multiplication (post-multiplication) represents **elementary column operations**.

Elementary row operations are used in Gaussian elimination to reduce a matrix to row echelon form. They are also used in Gauss–Jordan elimination to further reduce the matrix to reduced row echelon form.

There are three types of elementary matrices, which correspond to three types of row operations (respectively, column operations):

- Row switching
- A row within the matrix can be switched with another row.

- Row multiplication
- Each element in a row can be multiplied by a non-zero constant. It is also known as
*scaling*a row.

- Row addition
- A row can be replaced by the sum of that row and a multiple of another row.

If E is an elementary matrix, as described below, to apply the elementary row operation to a matrix A, one multiplies A by the elementary matrix on the left, EA. The elementary matrix for any row operation is obtained by executing the operation on the identity matrix. This fact can be understood as an instance of the Yoneda lemma applied to the category of matrices.^{[1]}

The first type of row operation on a matrix A switches all matrix elements on row i with their counterparts on a different row j. The corresponding elementary matrix is obtained by swapping row i and row j of the identity matrix.

So T_{i,j} A is the matrix produced by exchanging row i and row j of A.

Coefficient wise, the matrix T_{i,j} is defined by :

- The inverse of this matrix is itself:
- Since the determinant of the identity matrix is unity, It follows that for any square matrix A (of the correct size), we have
- For theoretical considerations, the row-switching transformation can be obtained from row-addition and row-multiplication transformations introduced below because

The next type of row operation on a matrix A multiplies all elements on row i by m where m is a non-zero scalar (usually a real number). The corresponding elementary matrix is a diagonal matrix, with diagonal entries 1 everywhere except in the ith position, where it is m.

So *D _{i}*(

Coefficient wise, the *D _{i}*(

- The inverse of this matrix is given by
- The matrix and its inverse are diagonal matrices.
- Therefore, for a square matrix A (of the correct size), we have

The final type of row operation on a matrix A adds row j multiplied by a scalar m to row i. The corresponding elementary matrix is the identity matrix but with an m in the (*i, j*) position.

So *L _{ij}*(

Coefficient wise, the matrix *L _{i,j}*(

- These transformations are a kind of shear mapping, also known as a
*transvections*. - The inverse of this matrix is given by
- The matrix and its inverse are triangular matrices.
- Therefore, for a square matrix A (of the correct size) we have
- Row-addition transforms satisfy the Steinberg relations.

- Gaussian elimination
- Linear algebra
- System of linear equations
- Matrix (mathematics)
- LU decomposition
- Frobenius matrix

**^**Perrone (2024), pp. 119–120

- Axler, Sheldon Jay (1997),
*Linear Algebra Done Right*(2nd ed.), Springer-Verlag, ISBN 0-387-98259-0 - Lay, David C. (August 22, 2005),
*Linear Algebra and Its Applications*(3rd ed.), Addison Wesley, ISBN 978-0-321-28713-7 - Meyer, Carl D. (February 15, 2001),
*Matrix Analysis and Applied Linear Algebra*, Society for Industrial and Applied Mathematics (SIAM), ISBN 978-0-89871-454-8, archived from the original on 2009-10-31 - Perrone, Paolo (2024),
*Starting Category Theory*, World Scientific, doi:10.1142/9789811286018_0005, ISBN 978-981-12-8600-1 - Poole, David (2006),
*Linear Algebra: A Modern Introduction*(2nd ed.), Brooks/Cole, ISBN 0-534-99845-3 - Anton, Howard (2005),
*Elementary Linear Algebra (Applications Version)*(9th ed.), Wiley International - Leon, Steven J. (2006),
*Linear Algebra With Applications*(7th ed.), Pearson Prentice Hall - Strang, Gilbert (2016),
*Introduction to Linear Algebra*(5th ed.), Wellesley-Cambridge Press, ISBN 978-09802327-7-6