# Introductory Linear Algebra/Matrices

## Motivation

One important application for matrices is solving systems of linear equations. Some of the following definitions may be viewed as 'designed for solving system of linear equations'.

## Some terminologies

Definition.

(Matrix) A matrix (plural: matrices) is a rectangular array of numbers. A horizontal unit is a row, and a vertical unit is a column. The element in the ${\displaystyle \color {blue}i}$th row and the ${\displaystyle \color {red}j}$th column is the ${\displaystyle ({\color {blue}i},{\color {red}j})}$th entry of the matrix.

An ${\displaystyle m\times n}$ (read 'm by n') is a matrix with ${\displaystyle m}$ rows and ${\displaystyle n}$ columns, and ${\displaystyle m\times n}$ is the size of the matrix. The rows are counted from the top, and the columns are counted from the left. If the size of a matrix is ${\displaystyle 1\times 1}$, we simply refer to this matrix as a number, and no brackets are needed in this case. The set of all ${\displaystyle m\times n}$ matrices with real entries is denoted by ${\displaystyle M_{m\times n}(\mathbb {R} )}$. A capital letter is usually used to denote a matrix, while small letters are used to denote its entries. For example, ${\displaystyle A=(a_{ij})_{m\times n}}$ denotes an ${\displaystyle m\times n}$ matrix ${\displaystyle A}$ with entries ${\displaystyle a_{ij}}$ in which ${\displaystyle 1\leq i\leq \underbrace {m} _{\text{no. of rows}}}$ and ${\displaystyle 1\leq j\leq \underbrace {n} _{\text{no. of columns}}}$. (We may omit the subscript specifying the size of matrix if its size is already mentioned, or its size is not important.)

Definition. (Matrix equality) Two matrices ${\displaystyle A=(a_{ij})_{m\times n}}$ and ${\displaystyle B=(b_{ij})_{k\times \ell }}$ are equal if

1. ${\displaystyle m=k}$,
2. ${\displaystyle n=\ell }$ and
3. ${\displaystyle a_{ij}=b_{ij}}$ for each pair ${\displaystyle (i,j)}$.

We write ${\displaystyle A=B}$ if ${\displaystyle A}$ and ${\displaystyle B}$ are equal.

Remark.

• In other words, if two matrices have the same size and same entries, then they are equal.
• If ${\displaystyle A}$ and ${\displaystyle B}$ are not equal, we write ${\displaystyle A\neq B}$.

Exercise. Consider the following three matrices ${\displaystyle A,B}$ and ${\displaystyle C}$.

${\displaystyle A=(a_{ij})_{m\times n}={\begin{pmatrix}1&2&3\\4&5&6\end{pmatrix}},\quad B=(b_{ij})_{k\times \ell }={\begin{pmatrix}1&4\\2&5\\3&6\end{pmatrix}}\;{\text{and}}\quad C=(c_{ij})_{p\times q}={\begin{pmatrix}1&2&3\\4&5&6\end{pmatrix}}}$

1 Choose correct statement(s) from the following statements.

 ${\displaystyle A=B}$ ${\displaystyle A=C}$ ${\displaystyle B=C}$ ${\displaystyle A=B=C}$ ${\displaystyle A\neq B\neq C}$

2 Choose correct statement(s) from the following statements.

 ${\displaystyle a_{12}=2}$ ${\displaystyle b_{23}=6}$ ${\displaystyle a_{31}=c_{31}=3}$ ${\displaystyle a_{ij}=b_{ji}}$ for each pair ${\displaystyle (i,j)}$

3 Choose correct statement(s) from the following statements.

 ${\displaystyle m=p=2}$ ${\displaystyle n=k=2}$ ${\displaystyle m=\ell =3}$ ${\displaystyle p=q=2}$

Exercise. Let ${\displaystyle A=(a_{ij})}$ be a ${\displaystyle 3\times 2}$ matrix in which each entry ${\displaystyle a_{ij}=i+2j}$. Write down ${\displaystyle A}$ in the form of an array of numbers.

Solution.

