# Applied Mathematics/The Basics
## The Basics of linear algebra

    $\mathbf {A} ={\begin{bmatrix}a_{11}&a_{12}&a_{12}&a_{14}\\a_{21}&a_{22}&a_{23}&a_{24}\\a_{31}&a_{32}&a_{33}&a_{34}\\\end{bmatrix}}.$
A matrix is composed of a rectangular array of numbers arranged in rows and columns. The horizontal lines are called rows and the vertical lines are called columns. The individual items in a matrix are called elements. The element in the i-th row and the j-th column of a matrix is referred to as the i,j, (i,j), or (i,j)th element of the matrix. To specify the size of a matrix, a matrix with m rows and n columns is called an m-by-n matrix, and m and n are called its dimensions.

### Basic operation

| Operation | Definition | Example |
| Addition | The sum A+B of two m-by-n matrices A and B is calculated entrywise: (A + B)$_{i,j}$ = A$_{i,j}$ + B$_{i,j}$, where 1 ≤ i ≤ m and 1 ≤ j ≤ n. | ${\begin{bmatrix}1&3&1\\1&0&0\end{bmatrix}}+{\begin{bmatrix}0&0&5\\7&5&0\end{bmatrix}}={\begin{bmatrix}1+0&3+0&1+5\\1+7&0+5&0+0\end{bmatrix}}={\begin{bmatrix}1&3&6\\8&5&0\end{bmatrix}}$ |
| Scalar multiplication | The scalar multiplication cA of a matrix A and a number c (also called a scalar in the parlance of abstract algebra) is given by multiplying every entry of A by c: (cA)$_{i,j}$ = c · A$_{i,j}$. | $2\cdot {\begin{bmatrix}1&8&-3\\4&-2&5\end{bmatrix}}={\begin{bmatrix}2\cdot 1&2\cdot 8&2\cdot -3\\2\cdot 4&2\cdot -2&2\cdot 5\end{bmatrix}}={\begin{bmatrix}2&16&-6\\8&-4&10\end{bmatrix}}$ |
| Transpose | The transpose of an m-by-n matrix A is the n-by-m matrix A$^T$ (also denoted A$^{tr}$ or $^t$A) formed by turning rows into columns and vice versa: (A$^T$)$_{i,j}$ = A$_{j,i}$. | ${\begin{bmatrix}1&2&3\\0&-6&7\end{bmatrix}}^{\mathrm {T} }={\begin{bmatrix}1&0\\2&-6\\3&7\end{bmatrix}}$ |

### Practice problems

(1) ${\begin{bmatrix}5&7&3\\1&2&9\end{bmatrix}}+{\begin{bmatrix}4&0&5\\8&3&0\end{bmatrix}}=$
(2) $4{\begin{bmatrix}-1&0&-5\\7&9&-6\end{bmatrix}}=$
(3) ${\begin{bmatrix}-2&5&7\\0&0&9\end{bmatrix}}^{\mathrm {T} }=$

## Matrix multiplication

Multiplication of two matrices is defined only if the number of columns of the left matrix is the same as the number of rows of the right matrix. If A is an m-by-n matrix and B is an n-by-p matrix, then their matrix product AB is the m-by-p matrix whose entries are given by dot product of the corresponding row of A and the corresponding column of B
    $[\mathbf {AB} ]_{i,j}=A_{i,1}B_{1,j}+A_{i,2}B_{2,j}+\cdots +A_{i,n}B_{n,j}=\sum _{r=1}^{n}A_{i,r}B_{r,j}$

### Example

${\begin{bmatrix}-2&0\\3&2\end{bmatrix}}{\begin{bmatrix}1&2\\3&-1\end{bmatrix}}$
$={\begin{bmatrix}-2+0&-4+0\\3+6&6+(-2)\end{bmatrix}}$
$={\begin{bmatrix}-2&-4\\9&4\end{bmatrix}}$

### Practice Problems

(1) ${\begin{bmatrix}1&0\\2&2\end{bmatrix}}{\begin{bmatrix}4\\2\end{bmatrix}}=$
(2) ${\begin{bmatrix}1&2\\2&3\end{bmatrix}}{\begin{bmatrix}2&3\\1&4\end{bmatrix}}=$

## Dot product

A row vector is a 1 × m matrix, while a column vector is a m × 1 matrix.
Suppose A is row vector and B is column vector, then the dot product is defined as follows;
    $A\cdot B=|A||B|cos\theta$
or
    $\mathbf {A} \cdot \mathbf {B} ={\begin{pmatrix}a_{1}&a_{2}&\cdots &a_{n}\end{pmatrix}}{\begin{pmatrix}b_{1}\\b_{2}\\\vdots \\b_{n}\end{pmatrix}}=a_{1}b_{1}+a_{2}b_{2}+\cdots +a_{n}b_{n}=\sum _{i=1}^{n}a_{i}b_{i}$
Suppose $\mathbf {A} ={\begin{pmatrix}a_{1}&a_{2}&a_{3}\end{pmatrix}}$ and $\mathbf {B} ={\begin{pmatrix}b_{1}\\b_{2}\\b_{3}\end{pmatrix}}$ The dot product is
    $\mathbf {A} \cdot \mathbf {B} ={\begin{pmatrix}a_{1}&a_{2}&a_{3}\end{pmatrix}}{\begin{pmatrix}b_{1}\\b_{2}\\b_{3}\end{pmatrix}}=a_{1}b_{1}+a_{2}b_{2}+a_{3}b_{3}$

### Example

Suppose $\mathbf {A} ={\begin{pmatrix}2\\1\\3\end{pmatrix}}$ and $\mathbf {B} ={\begin{pmatrix}7\\5\\4\end{pmatrix}}$
    $\mathbf {A} \cdot \mathbf {B} ={\begin{pmatrix}2&1&3\end{pmatrix}}{\begin{pmatrix}7\\5\\4\end{pmatrix}}$
$=2\cdot 7+1\cdot 5+3\cdot 4$ $=14+5+12$
$=31$

### Practice problems

(1) $\mathbf {A} ={\begin{pmatrix}3\\2\\5\end{pmatrix}}$ and $\mathbf {B} ={\begin{pmatrix}1\\4\\3\end{pmatrix}}$
    $\mathbf {A} \cdot \mathbf {B} =$
(2) $\mathbf {A} ={\begin{pmatrix}1\\0\\3\end{pmatrix}}$ and $\mathbf {B} ={\begin{pmatrix}6\\9\\2\end{pmatrix}}$
    $\mathbf {A} \cdot \mathbf {B} =$

## Cross product

Cross product is defined as follows:
    $A\times B=|A||B|sin\theta$
Or, using detriment,
    $\mathbf {A\times B} ={\begin{vmatrix}e_{x}&e_{y}&e_{z}\\a_{x}&a_{y}&a_{z}\\b_{x}&b_{y}&b_{z}\\\end{vmatrix}}=(a_{y}b_{z}-a_{z}b_{y},a_{z}b_{x}-a_{x}b_{z},a_{x}b_{y}-a_{y}b_{x})$
where $e$ is unit vector.

## References

* ↑ Sourced from Matrix (mathematics), Wikipedia, 28th March 2013.
* ↑ Sourced from Matrix (mathematics), Wikipedia, 30th March 2013.
* ↑ Sourced from Matrix (mathematics), Wikipedia, 30th March 2013.