# Square Matrix **A [[matrix]] with an equal number of rows and columns.** ![[SquareMatrix.svg|450]] *A square matrix of order $n$* A **square matrix** is a [[matrix]] with an *equal number* of rows and columns. The number of rows and columns is known as the order of the matrix. There exists special types of square matrices defined by having useful properties as well as additional operations only defined for square matrices. The *main diagonal* of a square matrix are the entries from the top left to the bottom right of the matrix, that is, all entries of the form $a_{ii}$. ## Types ### Diagonal matrix ![[SquareMatrixDiagonal.svg|450]] *A diagonal matrix of order $n$* > [!NOTE] Diagonal matrix > A **diagonal matrix** is a square matrix in which all entries *outside* the main diagonal are equal to zero. #### Identity matrix ![[SquareMatrixIdentity.svg|500]] *An identity matrix of order $n$* > [!NOTE] Identity matrix > An **identity matrix** is a special type of diagonal matrix in which all entries on the diagonal are *equal to one*. > > An $n\times n$ identity matrix is denoted as $\mathbf{I}_{n}$ or $\mathbf{I}$ if its size is irrelevant. Identity matrices may also be denoted as $\mathbf{1}$. The identity matrix is defined such that if it represented a [[linear transformation]], any object that undergoes the transformation remains *unchanged*. It is also defined such that [[Matrix Multiplication|multiplying]] it with any matrix is analogous to multiplying real and [[Complex Number|complex]] numbers with their *multiplicative identity*, that is, one. > For any $m\times n$ matrix $\mathbf{A}$, > $\mathbf{I}_{m}\mathbf{A}=\mathbf{AI}_{n}=\mathbf{A}$ ### Triangular matrix ![[SquareMatrixTriangular.svg]] > [!NOTE] Triangular matrix > An **upper** or **right triangular matrix** is a square matrix in which all entries *below* the main diagonal are equal to zero. It is denoted either $\mathbf{U}$ or $\mathbf{R}$. > > A **lower** or **left triangular matrix** is a square matrix in which all entries *above* the main diagonal are equal to zero. It is denoted as $\mathbf{L}$. ### Invertible and inverse matrix > [!NOTE] Invertible and inverse matrix > An $n\times n$ matrix $\mathbf{A}$ is **invertible** if there exists an $n\times n$ matrix $\mathbf{B}$ such that > $\mathbf{AB}=\mathbf{BA}=\mathbf{I}_{n}$ > > $\mathbf{B}$ is a *unique matrix* and is known as the **inverse matrix** of $\mathbf{A}$. A square matrix that contains entries in a [[field]] and are not invertible are known as *singular* or *degenerate* and has a zero [[determinant]]. ### Symmetric and skew-symmetric matrix > [!NOTE] Symmetric matrix > A **symmetric matrix** is a square matrix which is *equal* to its [[Matrix#Transposition|transpose]]. > $\mathbf{A}=\mathbf{A}^{\text{T}}$ > In terms of the entries of the matrix, for every $i,j$, > $a_{ij}=a_{ji}$ > [!NOTE] Skew-symmetric matrix > A **skew-symmetric matrix** is a square matrix whose transpose is equal to its *negative*. > $\mathbf{A}=-\mathbf{A}^{\text{T}}$ > In terms of the entries of the matrix, for every $i,j$, > $a_{ij}=-a_{ji}$ ## Operations The following operations are only defined for square matrices. ### Trace > [!NOTE] Trace > The **trace** of an $n\times n$ matrix $\mathbf{A}$ is the sum of the entries of its main diagonal, that is, > $\operatorname{tr}(\mathbf{A})=\sum_{i=1}^{n}a_{ii}=a_{11}+a_{22}+\cdots+a_{nn}$ > The trace of a matrix is equal to the trace of its transpose > $\operatorname{tr}(\mathbf{A})=\operatorname{tr}(\mathbf{A}^{\text{T}})$ > The trace of the [[Matrix Multiplication|product]] of two matrices is independent of the order of the matrices. > $\operatorname{tr}(\mathbf{AB})=\operatorname{tr}(\mathbf{BA})$ ### Determinant The [[determinant]] of a square matrix is a scalar that represents some properties of the matrix. It is equal to the *signed volume* of the parallelotope whose sides are defined by vectors corresponding to the columns of the matrix. ![[DeterminantParallelotopes.svg]] *The parallelotopes whose signed volumes are equal to the determinants of a $2\times 2$ and $3\times 3$ matrix.*