askvity

How do you multiply row vectors?

Published in Vector Multiplication 5 mins read

Multiplying vectors can mean different things depending on the context in linear algebra. While multiplying two row vectors directly in a standard way like a dot product (which typically involves a row and a column vector) isn't a single operation, row vectors are frequently used in matrix multiplication and other vector products.

Understanding Row Vector Multiplication

When considering how row vectors are multiplied, it's essential to differentiate between multiplying a row vector by a matrix, multiplying a row vector by a column vector (which results in a scalar, the dot product), and multiplying a column vector by a row vector (which results in a matrix, the outer product).

Multiplying a Row Vector by a Matrix (vA)

This is a standard operation in matrix multiplication where a row vector is multiplied "from the left" onto a matrix. The number of columns in the row vector must equal the number of rows in the matrix for the multiplication to be defined.

As referenced, say you have a matrix A of dimension m×n and a row vector v of dimension 1×m, then you can multiply the vector "from the left" as vA will be (1×m)(m×n) for which the product gives a 1×n row vector.

Here's how it works:

  • The resulting vector has the same number of columns as the matrix.
  • Each element in the resulting row vector is calculated by taking the dot product of the input row vector v and the corresponding column in the matrix A.

Example:

Let $v = \begin{bmatrix} 1 & 2 \end{bmatrix}$ (a 1×2 row vector) and $A = \begin{bmatrix} 3 & 4 & 5 \ 6 & 7 & 8 \end{bmatrix}$ (a 2×3 matrix).

Here, $m=2$ and $n=3$. The dimensions match: (1×2)(2×3). The result will be a 1×3 row vector.

$vA = \begin{bmatrix} 1 & 2 \end{bmatrix} \begin{bmatrix} 3 & 4 & 5 \ 6 & 7 & 8 \end{bmatrix}$

To find the first element of the resulting vector, multiply elements of v by the first column of A and sum:
$(1 \times 3) + (2 \times 6) = 3 + 12 = 15$

To find the second element, multiply elements of v by the second column of A and sum:
$(1 \times 4) + (2 \times 7) = 4 + 14 = 18$

To find the third element, multiply elements of v by the third column of A and sum:
$(1 \times 5) + (2 \times 8) = 5 + 16 = 21$

So, $vA = \begin{bmatrix} 15 & 18 & 21 \end{bmatrix}$ (a 1×3 row vector).

Dot Product (Row Vector and Column Vector)

This is perhaps the most common type of vector "multiplication" resulting in a single number (a scalar). It involves multiplying a row vector by a column vector of the same dimension.

Let $u = \begin{bmatrix} u_1 & u_2 & \dots & u_n \end{bmatrix}$ (a 1×n row vector) and $v = \begin{bmatrix} v_1 \ v_2 \ \vdots \ v_n \end{bmatrix}$ (an n×1 column vector).

Their dot product is $u \cdot v = uv = \begin{bmatrix} u_1 & u_2 & \dots & u_n \end{bmatrix} \begin{bmatrix} v_1 \ v_2 \ \vdots \ v_n \end{bmatrix} = u_1 v_1 + u_2 v_2 + \dots + u_n v_n$.

This is a (1×n)(n×1) multiplication, resulting in a 1×1 scalar.

Example:

Let $u = \begin{bmatrix} 1 & 2 & 3 \end{bmatrix}$ and $v = \begin{bmatrix} 4 \ 5 \ 6 \end{bmatrix}$.

$u \cdot v = (1 \times 4) + (2 \times 5) + (3 \times 6) = 4 + 10 + 18 = 32$.

Note that if you want to multiply two row vectors element-wise and sum the results, you would typically transpose one of them into a column vector to perform the dot product.

Outer Product (Column Vector and Row Vector)

This operation involves multiplying a column vector by a row vector. Unlike the dot product, the outer product results in a matrix.

Let $u = \begin{bmatrix} u_1 \ u_2 \ \vdots \ u_m \end{bmatrix}$ (an m×1 column vector) and $v = \begin{bmatrix} v_1 & v_2 & \dots & v_n \end{bmatrix}$ (a 1×n row vector).

Their outer product is $uv = \begin{bmatrix} u_1 \ u_2 \ \vdots \ u_m \end{bmatrix} \begin{bmatrix} v_1 & v_2 & \dots & v_n \end{bmatrix}$.

This is an (m×1)(1×n) multiplication, resulting in an m×n matrix. Each element $(uv)_{ij}$ in the resulting matrix is the product of $u_i$ and $v_j$.

Example:

Let $u = \begin{bmatrix} 1 \ 2 \end{bmatrix}$ and $v = \begin{bmatrix} 3 & 4 & 5 \end{bmatrix}$.

$uv = \begin{bmatrix} 1 \ 2 \end{bmatrix} \begin{bmatrix} 3 & 4 & 5 \end{bmatrix} = \begin{bmatrix} 1 \times 3 & 1 \times 4 & 1 \times 5 \ 2 \times 3 & 2 \times 4 & 2 \times 5 \end{bmatrix} = \begin{bmatrix} 3 & 4 & 5 \ 6 & 8 & 10 \end{bmatrix}$.

Summary of Vector Multiplication involving Row Vectors

Operation Input Dimensions Output Dimension Notes
Row Vector by Matrix (vA) (1×m)(m×n) 1×n Standard matrix multiplication
Dot Product (uv) (1×n)(n×1) 1×1 (Scalar) Row vector times a column vector
Outer Product (uv) (m×1)(1×n) m×n Column vector times a row vector

Understanding these different operations clarifies how row vectors participate in multiplication within linear algebra.

Related Articles