# Linear Algebra

## Matrices

 An $$m\times n$$ matrix A is a rectangular array with $$m$$ and $$m$$ columns. We denote the entry in the i-th row and j-th column by $$a_{ij}$$. That is, $\left[\begin{array}{cccccc} a_{11} & a_{12} & \ldots & a_{1j} & \ldots & a_{1n} \\ a_{21} & a_{22} & \ldots & a_{2j} & \dots & a_{2n} \\ \vdots & \vdots && \vdots && \vdots \\ a_{i1} & a_{i2} & \ldots & a_{ij} & \ldots & a_{in} \\ \vdots & \vdots && \vdots && \vdots \\ a_{m1} & a_{m2} & \ldots & a_{mj} & \ldots & a_{mn} \end{array}\right]$ Two $$m\times n$$ matrices $$A$$ and $$B$$ are equal if $$a_{ij} =b_{ij}$$ for all $$1\leq i\leq m$$, $$1 \leq j\leq n$$. The set of all $$m\times n$$ matrices with real entries is denoted by $$M_{m\times n} (\mathbb{R})$$.
 A matrix in $$M_{n\times n}(\mathbb{R})$$ (the number of rows of the matrix is equal to the number of columns) is called a square matrix.

The following is a $$3\times 3$$ square matrix.

\begin{bmatrix} a &b&c\\d&e&f\\g&h&i\end{bmatrix}

 A matrix $$U \in M_{n\times n}(\mathbb{R})$$ is said to be upper triangular if $$u_{ij}=0$$ whenever $$i>j$$. A matrix $$L \in M_{n\times n}(\mathbb{R})$$ is said to be lower triangular if $$l_{ij}=0$$ whenever $$i Upper triangle matrices $\begin{bmatrix} 3&4\\0&1\end{bmatrix} \qquad \begin{bmatrix} 5&2&1\\0&2&3\\0&0&1\end{bmatrix}$ Lower triangle matrices $\begin{bmatrix} -3&0\\4&1\end{bmatrix} \qquad \begin{bmatrix} 0&0&0\\1&2&0\\0&5&0\end{bmatrix}$ Upper and Lower triangle matrix $\begin{bmatrix} 3&0&0\\0&2&0\\0&0&1\end{bmatrix}$ ## Operations on Matrices  Let \(A, B\in M_{n\times n} (mathbb{R})$$. We define addition of matrices by  $(A+B)_{ij} = (A)_{ij} + (B)_{ij}$ We define scalar multiplication of $$A$$ by a scalar $$t\in\mathbb{R}$$ by $(tA)_{ij}=t(A)_{ij}$

By the definition above, matrix addition can only be performed on matrices of the same size. See an example in the video.

Example: Multiply matrix $$A$$ by the scalar multiple $$k=-3$$

$A=\begin{bmatrix} 3 & 0 &2\\-2&0&0\\0&-3&4\end{bmatrix}$

$3A=\begin{bmatrix} -9 & 0 &-6\\6&0&0\\0&9&-12\end{bmatrix}$

## Transpose

Columns and rows can be switched by finding the transpose of a matrix.

 Let $$A\in = M_{m\times n}\in(\mathbb{R})$$. The transpose of $$A$$, is the $$n\times m$$ matrix, denoted $$A^T$$, whose ij-th entry is the ji-th entry of $$A$$. That is $(A^T)_{ij} = (A)_{ji}$

Example: Find the transpose of $$A$$

$A=\begin{bmatrix} -3&6&2\\0&-2&1\end{bmatrix}$

Solution

$A^T=\begin{bmatrix} -3&0\\6&-2\\2&1\end{bmatrix}$

 Properties of Transpose Matrices If $$A$$ and $$B$$ are matrices, and $$s\in\mathbb{R}$$, then $$(A^T)^T=A$$ $$(A+B)^T=A^T+B^T$$ $$(sA)^T=sA^T$$

## Matrix Multiplication

 Let $$A\in M_{m\times n}(\mathbb{R})$$ with rows $$\vec{a}_1,\ldots,\vec{a}_m$$ and let $$B\in M_{n\times p}(\mathbb{R})$$ with columns $$\vec{b}_1,\ldots,\vec{b}_p$$ . We define $$AB$$ to be the $$m\times p$$ matrix whose ij-th entry is  $(AB)_{ij} = \vec{a}_i \cdot \vec{b}_{j}$

There are key elements to notice during matrix multiplication:

• Order matters in matrix multiplication (e.g., $$AB \neq BA$$)
• The product $$AB$$ of two matrices $$A$$ and $$B$$, can only be performed if the number of columns in $$A$$ is the same as the number of rows in $$B$$.
• The product $$AB$$ has the same number of rows as matrix $$A$$ and the same number of columns as matrix $$B$$.
• The element $$a_{ij}$$ is found by multiplying row $$i$$ in matrix $$A$$ with column $$j$$ in matrix $$B$$.

## Identity Matrix

When performing an operation with an identity, the resultant is the same value. For example, adding 0 to any number gives you the same number. Multiplying any number by 1 also gives you the same number. How do these identities look like with matrices? The addition identity is a matrix with 0 in all its elements. However, it is not true that having a matrix with all 1s as its elements will create a multiplication identity. Instead, the identity matrix for multiplication has 1s only in the diagonal and 0s everywhere else.

 The identity matrix for an $$n\times n$$ matrix is $I=\begin{bmatrix}1&\ldots&\ldots&0\\0&1&\ldots&0\\ \vdots&&\ddots&\vdots\\0&\ldots&\ldots&1\end{bmatrix}$

For example, the identity matrix $$I$$ in a $$3\times 3$$ matrix is

\begin{bmatrix} 1&0&0\\0&1&0\\0&0&1 \end{bmatrix}

The identity matrix $$I$$ in a $$4\times 4$$ matrix is

\begin{bmatrix} 1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&1 \end{bmatrix}