${\displaystyle A={\begin{pmatrix}3&5\\4&6\\5&7\end{pmatrix}}.}$

In particular, if a matrix has the same number of rows and columns, then it has some nice properties. In view of the shape of such a matrix (square-like), we define such matrices as square matrices.

Definition. (Square matrix) A square matrix is a matrix with the same number of rows and columns.

We will also introduce a term, namely main diagonal, which will be useful in some situations.

Definition. (Main diagonal) The main diagonal of an ${\displaystyle n\times n}$ matrix (which is a square matrix) is the collection of the ${\displaystyle (1,1)}$th, ${\displaystyle (2,2)}$th, ${\displaystyle \ldots }$, ${\displaystyle (n,n)}$th entries.

Example. The main diagonal of the matrix ${\displaystyle I_{3}={\begin{pmatrix}{\color {green}1}&0&0\\0&{\color {green}1}&0\\0&0&{\color {green}1}\end{pmatrix}}}$ is the collection of ${\displaystyle 1,1}$ and ${\displaystyle 1}$.

Remark. The matrix ${\displaystyle I_{3}}$ is the identity matrix (which will be defined later).

Then, we will define some types of matrices for which the definitions are related to the main diagonal.

Definition. (Triangular matrix) A triangular matrix is an upper triangular matrix or a lower triangular matrix (inclusively).

An upper triangular matrix is a square matrix whose entries below its main diagonal are all ${\displaystyle 0}$.

A lower triangular matrix is a square matrix whose entries above its main diagonal are all ${\displaystyle 0}$.

Remark.

• Equivalently and symbolically, a matrix ${\displaystyle A=(a_{ij})}$ is upper triangular if ${\displaystyle a_{ij}=0}$ whenever ${\displaystyle i>j}$,

and is lower triangular if ${\displaystyle a_{ij}=0}$ if ${\displaystyle i.

• Upper triangular and lower triangular matrices are in the form of

${\displaystyle \underbrace {\begin{pmatrix}*&*&*&\cdots &*\\0&*&*&\cdots &*\\0&0&\ddots &\ddots &\vdots \\\vdots &\vdots &\ddots &\ddots &*\\0&0&\cdots &0&*\end{pmatrix}} _{\text{Upper triangular matrix}}\quad {\text{and}}\quad \underbrace {\begin{pmatrix}*&0&\cdots &0&0\\*&*&0&\cdots &0\\*&*&\ddots &\ddots &\vdots \\\vdots &\vdots &\ddots &\ddots &0\\*&*&\cdots &*&*\end{pmatrix}} _{\text{Lower triangular matrix}}}$ respectively, in which ${\displaystyle *}$ is an arbitrary entry (which may or may not be zero).

Definition. (Diagonal matrix) A diagonal matrix is a square matrix whose entries not lying on the main diagonal are all ${\displaystyle 0}$.

Remark.

• A diagonal matrix is both upper triangular and lower triangular.
• A diagonal matrix has the form

${\displaystyle {\begin{pmatrix}*&0&0&\cdots &0\\0&*&0&\cdots &0\\0&0&\ddots &\ddots &\vdots \\\vdots &\vdots &\ddots &\ddots &0\\0&0&0&\cdots &*\end{pmatrix}}}$ in which ${\displaystyle *}$ is an arbitrary entry.

Exercise.

1 Choose all correct statement(s) from the following statements.

 A matrix whose every entry is ${\displaystyle 0}$ is diagonal matrix. A matrix whose every entry is ${\displaystyle 0}$ is triangular matrix. A diagonal matrix is triangular matrix. A triangular matrix is diagonal matrix. A diagonal matrix is the only type of matrix that is both upper triangular and lower triangular.

2 Choose all upper triangular matrices from the following matrices.

 ${\displaystyle {\begin{pmatrix}1&2&2\\0&2&3\\0&0&1\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}2&0&0\\1&2&0\\3&5&1\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}0&0&1\\0&1&0\\1&0&0\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}1&0&0\\0&2&0\\0&0&3\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}0&1&0&0\\0&0&2&0\\0&0&0&3\end{pmatrix}}}$

