Row-wise and Column-wise Scalar Multiplication of Matrix
Theorem
Given a diagonal matrix $D := \text{diag} \left( d_{1} , \cdots , d_{n} \right)$ and a matrix $D := \text{diag} \left( d_{1} , \cdots , d_{n} \right)$, the following holds. $$ \begin{align*} D A =& \begin{bmatrix} d_{1} a_{11} & d_{1} a_{12} & \cdots & d_{1} a_{1n} \\ d_{2} a_{21} & d_{2} a_{22} & \cdots & d_{2} a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ d_{n} a_{n1} & d_{n} a_{n2} & \cdots & d_{n} a_{nn} \end{bmatrix} \\ A D =& \begin{bmatrix} d_{1} a_{11} & d_{2} a_{12} & \cdots & d_{n} a_{1n} \\ d_{1} a_{21} & d_{2} a_{22} & \cdots & d_{n} a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ d_{1} a_{n1} & d_{2} a_{n2} & \cdots & d_{n} a_{nn} \end{bmatrix} \end{align*} $$ In other words, multiplying the diagonal matrix $D$ on the left results in scalar multiplication by row, while multiplying it on the right results in scalar multiplication by column.
Explanation
Let the $i$-th column vector of $A$ be denoted by $\mathbf{a}_{i}$.
$$ A = \begin{bmatrix} \vert & \vert & & \vert \\ \mathbf{a}_{1} & \mathbf{a}_{2} & \cdots & \mathbf{a}_{n} \\ \vert & \vert & & \vert \end{bmatrix} = \begin{bmatrix} \mathbf{a}_{1} & \mathbf{a}_{2} & \cdots & \mathbf{a}_{n} \end{bmatrix} $$
Then the formula above can be written as
$$ AD = \begin{bmatrix} d_{1}\mathbf{a}_{1} & d_{2}\mathbf{a}_{2} & \cdots & d_{n}\mathbf{a}_{n} \end{bmatrix} $$
Proof
This type of proof is generally poisonous to do. Let’s just visually check it for a $3$th order matrix.
$$ \begin{bmatrix} x & 0 & 0 \\ 0 & y & 0 \\ 0 & 0 & z \end{bmatrix} \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix} = \begin{bmatrix} xa & xb & xc \\ yd & ye & yf \\ zg & zh & zi \end{bmatrix} $$
■