Matrix ring

In abstract algebra, a matrix ring is a set of matrices with entries in a ring "R" that form a ring under matrix addition and matrix multiplication . The set of all matrices with entries in "R" is a matrix ring denoted M"n"("R") (alternative notations: Mat"n"("R") and ). Some sets of infinite matrices form infinite matrix rings. Any subring of a matrix ring is a matrix ring. Over a rng, one can form matrix rngs.
When "R" is a commutative ring, the matrix ring M"n"("R") is an associative algebra over "R", and may be called a matrix algebra. In this setting, if "M" is a matrix and "r" is in "R", then the matrix "rM" is the matrix "M" with each of its entries multiplied by "r".
Matrix semiring.
In fact, "R" needs to be only a semiring for M"n"("R") to be defined. In this case, M"n"("R") is a semiring, called the matrix semiring. Similarly, if "R" is a commutative semiring, then M"n"("R") is a .
For example, if "R" is the Boolean semiring (the two-element Boolean algebra "R" = {0,1} with 1 + 1 = 1), then M"n"("R") is the semiring of binary relations on an "n"-element set with union as addition, composition of relations as multiplication, the empty relation (zero matrix) as the zero, and the identity relation (identity matrix) as the unit.