# 向量

${\displaystyle {\overrightarrow {a}}}$ 係喺一個二維空間入面由 ${\displaystyle {\text{A}}}$ 指去 ${\displaystyle {\text{B}}}$ 嗰度嘅向量，會有兩個數 ${\displaystyle (x_{1},y_{1})}$
${\displaystyle {\text{O}}}$${\displaystyle {\text{P}}}$ 嘅位移可以想像成「${\displaystyle ({\text{x}},{\text{y}},{\text{z}})}$」呢個向量－「沿 ${\displaystyle {\text{X}}}$ 軸移 ${\displaystyle {\text{x}}}$ 咁遠、沿 ${\displaystyle {\text{Y}}}$ 軸移 ${\displaystyle {\text{y}}}$ 咁遠、沿 ${\displaystyle {\text{Z}}}$ 軸移 ${\displaystyle {\text{z}}}$ 咁遠」。

${\displaystyle x,y}$座標入面，通常用${\displaystyle {\hat {i}}}$代表向右移動一格；用${\displaystyle {\hat {j}}}$代表向上移動一格。所以一個二維向量可以寫做${\displaystyle {\vec {a}}=x{\hat {i}}+y{\hat {j}}}$

## 算法

${\displaystyle {\vec {a}}=a_{x}{\hat {i}}+a_{y}{\hat {j}}}$
${\displaystyle {\vec {b}}=b_{x}{\hat {i}}+b_{y}{\hat {j}}}$
• 點積，寫做 ${\displaystyle {\vec {a}}\cdot {\vec {b}}=a_{x}b_{x}+a_{y}b_{y}}$
• 叉積，寫做 ${\displaystyle {\vec {a}}\times {\vec {b}}=(a_{x}b_{y}-a_{y}b_{x})\ {\hat {k}}}$，其中 ${\displaystyle {\hat {k}}}$${\displaystyle z}$ 軸嘅單位向量