[Math] How does the dot product convert a matrix into a scalar

linear algebra

I am learning linear algebra, and I am a bit confused by the dot product and how the answer to the process turns out to be a scalar rather than a matrix.

For $2$ vectors with $2$ components, I learned that dot product is equivalent to a $1 \times 2$ row vector left multiplied by a $2 \times 1$ column vector. The result of such a multiplication should result in a $ 1 \times 1 $ vector. But I am learning that the dot product somehow transforms the result into a scalar, rather than a $ 1 \times 1 $ vector.

Maybe I am missing something but the difference between a $ 1 \times 1 $ vector and a scalar seems important, because you can multiply a scalar by a matrix of any size, but you can only left-multiply a $ 1 \times 1 $ vector by another matrix with $1$ row.

Thanks for any help in understanding this.

Best Answer

Sometimes, we just say that a $1\times 1$ matrix is the same as a scalar. Afterall, when it comes to addition and multiplication of $1\times 1$ matrices vs addition and multiplication of scalars, the only difference between something like $\begin{bmatrix}3\end{bmatrix}$ and $3$ is some brackets. Consider $$(3+5)\cdot 4 = 32 \\ (\begin{bmatrix} 3\end{bmatrix} + \begin{bmatrix} 5\end{bmatrix})\begin{bmatrix} 4\end{bmatrix} = \begin{bmatrix} 32\end{bmatrix}$$ The algebra works out exactly the same. So sometimes it's not ridiculous to think of $1\times 1$ matrices as just another way of writing scalars.

But if you do want to distinguish the two, then just think of the formula $a\cdot b = a^Tb$ as a way of finding out which scalar you get from the dot product of $a$ and $b$ and not literally the dot product value itself (which should be scalar). That is, we calculate the dot product of $\begin{bmatrix} 1 \\ 2\end{bmatrix}$ and $\begin{bmatrix} 3 \\ 4\end{bmatrix}$ by using the formula $$\begin{bmatrix} 1 \\ 2\end{bmatrix}^T\begin{bmatrix} 3 \\ 4\end{bmatrix} = \begin{bmatrix} 1 & 2\end{bmatrix}\begin{bmatrix} 3 \\ 4\end{bmatrix} = \begin{bmatrix} 11\end{bmatrix}$$ and then say that this tells us that the dot product is really $11$. So the formula $a^Tb$ is just an algorithm we use to find the correct scalar.

You can view it either way. It doesn't really make a difference.