[Math] Weird Identities with Scalar Product & Transpose: $\vec{a}\cdot\vec{b} = \vec{b}^T \cdot {a}^T$, $\vec{a}^T \cdot \vec{b} = \vec{b}^T \cdot \vec{a} $

linear algebramatrices

Let's say I have a row vector $\vec{a}$ and a column vector $\vec{b}$:

\begin{align}
\vec{a}= \begin{pmatrix}4 & 5 & 6\end{pmatrix} \qquad \vec{b} = \begin{pmatrix}1\\2\\3\end{pmatrix}
\end{align}

Now if I want to calculate a scalar product, it is easy for $\vec{a} \cdot \vec{b}= \begin{pmatrix}4 & 5 & 6\end{pmatrix}\begin{pmatrix}1\\2\\3\end{pmatrix} = \begin{pmatrix}4\cdot1+ 5\cdot 2 + 6\cdot 3\end{pmatrix} = 32.$

but it is not as easy for $\vec{b}\cdot \vec{a}$ where the scalar product is undefined:

\begin{align}
\vec{b}\cdot \vec{a} = \begin{pmatrix}1\\2\\3\end{pmatrix} \begin{pmatrix}4 & 5 & 6\end{pmatrix} \qquad{\scriptsize\text{Not defined!}}
\end{align}

So if I take a transpose of both of the vectors I get:

\begin{align}
\vec{b}{\hspace{0.4mm}}^\mathsf{T}\cdot \vec{a}{}^\mathsf{T} = \begin{pmatrix}1&2&3\end{pmatrix} \begin{pmatrix}4 \\ 5 \\ 6\end{pmatrix} = \begin{pmatrix}1\cdot4 + 2 \cdot 5 + 3 \cdot 6\end{pmatrix} = 32
\end{align}

So I get a relation that $\vec{a}\cdot\vec{b} = \vec{b}^T \cdot {a}^{T} = 32$. But why do I find a different equation on Wikipedia which says: $(\vec{a}\cdot\vec{b} ){}^\mathsf{T}= \vec{b}{}^\mathsf{T} \cdot \vec{a}{\hspace{0.4mm}}^\mathsf{T}$?


EDIT: If i do it like @Samuel says i define original vectors differently:

\begin{align}
\vec{a}= \begin{pmatrix} 4\\ 5 \\ 6 \end{pmatrix} \qquad \vec{b}= \begin{pmatrix} 1\\ 2 \\ 3 \end{pmatrix}
\end{align}

And now i try to calculate $\vec{a} \cdot \vec{b}$ which is not defined. I can calculate ${\vec{a}}^T \vec{b}$ though:

\begin{align}
{\vec{a}}^T \cdot \vec{b}= \begin{pmatrix} 4& 5 &6 \end{pmatrix} \begin{pmatrix} 1\\ 2 \\ 3 \end{pmatrix} = 4\cdot 1 + 5\cdot 2 + 6 \cdot 3 = 32
\end{align}

Now i try to calculate scalar product $\vec{b} \cdot \vec{a}$ and neither this one is defined. But i can calculate ${\vec{b}}^T\cdot \vec{a}$ though:

\begin{align}
{\vec{b}}^T \cdot \vec{a}= \begin{pmatrix} 1& 2 &3 \end{pmatrix} \begin{pmatrix} 4\\ 5 \\ 6 \end{pmatrix} = 1\cdot 4 + 2\cdot 5 + 3 \cdot 6 = 32
\end{align}

So now i can say ${\vec{a}}^T \cdot \vec{b} = {\vec{b}}^T \cdot \vec{a} $. So this now is a lot wierder and i cant find it on Wikipedia.

Best Answer

A vector should always be a column vector. If you want to talk about a "row vector", you should write it as the transpose of some vector, or as a matrix with just one row.

I will add that, technically, the scalar product can not be written as a matrix product the way you are doing it. If $u,v$ are vectors, then the matrix product $u^T v$ is a $1\times 1$-matrix, whereas the scalar product $u\cdot v$ is a scalar. It is common to ignore this and consider them the same, but one should sometimes be careful when using this, for example when one wants to multiply the scalar product with a matrix.

Added: You cannot say that $a$ is a vector and then write $a=(4,5,6)$ as a row matrix. You can however say that $a$ is a $1\times 3$-matrix $(4,5,6)$, or that $a$ is a vector and $a^T=(4,5,6)$ (and in the latter case, $a$ is a column vector). Let us suppose that you defined the matrices $a=(4,5,6)$ and $b=\begin{pmatrix}1\\2\\3\end{pmatrix}$. Now, the matrix product $a\cdot b$ is equal to the $1\times 1$-matrix $[32]$, not the number 32, which is the scalar product of the vectors $\begin{pmatrix}4\\5\\6\end{pmatrix}$ and $\begin{pmatrix}1\\2\\3\end{pmatrix}$. Likewise, the matrix product $b^T\cdot a^T$ is equal to the $1\times 1$-matrix $[32]$. Then we can conclude that $a\cdot b=b^T\cdot a^T$ (note that you made a typo in your post and wrote $a^T\cdot b^T$ for the right-hand-side). This is consistent with Wikipedia, which states that $(a\cdot b)^T=b^T\cdot a^T$. However, your typo is also correct in this particular case, namely $(a\cdot b)^T=a^T\cdot b^T$, but this is only because both matrices are $1\times 1$-matrices, so they are equal to their own transposes.

Added after the edit: You get the identity $a^T\cdot b=b^T\cdot a$. This equation is not true for general matrices $a,b$, so you will not find it on Wikipedia. What is generally true, however, is the identity $(a^T\cdot b)^T=b^T\cdot a$. The reason your identity is true is because both matrices are $1\times 1$-matrices, and the transpose of a $1\times 1$-matrix does not change the matrix.

Related Question