Matrices are a useful way of representing and working with data for linear systems.

## Matrices

$$\normalsize A= \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & \cdots & a_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix}$$

$$\normalsize A= \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & \cdots & a_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix}$$

$$\normalsize A= \begin{bmatrix} a_{11} & a_{12} & \cdots & a_{1n}\\ a_{21} & a_{22} & \cdots & a_{2n}\\ \vdots & \vdots & \ddots & \vdots\\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{bmatrix}$$

Let $$m$$ and $$n$$ be positive integers. An ordered rectangular array of data where entry $$a_{ij}$$ is placed in row $$i$$ column $$j$$, is called a matrix of dimesion $$m\times n$$. It is generally acceptable to use either brackets [ ] or parentheses ( ) to enclose and specify a matrix. A matrix with vertical bars | | generally specifies that a determinant operation is to be performed on the matrix.

### Matrix Equality

Let $$A=[a_{ij}]$$ and $$B=[b_{ij}]$$ each be $$m\times n$$ matrices. Then we say that $$A$$ equals $$B$$ if $$a_{ij}=b_{ij}$$ for all $$i=1, 2, ..., m$$ and $$j=1, 2, ..., n$$.

Let $$A=[a_{ij}]$$ and $$B=[b_{ij}]$$ be numeric matrices of dimension $$m\times n$$ and $$t$$ be a scalar. Then $$[a_{ij}+b_{ij}]$$ is a matrix sum $$A+B$$ of $$a_{ij}+b_{ij}$$ for all $$i=1, 2, ..., m$$ and $$j=1, 2, ..., n$$.

Likewise, $$[a_{ij}-b_{ij}]$$ is the differnce $$A-B$$ of matrices $$A$$ and $$B$$.

It should be noted that we can only add or subtract matrices of the same dimensions, and that the result is a matrix of the same size.

### Matrix Scalar Multiply

In order to perform a scalar multiple of a matrix, we simply multiply each element of the matrix array by the scalar quantity. We typically write this as $$t\cdot[a_{ij}]=[t\cdot a_{ij}]$$, and is often simplified to $$t\cdot A$$ or $$tA$$.

A scalar multiple of a given matrix has the same dimensions as the original matrix.

### Matrix Multiply

The multiply $$[a_{ij}\cdot b_{ij}]$$ is defined similar to that of matrix addition and subtraction, but most texts list it as not being very useful. While this is true, there are some uses for this operation. Far more useful, however, is the matrix multiply:

Let $$A=[a_{ij}]$$ and $$B=[b_{ij}]$$ be numeric matrices of dimensin $$m\times n$$ and $$m\times r$$, respectively. The matrix $$C=[c_{ij}]$$ of dimension $$m\times r$$, is defined by
$$c_{ij} = a_{i1}b_{1j}a_{i2}b_{2j}+a_{i3}b_{3j}+$$$$...+a_{in}b_{nj}$$
$$=\displaystyle\sum_{k=1}^{n}a_{ik}b_{kj}$$
is called the matrix product of $$A$$ and $$B$$, denoted $$(AB)$$.

Note that the matrix multiply is not commutative; that is, $$AB\ne BA$$. However, it is associative, so $$A(BC)=(AB)C$$.

#### Matrix Mutiply Example

Where

$$A= \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14}\\ a_{21} & a_{22} & a_{23} & a_{24}\\ a_{31} & a_{32} & a_{33} & a_{34}\\ a_{41} & a_{42} & a_{43} & a_{44} \end{bmatrix}$$

$$B= \begin{bmatrix} b_{11} & b_{12} & b_{13} & b_{14}\\ b_{21} & b_{22} & b_{23} & b_{24}\\ b_{31} & b_{32} & b_{33} & b_{34}\\ b_{41} & b_{42} & b_{43} & b_{44} \end{bmatrix}$$

and

$$C= \begin{bmatrix} c_{11} & c_{12} & c_{13} & c_{14}\\ c_{21} & c_{22} & c_{23} & c_{24}\\ c_{31} & c_{32} & c_{33} & c_{34}\\ c_{41} & c_{42} & c_{43} & c_{44} \end{bmatrix}$$

and given that $$[a_{ij}\cdot b_{ij}] = \displaystyle\sum_{k=1}^{n}a_{ik}b_{kj}$$, the result of the matrix multiply $$C=AB$$ is as follows:

$$\small c_{11}=a_{11}b_{11}+a_{12}b_{21}+a_{13}b_{31}+a_{14}b_{41}\normalsize$$
$$\small c_{12}=a_{11}b_{12}+a_{12}b_{22}+a_{13}b_{32}+a_{14}b_{42}\normalsize$$
$$\small c_{13}=a_{11}b_{13}+a_{12}b_{23}+a_{13}b_{33}+a_{14}b_{43}\normalsize$$
$$\small c_{14}=a_{11}b_{14}+a_{12}b_{24}+a_{13}b_{34}+a_{14}b_{44}\normalsize$$
$$\small c_{21}=a_{21}b_{11}+a_{22}b_{21}+a_{23}b_{31}+a_{24}b_{41}\normalsize$$
$$\small c_{22}=a_{21}b_{12}+a_{22}b_{22}+a_{23}b_{32}+a_{24}b_{42}\normalsize$$
$$\small c_{23}=a_{21}b_{13}+a_{22}b_{23}+a_{23}b_{33}+a_{24}b_{43}\normalsize$$
$$\small c_{24}=a_{21}b_{14}+a_{22}b_{24}+a_{23}b_{34}+a_{24}b_{44}\normalsize$$
$$\small c_{31}=a_{31}b_{11}+a_{32}b_{21}+a_{33}b_{31}+a_{34}b_{41}\normalsize$$
$$\small c_{32}=a_{31}b_{12}+a_{32}b_{22}+a_{33}b_{32}+a_{34}b_{42}\normalsize$$
$$\small c_{33}=a_{31}b_{13}+a_{32}b_{23}+a_{33}b_{33}+a_{34}b_{43}\normalsize$$
$$\small c_{34}=a_{31}b_{14}+a_{32}b_{24}+a_{33}b_{34}+a_{34}b_{44}\normalsize$$
$$\small c_{41}=a_{41}b_{11}+a_{42}b_{21}+a_{43}b_{31}+a_{44}b_{41}\normalsize$$
$$\small c_{42}=a_{41}b_{12}+a_{42}b_{22}+a_{43}b_{32}+a_{44}b_{42}\normalsize$$
$$\small c_{43}=a_{41}b_{13}+a_{42}b_{23}+a_{43}b_{33}+a_{44}b_{43}\normalsize$$
$$\small c_{44}=a_{41}b_{14}+a_{42}b_{24}+a_{43}b_{34}+a_{44}b_{44}\normalsize$$

### Matrix Transpose

Let $$A=[a_{ij}]$$ be an $$m\times n$$ matrix and $$T=[t_{ij}]$$ an $$n\times m$$ matrix where $$t_{ij}=a_{ji}$$ for all $$i$$ and $$j$$. $$T$$ is said to be the transpose of matrix $$A$$, and is often denoted as $$A^T$$. In simpler terms, the transpose of a matrix has the rows and columns swapped.