[Math] Dot product of a row vector and a column vector

linear algebra

As I understand it, the dot product of two vectors $\bf a$ and $\bf b$, both represented as $1 \times n$ matrices, is equal to $\bf a \bf b^T$.
Is it possible to take the dot product of $\bf a$, a $1 \times n$ matrix, and $\bf b$, an $n \times 1$ matrix? Would this just be equal to the matrix multiplication $\bf a \bf b$?
It seems to me that instead the dot product should be $\bf a \bf b^T$, which in this case would not be defined since the inner dimensions of that matrix multiplication ($n$ and $1$) do not match. Or is this not how we define dot product?
Thanks.

Best Answer

The notation you use for inner product (dot product) and outer product of two vectors is completely up to you. Whether you decide to use row vectors, $a,b\in\mathbb{R}^{1\times n}$, or column vectors, $a,b\in\mathbb{R}^{n\times 1}$, the notation \begin{equation*} a\cdot b = \sum_{i=1}^n a_ib_i \end{equation*} is commonly used. If you decide to use row vectors, then the dot product can be written in terms of matrix multiplication as $ab^\top$, and the outer product can be written as \begin{equation*} a^\top b = \begin{bmatrix} a_1 \\ a_2 \\ \dots \\ a_n \end{bmatrix}\begin{bmatrix}b_1 & b_2 & \cdots & b_n \end{bmatrix} = \begin{bmatrix}a_1b_1 & a_1b_2 & \cdots & a_1b_n \\ a_2b_1 & a_2b_2 & \cdots & a_2 b_n \\ \vdots & \vdots & \ddots & \vdots \\ a_nb_1 & a_nb_2 & \cdots & a_nb_n\end{bmatrix}. \end{equation*} In the case you decide to use column vectors $a,b\in\mathbb{R}^{n\times 1}$, the notation reverses, i.e. the dot product is $a^\top b$ and the outer product is $ab^\top$.