1
$\begingroup$

Consider the matrix $A$ and column vector $b$ where,

$A = \begin{bmatrix}1 & 2\\3 & 4\end{bmatrix}$ and $b = \begin{bmatrix}1\\3\end{bmatrix}$

In the R statistics software, the the code A*b performs element-wise multiplication of the columns in $A$ with the column vector $b$ returning a matrix with the same dimensions as $A$, i.e.

$A*b = \begin{bmatrix}1 & 2\\3 & 4\end{bmatrix} * \begin{bmatrix}1\\3\end{bmatrix} = \begin{bmatrix}1\times1 & 2\times1\\3\times3 & 4\times3\end{bmatrix}=\begin{bmatrix}1 & 2\\9 & 12\end{bmatrix}$

Is there a name for this operation? Can this operation be expressed using common matrix notation?

$\endgroup$
2
$\begingroup$

It can be written as

$A\circ(bu)$ where $u$ is row vector of ones and $\circ$ is the hadamard product

$\endgroup$
1
$\begingroup$

Let us call $\text{Diag}(b)$ the diagonal matrix, the diagonal of which is $b$

$$ \text{Diag} (b) = \begin{bmatrix} 1 & 0\\0 & 3\end{bmatrix} $$

Then

$$ \text{Diag} (b) \times A = \begin{bmatrix} 1 & 2\\9 & 12\end{bmatrix} $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.