# TensorFlow - 数学基础

## Vector

### 矩阵

Matrix可以定义为多维数组，以行和列的格式排列.矩阵的大小由行长度和列长度定义.下图显示任何指定矩阵的表示.

## 数学计算

### 添加矩阵

$$示例:A = \begin {bmatrix} 1&2 \\3&4 \end {bmatrix} B = \begin {bmatrix} 5&6 \\7&8 \ end {bmatrix} \:then \:A + B = \ begin {bmatrix} 1 + 5&2 + 6 \\3 + 7&4 + 8 \ end {bmatrix} = \ begin {bmatrix} 6& 8 \\\\ t&12 \end {bmatrix}$$

### 矩阵的减法

$$示例:A-\begin {bmatrix} 1&2 \\3&4 \ end {bmatrix } B-\begin {bmatrix} 5&6 \\ 7&8 \end {bmatrix} \:then \:AB-\begin {bmatrix} 1-5&2-6 \\\ \\ _3-7&4-8 \end {bmatrix} -\begin {bmatrix} -4&-4 \\-4&-4 \end {bmatrix}$$

### 矩阵的乘法

C m * q

$$A = \ begin {bmatrix} 1&2 \\3 &4 \ end {bmatrix} B = \begin {bmatrix} 5&6 \\7&8 \end {bmatrix}$$

$$c_ {11 } = \ begin {bmatrix} 1&2 \end {bmatrix} \begin {bmatrix} 5 \\7 \ end {bmatrix} = 1 \ times5 + 2 \times7 = 19 \: c_ {12} = \ begin {bmatrix} 1&2 \ end {bmatrix} \ begin {bmatrix} 6 \\8 \ end {bmatrix} = 1 \ times6 + 2 \times8 = 22$$

$$c_ {21} = \begin {bmatrix} 3&4 \end {bmatrix} \begin {bmatrix} 5 \\ 7 \ end {bmatrix} = 3 \ times5 + 4 \ times7 = 43 \:c_ {22} = \ begin {bmatrix} 3&4 \ end {bmatrix} \ begin {bmatrix} 6 \\8 \ end {bmatrix} = 3 \ times6 + 4 \times8 = 50$$

$$C = \ begin {bmatrix} c_ {11}&c_ {12} \\c_ {21}&c_ {22} \end {bmatrix} = \ begin {bmatrix} 19&22 \\43&50 \end {bmatrix}$$

### 矩阵的转置

$$示例:A = \begin {bmatrix} 1&2 \\3&4 \end {bmatrix} \:then \:A ^ {T} \begin {bmatrix} 1&3 \\2& 4 \ end {bmatrix}$$

### 向量的点积

$$v_{1}=\begin{bmatrix}v_{11} \\v_{12} \\\cdot\\\cdot\\\cdot\\v_{1n}\end{bmatrix}v_{2}=\begin{bmatrix}v_{21} \\v_{22} \\\cdot\\\cdot\\\cdot\\v_{2n}\end{bmatrix}$$两个向量是相应组分的乘积之和 : 沿着相同维度的组件可以表示为

$$v_ {1} \ cdot v_ {2} = v_1 ^ Tv_ {2} = v_2 ^ Tv_ {1} = v_ {11} {V_ 21} + V_ {12} {V_ 22} + \cdot\cdot + V_ {1N} V_ {2N} = {\displaystyle\sum\limits_ K = 1} ^ N V_ {1k} v_ {2k}$$

$$Example:v_{1}=\begin{bmatrix}1 \\2 \\3\end{bmatrix}v_{2}=\begin{bmatrix}3 \\5 \\-1\end{bmatrix}v_{1}\cdot v_{2}=v_1^Tv_{2}=1\times3+2\times5-3\times1=10$$