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.
$\endgroup$ 33 Answers
$\begingroup$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$.
$\endgroup$ 2 $\begingroup$The dot product, or any inner product, is generally considered to take two vectors in the same vector space to yield a scalar. The operation is supposed to be combining two like vectors, so the answer is no.
$\endgroup$ $\begingroup$Yes, it is possible, and the two ways lead to the same result. In general, in order that the matrix product $AB$ be defined, a necessary condition is that the number of columns of $A$ is equal to the number of rows of $B$. That is, $A$ is $n\times k$ and $B$ is $k\times m$.
$\endgroup$