With $a,b \in \mathbb{K}^n, \ A:=(a_{i}a_{j})_{i,j = 1,...,n} \in \mathbb{K}^{n x n} $ and $ B:=(b_{i}b_{j})_{i,j = 1,...,n} \in \mathbb{K}^{n x n} $ (where $\mathbb{K}$ is a field) I want to show that
$$ trace(AB) = (\sum_{i=1}^{n} a_{i}b_{i})^2 $$
I am fairly new to matrices and especially traces, so any hint as to where I begin here would be greatly appreciated!
The $(i,i)$-entry of $AB$ is given by $$\sum_{k=1}^n A_{i,k}B_{k,i} = \sum_{k=1}^n a_ia_kb_kb_i = a_ib_i \sum_{k=1}^n a_kb_k.$$ Thus the the trace of $AB$ is $$\sum_{i=1}^n \left( a_ib_i \sum_{k=1}^n a_kb_k \right).$$ Can you show that is equal to $\left(\sum_{i=1}^n a_ib_i\right)^2$?