
Square Matrices
In linear algebra, a square matrix, as its name suggests, is a matrix with equal numbers of rows and columns. The concept is rather intuitive, with a matrix of order 3, for instance, appearing as follows:
When a matrix carries n rows and n columns, we refer to it as a square matrix of order n.
Here's a practical example.
This matrix has three rows and three columns.
$$ \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{pmatrix} $$
Hence, it's an order-3 square matrix.
Square matrices play a fundamental role not just in linear algebra but across various mathematical fields, owing to their useful properties in numerous scientific and engineering applications.
The Diagonals of a Square Matrix
Every square matrix features two distinct diagonals
- The main diagonal
The main diagonal comprises the elements of the matrix that stretch from the first element of the first row to the last element of the last row.For instance, in this matrix, the main diagonal includes the values 1, 5, and 9 $$ \begin{pmatrix} \color{red}1 & 2 & 3 \\ 4 & \color{red}5 & 6 \\ 7 & 8 & \color{red}9 \end{pmatrix} $$
- The secondary diagonal (or antidiagonal)
The secondary diagonal represents the elements of the matrix that span from the last element of the first row to the first element of the last row.For instance, in this matrix, the secondary diagonal includes the values 3, 5, and 7 $$ \begin{pmatrix} 1 & 2 & \color{red}3 \\ 4 & \color{red}5 & 6 \\ \color{red}7 & 8 & 9 \end{pmatrix} $$
Types of Square Matrices
There are several special types of square matrices.
Each of these matrices carries unique properties, making them invaluable in various mathematical and scientific contexts.
- Diagonal matrices
A square matrix is considered diagonal if all elements outside the main diagonal are zero.
For instance, in this matrix, non-zero elements only appear on the main diagonal. Hence, it's a diagonal matrix $$ \begin{pmatrix} 1 & 0 & 0 \\ 0 & 5 & 0 \\ 0 & 0 & 9 \end{pmatrix} $$
- Upper and lower triangular matrices
A square matrix is defined as upper triangular if all elements below the main diagonal are zero, and lower triangular if all elements above the main diagonal are zero.
For instance, in this matrix, zero elements appear below the main diagonal. Hence, it's an upper triangular matrix. $$ \begin{pmatrix} 1 & 2 & 3 \\ 0 & 5 & 6 \\ 0 & 0 & 9 \end{pmatrix} $$ Conversely, in this matrix, zero elements appear above the main diagonal. Therefore, it's a lower triangular matrix. $$ \begin{pmatrix} 1 & 0 & 0 \\ 4 & 5 & 0 \\ 7 & 8 & 9 \end{pmatrix} $$
- Identity matrices
The identity matrix is a unique square matrix where all elements on the main diagonal are 1, and all other elements are 0. It is a neutral element for matrix multiplication.For example, in this matrix, the elements on the main diagonal are 1 while all others are 0. Thus, it is an identity matrix. $$ \begin{pmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{pmatrix} $$
- Invertible Matrices
A matrix M is invertible if there exists another matrix M-1, referred to as the "inverse matrix", such that the product of the two matrices yields the identity matrix. $$ M \cdot M^{-1} = I $$For instance, this matrix M is invertible $$ \begin{pmatrix} 1 & 3 \\ 2 & 7 \end{pmatrix} $$ because there exists another matrix M-1 (inverse matrix) $$ \begin{pmatrix} 7 & -3 \\ -2 & 1 \end{pmatrix} $$ such that their product equals the identity matrix $$ M \cdot M^{-1} = \begin{pmatrix} 1 & 3 \\ 2 & 7 \end{pmatrix} \cdot \begin{pmatrix} 7 & -3 \\ -2 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} $$ Not all square matrices are invertible, i.e., possess an inverse matrix. For instance, square matrices with a null determinant are non-invertible.
- Symmetric Matrices
A symmetric matrix is a square matrix in which elements above the main diagonal mirror those below the main diagonal.For example, this is a symmetric square matrix. $$ \begin{pmatrix} 1 & \color{red}2 & \color{blue}3 \\ \color{red}2 & 5 & \color{green}6 \\ \color{blue}3 & \color{green}6 & 9 \end{pmatrix} $$ Essentially, the matrix is equal to its transpose.$$ M = M^T $$
- Antisymmetric Matrices
An antisymmetric (or skew-symmetric) matrix is a square matrix in which elements above the main diagonal are the opposite of those mirrored below the main diagonal.Esempio. For instance, this is an antisymmetric square matrix. $$ \begin{pmatrix} 1 & \color{red}2 & \color{blue}3 \\ -\color{red}2 & 5 & -\color{green}6 \\ - \color{blue}3 & \color{green}6 & 9 \end{pmatrix} $$ In essence, the matrix is equal to the opposite of its transpose. $$ M = -M^T $$
Operations with Square Matrices
Square matrices can be added, subtracted, and multiplied together, provided they share the same order, i.e., the same number of rows and columns.
For example, here's an instance of addition between two square matrices of order 2 $$ \begin{pmatrix} 2 & 3 \\ 5 & -1 \end{pmatrix} + \begin{pmatrix} 1 & 4 \\ 2 & 7 \end{pmatrix} = \begin{pmatrix} 2+1 & 3+4 \\ 5+2 & -1+7 \end{pmatrix} = \begin{pmatrix} 3 & 7 \\ 7 & 6 \end{pmatrix} $$
Useful Concepts of Square Matrices
- Trace
The trace of a square matrix is the sum of elements on its main diagonal. The determinant of a square matrix is a unique value calculated from all the matrix's elements.For example, in this matrix, the elements on the main diagonal are 1, 5, 9 $$ \begin{pmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 6 & 7 & 9 \end{pmatrix} $$ Therefore, the trace of the matrix is the sum 1+5+9, i.e., 15 $$ TR_M = 1+5+9 = 15 $$
- Determinant
The determinant is a number associated with the matrix. It's quite useful as it allows you to understand if the matrix has an inverse matrix and enables you to solve a system of linear equations.For instance, the determinant of this matrix is -2 $$ M= \begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix} $$ because $$ \det(M) = 1 \cdot 4 - 2 \cdot 3 = 4 - 6 = -2 $$ Hence, the matrix M is invertible. To learn how to calculate the determinant of a square matrix, I recommend reading our lesson dedicated to calculating the determinant.
- Eigenvalues and Eigenvectors
Another key concept in linear algebra is that of eigenvalues and eigenvectors. An eigenvalue of a square matrix is a scalar λ that satisfies the equation Ax = λx, where A is the square matrix and x is a non-zero vector referred to as the eigenvector.
These are just some of the features and operations you can calculate in a square matrix.