Finish writing up notes on matrices lecture 1

This commit is contained in:
Akbar Rahman 2021-10-20 12:47:29 +01:00
parent ee73b7cf2f
commit 8a059f5a8e
Signed by: alvierahman90
GPG Key ID: 20609519444A1269

View File

@ -124,7 +124,7 @@ always hold true as there are many solutions.
- The exponential function $f(x) = \exp x$ may be wirtten as an infinite series:
$$\exp x = e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + ... $$
$$\exp x = e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \cdots $$
- The function $f(x) = e^{-x}$ is just $\frac 1 {e^x}$
- Note the important properties:
@ -391,7 +391,7 @@ $$z^3 = 8i$$
</details>
# Matrices (and Simultaneous Equations)
# Systems of Equations (Simultaneous Equations)
## Gaussian Elimination
@ -421,7 +421,7 @@ a = 0, b \ne 0 &\rightarrow \text{no solution for $x$} \\
a = 0, b = 0 &\rightarrow \text{infinite solutions for $x$}
\end{align*}
### 2x2 System
### 2x2 Systems
A 2x2 system is one with 2 equations and 2 unknown variables.
@ -457,7 +457,7 @@ You can check the values for $x_1$ and $x_2$ are correct by substituting them in
</details>
### 3x3 System
### 3x3 Systems
A 3x3 system is one with 3 equations and 3 unknown variables.
@ -496,3 +496,290 @@ These values can be back-substituted into any of the first 3 equations to find o
\end{align*}
</details>
<details>
<summary>
#### Example 2
\begin{align*}
x_1 + x_2 - 2x_3 &= 1 &R_1 \\
2x_1 - x_2 - x_3 &= 1 &R_2 \\
x_1 + 4x_2 + 7x_3 &= 2 &R_3 \\
\end{align*}
</summary>
1. Eliminate $x_1$ from $R_2$, $R_3$:
\begin{align*}
x_1 + x_2 - 2x_3 &= 1 &R_1' = R_1\\
- 3x_2 - 5x_3 &= -1 &R_2' = R_2 - 2R_1 \\
3x_2 + 5x_3 &= 1 &R_3' = R_3 - R_1 \\
\end{align*}
We've created another 2x2 system of $R_2'$ and $R_3'$
2. Eliminate $x_2$ from $R_3''$
\begin{align*}
x_1 + x_2 - 2x_3 &= 1 &R_1'' = R_1' = R_1\\
- 3x_2 - 5x_3 &= -1 &R_2'' = R_2' = R_2 - 2R_1 \\
0x_3 &= 0 &R_3'' = R_3 '+ R_2' \\
\end{align*}
We can see that $x_3$ can be any number, so there are infinite solutions. Let:
$$x_3 = t$$
where $t$ can be any number
3. Substitute $x_3$ into $R_2''$:
$$R_2'' = -3x_2 - 5t = -1 \rightarrow x_2 = \frac 1 3 - \frac{5t} 3$$
4. Substitute $x_2$ and $x_3$ into $R_1''$:
$$R_1'' = x_1 + \frac 1 3 - \frac{5t} 3 + 2t = 1 \rightarrow x_1 = \frac 2 3 - \frac t 3$$
</details>
## Systems of Equations and Matrices
Many problems in engineering have a very large number of unknowns and equations to solve
simultaneously.
We can use matrices to solve these efficiently.
Take the following simultaneous equations::
\begin{align*}
3x_1 + 4x_2 &= 2 &\text{(1)} \\
x_1 + 2x_2 &= 0 &\text{(2)}
\end{align*}
They can be represented by the following matrices:
\begin{align*}
A &= \begin{pmatrix} 3 & 4 \\ 1 & 2 \end{pmatrix} \\
\pmb x &= \begin{pmatrix} x_1 \\ x_2 \end{pmatrix} \\
\pmb b &= \begin{pmatrix} 2 \\ 0 \end{pmatrix} \\
\end{align*}
You can then express the system as:
$$A\pmb x = \pmb b$$
<details>
<summary>
#### A 3x3 System as a Matrix
</summary>
\begin{align*}
2x_1 + 3x_2 - x_3 &= 5 \\
4x_1 + 4x_2 - 3x_3 &= 3 \\
2x_1 - 3x_2 + x_3 &= -1
\end{align*}
Could be expressed in the form $A\pmb x = \pmb b$ where:
\begin{align*}
A &= \begin{pmatrix} 2 & 3 & -1 \\ 4 & 4 & -3 \\ 2 & -3 & -1 \end{pmatrix} \\
\pmb x &= \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix} \\
\pmb b &= \begin{pmatrix} 5 \\ 3 \\ -1 \end{pmatrix} \\
\end{align*}
</details>
<details>
<summary>
#### An $m\times n$ System as a Matrix
</summary>
\begin{align*}
a_{11}x_1 + a_{12}x_2 + \cdots + a_{1n}x_n &= b_1 \\
a_{21}x_1 + a_{22}x_2 + \cdots + a_{2n}x_n &= b_2 \\
\cdots \\
a_{m1}x_1 + a_{m2}x_2 + \cdots + a_{mn}x_n &= b_m \\
\end{align*}
Could be expressed in the form $A\pmb x = \pmb b$ where:
\begin{align*}
A = \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\
a_{21} & a_{22} & \cdots & a_{2n} \\
\vdots & & & \vdots \\
a_{m1} & a_{m2} & \cdots & a_{mn}
\end{pmatrix},
\pmb x = \begin{pmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{pmatrix},
\pmb b = \begin{pmatrix} b_1 \\ b_2 \\ \vdots \\ b_m \end{pmatrix}
\end{align*}
</details>
# Matrices
## Order of a Matrix
The order of a matrix is its size e.g. $3\times2$ or $m\times n$
## Column Vectors
- Column vectors are matrices with only one column:
$$ \begin{pmatrix} 1 \\ 2 \end{pmatrix} \begin{pmatrix} 4 \\ 45 \\ 12 \end{pmatrix} $$
- Column vector variables typed up or printed are expressed in $\pmb{bold}$ and when it is
handwritten it is \underline{underlined}:
$$ \pmb x = \begin{pmatrix} -3 \\ 2 \end{pmatrix}$$
## Matrix Algebra
### Equality
Two matrices are the same if:
- Their order is the same
- Their corresponding elements are the same
### Addition and Subtraction
Only possible if their order is the same.
\begin{align*}
A + B&= \begin{pmatrix} a_{11} + b_{11} & a_{12} + b_{12} & \cdots & a_{1n} + b_{1n} \\
a_{21} + b_{21} & a_{22} + b_{22} & \cdots & a_{2n} + b_{2n} \\
\vdots & & & \vdots \\
a_{m1} + b_{m1} & a_{m2} + b_{m2} & \cdots & a_{mn} + b_{mn}
\end{pmatrix} \\
A - B&= \begin{pmatrix} a_{11} - b_{11} & a_{12} - b_{12} & \cdots & a_{1n} - b_{1n} \\
a_{21} - b_{21} & a_{22} - b_{22} & \cdots & a_{2n} - b_{2n} \\
\vdots & & & \vdots \\
a_{m1} - b_{m1} & a_{m2} - b_{m2} & \cdots & a_{mn} - b_{mn}
\end{pmatrix},
\end{align*}
### Zero Matrix
This is a matrix whose elements are all zeros.
For any matrix $A$,
$$A + 0 =A$$
We can only add matrices of the same order, therefore 0 must be of the same order as $A$.
### Multiplication
Let
$$
\begin{matrix}
A & m\times n \\
B & p\times q
\end{matrix}
$$
To be able to multiply $A$ by $B$, $n = p$.
If $n \ne p$, then $AB$ does not exist.
$$
\begin{matrix}
A & B & = & C \\
m\times n & p \times q & & m\times q
\end{matrix}
$$
When $C = AB$ exists,
$$C_{ij} = \sum_r\! a_{ir}b_{rj}$$
That is, $C_{ij}$ is the 'product' of the $i$th row of $A$ and $j$th column of $B$.
#### Multiplication of a Matrix by a Scalar
If $\lambda$ is a scalar, we define
$$
\lambda a = \begin{pmatrix} \lambda a_{11} & \lambda a_{12} & \cdots & \lambda a_{1n} \\
\lambda a_{21} & \lambda a_{22} & \cdots & \lambda a_{2n} \\
\vdots & & & \vdots \\
\lambda a_{m1} & \lambda a_{m2} & \cdots & \lambda a_{mn}
\end{pmatrix},
$$
<details>
<summary>
#### Example 1
</summary>
$$
\begin{pmatrix} 1 & -1 \\ 2 & 1 \end{pmatrix}
\begin{pmatrix} 0 & 1 \\ 3 & 2 \end{pmatrix} =
\begin{pmatrix} -3 & -1 \\ 3 & 4 \end{pmatrix}
$$
$$
\begin{pmatrix} 0 & 1 \\ 3 & 2 \end{pmatrix}
\begin{pmatrix} 1 & -1 \\ 2 & 1 \end{pmatrix} =
\begin{pmatrix} 2 & 1 \\ 7 & -1 \end{pmatrix}
$$
</details>
<details>
<summary>
#### Example 2
</summary>
$$
A = \begin{pmatrix} 4 & 1 & 6 \\ 3 & 2 & 1 \end{pmatrix},\,
B = \begin{pmatrix} 1 & 1 \\ 1 & 2 \\ 1 & 0 \end{pmatrix}
$$
$$
AB = \begin{pmatrix} 11 & 6 \\ 6 & 7 \end{pmatrix},\,
BA = \begin{pmatrix} 7 & 3 & 7 \\ 10 & 5 & 8 \\ 4 & 1 & 6 \end{pmatrix}
$$
</details>
### Other Properties of Matrix Algebra
- $(\lambda A)B = \lambda(AB) = A(\lambda B)$
- $A(BC) = (AB)C = ABC$
- $(A+B)C = AC + BC$
- $C(A+B) = CA + CB$
- In general, $AB \ne BA$ even if both exist
- $AB = 0$ does not always mean $A = 0$ or $B = 0$:
$$\begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} \begin{pmatrix}3 & 0 \\ 0 & 0 \end{pmatrix} =
\begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix} = 0$$
<details>
<summary>
It follows that $AB = AC$ does not imply that $B=C$ as
$$AB = AC \leftrightarrow A(B + C) = 0$$
and as $A$ and $(B-C)$ are not necessarily 0, $B$ is not necessarily equal to $C$:
</summary>
$$AB = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} \begin{pmatrix}0 & 0 \\ 1 & 0 \end{pmatrix} =
\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}$$
and
$$AC = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} \begin{pmatrix}1 & 2 \\ 1 & 0 \end{pmatrix} =
\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} = AB$$
but $B \ne C$
</details>