Matrices with elements in a ring form a ring.
Suppose $(R, +, \cdot )$ is a ring.
Given $A, B \in R^{n \times n}$, define the
binary operation $\bar{+}: R^{n \times n}
\times R^{n \times n} \to R^{n \times }$ by
\[
\left[A \; \bar{+} \; B\right]_{ij} = A_{ij} + B_{ij}
\] \[
\left[A \; \bar{\cdot } \; B\right]_{ij} = \sum_{k = 1}^{n}
A_{ik}B_{kj}
\]
The additive identity of the ring is the matrix $0 \in R^{n \times n}$ for which $0_{ij} = 0 \in R$. The multiplicative identity the matrix $I$ for which $I_{ii} = 1 \in R$ for $i = 1, \dots , n$ and $I_{ij} = 0 \in R$ for $i \neq j = 1, \dots , n$. As seen with real-valued matrices, multiplication on $R^{n \times n}$ need not be commutative even if $R$ is.