3 Choose all lower triangular matrices from the following matrices.

 ${\displaystyle {\begin{pmatrix}1&2&2\\0&2&3\\0&0&1\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}2&0&0\\1&2&0\\3&5&1\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}0&0&1\\0&1&0\\1&0&0\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}1&0&0\\0&2&0\\0&0&3\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}0&1&0&0\\0&0&2&0\\0&0&0&3\end{pmatrix}}}$

4 Choose all triangular matrices from the following matrices.

 ${\displaystyle {\begin{pmatrix}1&2&2\\0&2&3\\0&0&1\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}2&0&0\\1&2&0\\3&5&1\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}0&0&1\\0&1&0\\1&0&0\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}1&0&0\\0&2&0\\0&0&3\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}0&1&0&0\\0&0&2&0\\0&0&0&3\end{pmatrix}}}$

5 Choose all diagonal matrices from the following matrices.

 ${\displaystyle {\begin{pmatrix}1&2&2\\0&2&3\\0&0&1\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}2&0&0\\1&2&0\\3&5&1\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}0&0&1\\0&1&0\\1&0&0\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}1&0&0\\0&2&0\\0&0&3\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}0&1&0&0\\0&0&2&0\\0&0&0&3\end{pmatrix}}}$

The last terminology we mention here is submatrix, which will sometimes be used.

Definition. (Submatrix) Let ${\displaystyle A}$ be a matrix. A submatrix of ${\displaystyle A}$ is a matrix obtained from ${\displaystyle A}$ by removing some rows or columns (inclusively).

Remark. By convention, every matrix is a submatrix of itself.

Exercise.

Choose all submatrices of ${\displaystyle {\begin{pmatrix}3&5&7\\4&6&8\\5&7&9\end{pmatrix}}}$ from the following matrices.

 ${\displaystyle {\begin{pmatrix}3&5&7\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}3&4&5\end{pmatrix}}}$ ${\displaystyle {\begin{pmatrix}3\\4\\5\end{pmatrix}}}$ 2 7 ${\displaystyle {\begin{pmatrix}3&7\\5&9\end{pmatrix}}}$

## Matrix operations

In this section, we will cover different matrix operations. Some operations are quite different from that in the number system, in particular, matrix multiplication.

Definition. (Matrix addition and subtraction) Let ${\displaystyle A=(a_{ij})_{m\times n}}$ and ${\displaystyle B=(b_{ij})_{m\times n}}$ be two matrices of the same size. We define matrix addition and subtraction by

${\displaystyle A\pm B=(a_{ij}\pm b_{ij})_{m\times n}.}$

Definition. (Scalar multiplication of matrix) Let ${\displaystyle A=(a_{ij})_{m\times n}}$ be a matrix. We define the scalar multiplication of the matrix by

${\displaystyle cA=(ca_{ij})_{m\times n}.}$

Then, we are going to define matrix multiplication, which is quite different from the multiplication in the number system.

Definition.

(Matrix multiplication) Let ${\displaystyle A=(a_{ij})_{{\color {blue}m}\times {\color {green}n}}}$ and ${\displaystyle B=(b_{ij})_{{\color {green}n}\times {\color {red}\ell }}}$ be two matrices. The matrix product ${\displaystyle AB}$ of ${\displaystyle A}$ and ${\displaystyle B}$ is defined as the ${\displaystyle {\color {blue}m}\times {\color {red}\ell }}$ matrix whose ${\displaystyle ({\color {purple}i},{\color {brown}j})}$th entry is

${\displaystyle \sum _{k=1}^{n}(a_{{\color {purple}i}k}b_{k{\color {brown}j}})=a_{{\color {purple}i}1}b_{1{\color {brown}j}}+a_{{\color {purple}i}2}b_{2{\color {brown}j}}+\cdots +a_{{\color {purple}i}n}b_{n{\color {brown}j}}.}$
If the number of columns of ${\displaystyle A}$ (${\displaystyle \color {blue}m}$) is different from the number of rows of ${\displaystyle B}$ (${\displaystyle \color {red}\ell }$), then the product ${\displaystyle AB}$ is not defined.

