Matrix-vector notation for adding vector elements to each row of a matrix

matrices

I am adding elements from a single row vector to the respective elements in each row of a matrix. Thus, let the $n \times 3$ matrix be

$X =\begin{bmatrix}
x_{11} & x_{12} & x_{13}\\
x_{21} & x_{22} & x_{23}\\
\vdots & \vdots & \vdots\\
x_{n1} & x_{n2} & x_{n3}\\
\end{bmatrix}$
,

and let the 3-element vector be

$y =\begin{bmatrix}
y_{1} & y_{2} & y_{3}\\
\end{bmatrix}$
.

What would the matrix notation be for adding this vector to each row (element-by-element) of the matrix? That is, I am doing the following:

$\begin{bmatrix}
x_{11} + y_1 & x_{12} + y_2 & x_{13} + y_3 \\
x_{21} + y_1 & x_{22} + y_2 & x_{23} + y_3 \\
\vdots & \vdots & \vdots\\
x_{n1} + y_1 & x_{n2} + y_2 & x_{n3} + y_3 \\
\end{bmatrix}$
.

What comes to mind is use of a matrix of ones, i.e. 1, cross-multiplied by the vector, and then a simple matrix-matrix addition. Or is there a type of Kronecker addition $\oplus$ or Hadamard addition $\boxplus$ that I could use to frontload everything?

I have seen this:

$\mathbf{Z} = \mathbf{X} + \mathbf{1} \mathbf{y}^\top$

but what would the dimensions of $\mathbf{1}$ be? If it's $n \times 3$ then the vector elements would be summed, which is not what I want.

Best Answer

You could use the outer product notation (Also as mentioned in your comments from @V.S.e.H and @eyeballfrog):

$$ \mathbf{1}\otimes\begin{pmatrix} y_1&y_2&y_3 \end{pmatrix}= \begin{pmatrix} 1\\\vdots\\1 \end{pmatrix}\otimes \begin{pmatrix} y_1&y_2&y_3 \end{pmatrix}= \begin{pmatrix} y_1&y_2&y_3\\ &\vdots\\ y_1&y_2&y_3\\ \end{pmatrix} $$ With the $\mathbf{1}$ being a vector of $1$s with length $n$. This matrix can then be added to the $X$-matrix.

Check out this wiki link for more info about the Outer product https://en.wikipedia.org/wiki/Outer_product