# Operator to perform hadamard product between a repeated vector and a matrix

Suppose that I have a m x n matrix A and a m x 1 vector b. I want to describe the following computations with some LaTeX operator:

Form a matrix B repeating b for n times, then perform the Hadamard product between A and B.

Does exists an operator for such task? If not, can someone provide an elegant way to express the computation?

## 2 Answers

Not entirely sure if this is what you want, but I would write it like this:

\usepackage{amsmath}
...
\begin{equation}
A \circ \vec{b} = (a_{ij}\cdot b_i) =
\begin{pmatrix}
a_{11} \cdot b_{1} & \cdots & a_{1n} \cdot b_{1} \\
\vdots & \ddots & \vdots \\
a_{m1} \cdot b_{m} & \cdots & a_{mn} \cdot b_{m}
\end{pmatrix}
\end{equation} \circ is the symbol I have seen used for Hadamard-product, you would be extending it's meaning for a Hadamard-product between Matrix and Vector. I'm not sure if this symbol is already used for some other operation between Matrix and Vector, but you could choose whatever symbol you want, or a function for that matter.

• That was exactly what I was thinking to do, I just wanted to hear some other opinion, thanks! – aretor May 25 '17 at 15:20
• You're welcome. Depending on how formal you want to go, you might consider adding the definitions for A being m x n, b being m x 1 and the result being m x n. Although I consider this to be implicitly the case, so for a beamer presentation I wouldn't add these, but for a book I would. – clocktown May 25 '17 at 15:23

You can left multiply $\mathbf{A}$ by the diagonal matrix whose main diagonal is $\mathbf{b}$, i.e.

$$\diag{\mathbf{b}}\mathbf{A}$$