On the other hand, a positive power of a square matrix is defined quite similarly to that in number system.

Definition. (Positive power of a square matrix) Let ${\displaystyle A}$ be a square matrix. The ${\displaystyle p}$th power of ${\displaystyle A}$, written ${\displaystyle A^{p}}$, in which ${\displaystyle p}$ is a positive number, is the product of ${\displaystyle p}$ copies of ${\displaystyle A}$, i.e.,

${\displaystyle A^{p}=\underbrace {AA\cdots A.} _{{\text{product of}}\;p\;{\text{copies of}}\;A}}$

Exercise.

Choose all correct statement(s) from the following statements.

 ${\displaystyle {\begin{pmatrix}1&2&3\\4&5&6\end{pmatrix}}{\begin{pmatrix}1&2\\3&4\\5&6\end{pmatrix}}={\begin{pmatrix}22&28\\49&64\end{pmatrix}}}$. ${\displaystyle {\begin{pmatrix}1&2\\3&4\\5&6\end{pmatrix}}{\begin{pmatrix}1&2&3\\4&5&6\end{pmatrix}}={\begin{pmatrix}22&28\\49&64\end{pmatrix}}}$ ${\displaystyle (a_{ij})_{n\times n}^{2}=(a_{ij}^{2})_{n\times n}}$. ${\displaystyle A+B=B+A}$ for each matrix ${\displaystyle A}$ and ${\displaystyle B}$. ${\displaystyle ((ij)a_{ij})_{m\times n}=ij(a_{ij})_{m\times n}}$.

Then, we will discuss matrix analogs for the numbers zero and one in the number system, namely the zero matrix and the identity matrix, which, in the number system, are analogous to the numbers ${\displaystyle 0}$ and ${\displaystyle 1}$ respectively.

Definition. (Zero matrix) The zero matrix is the ${\displaystyle m\times n}$ matrix whose entries are all ${\displaystyle 0}$, and is denoted by ${\displaystyle O_{m\times n}}$ or simply ${\displaystyle O}$ if there is no ambiguity.

Remark. The zero matrix is analogous to the number ${\displaystyle 0}$ in the number system, because:

1. We have ${\displaystyle O+A=A+O=A}$ for each matrix ${\displaystyle A}$ of the same size as the zero matrix.
2. We have ${\displaystyle OA=AO=O}$ if the products are well-defined, for each matrix ${\displaystyle A}$.

Definition. (Identity matrix) The ${\displaystyle n\times n}$ identity matrix, denoted by ${\displaystyle I_{n}}$ or simply ${\displaystyle I}$ if there is no ambiguity, is the ${\displaystyle n\times n}$ diagonal matrix whose diagonal entries are all ${\displaystyle {\color {green}1}}$.

Remark. The identity matrix is analogous to the number ${\displaystyle 1}$ in the number system, because ${\displaystyle AI=IA=A}$ if the products are well-defined, for each matrix ${\displaystyle A}$.

Example.

• the zero matrix ${\displaystyle O_{2\times 1}}$ is ${\displaystyle {\begin{pmatrix}0\\0\end{pmatrix}}}$
• the identity matrix ${\displaystyle I_{2}}$ is ${\displaystyle {\begin{pmatrix}1&0\\0&1\end{pmatrix}}}$

Proposition. (Properties of matrix operations) Let ${\displaystyle A,B}$ and ${\displaystyle C}$ be matrices such that the following operations are well-defined, and let ${\displaystyle c}$ be a scalar. Then, the following hold.

(i) (associativity of matrix multiplication) ${\displaystyle (AB)C=A(BC)}$.

(ii) (roles of numbers zero and one) ${\displaystyle AO=O,\,OB=O,\,AI=A,\,IB=B}$

(iii) (distributivity of matrix multiplication) ${\displaystyle \underbrace {A(B+C)=AB+AC} _{\text{left distributivity}},\,\underbrace {(A+B)C=AC+BC} _{\text{right distributivity}}}$

