## Testing For Perpndicular Vectors Using The Dot Product

Let
$A=\left( \begin{array}{cccc} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \ddots & a_{2n} \\ \vdots & \ddots & \ddots & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} \end{array} \right), B=\left( \begin{array}{cccc} b_{11} & b_{12} & \cdots & b_{1n} \\ b_{21} & b_{22} & \ddots & b_{2n} \\ \vdots & \ddots & \ddots & \vdots \\ b_{n1} & b_{n2} & \cdots & b_{nn} \end{array} \right)$
.
Then
$AB=\left( \begin{array}{cccc} \sum_{j=1}^n a_{1j}b_{j1} & \sum_{j=1}^n a_{1j}b_{j2} & \cdots & \sum_{j=1}^n a_{1j}b_{jn} \\ \sum_{j=1}^n a_{2j}b_{j1} & \sum_{j=1}^n a_{2j}b_{j2} & \ddots & \sum_{j=1}^n a_{2j}b_{jn} \\ \vdots & \ddots & \ddots & \vdots \\ \sum_{j=1}^n a_{nj}b_{j1} & \sum_{j=1}^n a_{nj}b_{j2} & \cdots & \sum_{j=1}^n a_{nj}b_{jn} \end{array} \right)$
.
$Tr(AB)=\sum_{j=1}^n a_{1j}b_{j1} + \sum_{j=1}^n a_{1j}b_{j1}+ \sum_{j=1}^n a_{2j}b_{j2}+ \cdots + \sum_{j=1}^n a_{nj}b_{jn}$
.
$BA=\left( \begin{array}{cccc} \sum_{j=1}^n b_{1j}a_{j1} & \sum_{j=1}^n b_{1j}a_{j2} & \cdots & \sum_{j=1}^n b_{1j}a_{jn} \\ \sum_{j=1}^n b_{2j}a_{j1} & \sum_{j=1}^n b_{2j}a_{j2} & \ddots & \sum_{j=1}^n b_{2j}a_{jn} \\ \vdots & \ddots & \ddots & \vdots \\ \sum_{j=1}^n b_{nj}a_{j1} & \sum_{j=1}^n b_{nj}a_{j2} & \cdots & \sum_{j=1}^n b_{nj}a_{jn} \end{array} \right)$
.
$Tr(BA)=\sum_{j=1}^n b_{1j}a_{j1} + \sum_{j=1}^n b_{1j}a_{j1}+ \sum_{j=1}^n b_{2j}a_{j2}+ \cdots + \sum_{j=1}^n b_{nj}a_{jn}= \sum_{j=1}^n a_{1j}b_{j1} + \sum_{j=1}^n a_{1j}b_{j1}+ \sum_{j=1}^n a_{2j}b_{j2}+ \cdots + \sum_{j=1}^n a_{nj}b_{jn} =Tr(AB)$
.