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.

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_1b_1+a_2b_2+\cdots+a_nb_n = \sum_{i=1}^n a_ib_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_1b_1+a_2b_2+a_3b_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\cdot7+1\cdot5+3\cdot4$$ $$=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_yb_x) $$ where $$e$$ is unit vector.