(iv) ${\displaystyle c(AB)=(cA)B=A(cB)}$.

Remark. Matrix multiplication is not commutative in general, i.e., the matrix product ${\displaystyle AB}$ is different from the matrix product ${\displaystyle BA}$ in general.

Then, we will introduce an operation that does not exist in the number system, namely transpose.

Definition. (Matrix transpose) Let ${\displaystyle A=(a_{{\color {purple}i}{\color {green}j}})_{{\color {blue}m}\times {\color {red}n}}}$ be a matrix. The transpose of matrix ${\displaystyle A}$ is the matrix

${\displaystyle A^{T}=(a_{{\color {green}j}{\color {purple}i}})_{{\color {red}n}\times {\color {blue}m}}.}$

Remark. We can see from the definition that the transpose of ${\displaystyle 1\times 1}$ matrix is simply itself.

Example.

Let ${\displaystyle A}$ be the matrix ${\displaystyle {\begin{pmatrix}1&2\\3&4\\5&6\end{pmatrix}}}$. Then,

${\displaystyle A^{T}={\begin{pmatrix}1&2\\3&4\\5&6\end{pmatrix}}^{T}={\begin{pmatrix}1&3&5\\2&4&6\end{pmatrix}}\quad {\text{and}}\quad \left(A^{T}\right)^{T}={\begin{pmatrix}1&3&5\\2&4&6\end{pmatrix}}^{T}={\begin{pmatrix}1&2\\3&4\\5&6\end{pmatrix}}=A.}$

Proposition. (Properties of matrix transpose) Let ${\displaystyle A}$ and ${\displaystyle B}$ be matrices such that the following operations are well-defined. Then, the following hold.

(i) (self-invertibility) ${\displaystyle (A^{T})^{T}=A}$

(ii) (linearity) ${\displaystyle (aA+bB)^{T}=aA^{T}+bB^{T}.}$ for each real number ${\displaystyle a}$ and ${\displaystyle b}$

(iii) ('reverse multiplicativity') ${\displaystyle \color {green}(AB)^{T}=B^{T}A^{T}}$

Definition.

(Symmetric matrix) A matrix ${\displaystyle A}$ is a symmetric matrix if

${\displaystyle A^{T}=A.}$

Definition. (Skew-symmetric matrix) A matrix ${\displaystyle A}$ is a skew-symmetric matrix if

${\displaystyle A^{T}={\color {green}-}A.}$

Proposition. (Necessary condition for a symmetric and a skew-symmetric matrix) A symmetric matrix or a skew-symmetric matrix must be a square matrix.

Proof. It follows from observing that matrix transpose has the same size as the original matrix if and only if the matrix is square matrix, since the number of rows and number of columns are swapped for the matrix transpose, and the size remains unchanged if and only if the number of rows equals number of columns.

${\displaystyle \Box }$

Remark. This does not imply that every square matrix is a symmetric matrix or a skew-symmetric matrix. The condition that a matrix is a square matrix itself is not sufficient (but necessary) for it to be symmetric or skew-symmetric.

Example. ${\displaystyle {\begin{pmatrix}1&{\color {blue}2}&{\color {red}3}\\{\color {blue}2}&8&{\color {green}4}\\{\color {red}3}&{\color {green}4}&5\end{pmatrix}}}$ is symmetric, while ${\displaystyle {\begin{pmatrix}0&{\color {blue}2}&-{\color {red}3}\\-{\color {blue}2}&0&-{\color {green}4}\\{\color {red}3}&{\color {green}4}&0\end{pmatrix}}}$ is skew-symmetric, and its transpose is ${\displaystyle {\begin{pmatrix}0&-{\color {blue}2}&{\color {red}3}\\{\color {blue}2}&0&{\color {green}4}\\-{\color {red}3}&-{\color {green}4}&0\end{pmatrix}}}$. In a skew-symmetric matrix, all entries lying on the main diagonal must be 0.