Proving that ${\rm vec}(A\,{\rm Diag}(b)\,C) = ((C^T\otimes 1_a)\odot(1_c\otimes A))\,b$

linear algebramatrices

Given the following vectors and matrices
$$\eqalign{
&A\in{\mathbb R}^{a\times b},\,\,\,\,
&B\in{\mathbb R}^{b\times b},\,\,\,\,
&C\in{\mathbb R}^{b\times c} \cr
&1_a\in{\mathbb R}^{a\times 1},\,\,\,\,
&b\in{\mathbb R}^{b\times 1},\,\,\,\,
&1_c\in{\mathbb R}^{c\times 1} \cr
}$$

where $B={\rm Diag}(b)\,$ and $\,1_n$ denotes a vector of all ones of length $n$.

I would like to show that the vector $\,v={\rm vec}(ABC)\,$ can be expanded as
$$\eqalign{
v &= \Big((C^T\otimes 1_a)\odot(1_c\otimes A)\Big)\,b
}$$

where $(\otimes, \odot)$ denote the Kronecker and Hadamard products, respectively.

I am aware of several other expressions for this vector
$$\eqalign{
v &= (C^T\otimes A)\,{\rm vec}(B) \cr
v &= \Big((C^T\otimes 1_a1_b^T)\odot(1_c1_b^T\otimes A)\Big)\,{\rm vec}(B) \cr
}$$

but I don't see how to arrive at the desired formula.

Update

After studying Omnomnomnom's answer, I realized that I needed to exploit several esoteric properties to prove the formula.

1) The outer product of two vectors vectorizes to their Kronecker product
$$\eqalign{
{\rm vec}(ab^T) &= b\otimes a \cr
}$$

2) Vectors from the canonical basis distribute over a Hadamard product
$$\eqalign{
(M\odot N)e_k &= (Me_k)\odot(Ne_k) \cr
}$$

3) The distribution property of the Kronecker product of 2 arbitrary vectors and a matrix
$$\eqalign{
(C^T\otimes 1)e &= {\rm vec}(1(e^TC)) = (C^Te)\otimes 1 \cr
(1\otimes A)e &= {\rm vec}((Ae)1^T) = 1\otimes(Ae) \cr
}$$

4) A rule for mixed Kronecker/Hadamard products
$$\eqalign{
(M\odot N)\otimes(P\odot Q) &= (M\otimes P)\odot(N\otimes Q) \cr\cr
}$$

Use these rules to evaluate the $k^{th}$ column of the anticipated solution
$$\eqalign{
&\big((C^T\otimes 1_a)\odot(1_c\otimes A)\big)\,e_k \cr
&(C^T\otimes 1_a)e_k\odot(1_c\otimes A)e_k \cr
&(C^Te_k\otimes 1_a)\odot(1_c\otimes Ae_k) \cr
&(C^Te_k\odot 1_c)\otimes(1_a\odot Ae_k) \cr
&(C^Te_k)\otimes(Ae_k) \cr
}$$

which matches the $k^{th}$ column of Omnomnomnom's matrix.

Update #2

I also like O's second approach, which I interpret as
$$\eqalign{
&\Big((C^T\otimes 1_a1_b^T)\odot(1_c1_b^T\otimes A)\Big)\,{\rm vec}(B)\cr
&=\sum_k b_k\,\,\big((C^T\otimes 1_a1_b^T)\odot(1_c1_b^T\otimes A)\big)\,\big(e_k\otimes e_k\big) \cr
&=\sum_k b_k\,\,\big((C^T\otimes 1_a1_b^T)(e_k\otimes e_k)\big)\odot\big((1_c1_b^T\otimes A)(e_k\otimes e_k)\big) \cr
&=\sum_k b_k\,\,\big(C^Te_k\otimes 1_a1_b^Te_k\big)\odot\big(1_c1_b^Te_k\otimes Ae_k\big) \cr
&=\sum_k b_k\,\,\big(C^Te_k\otimes 1_a\big)\odot\big(1_c\otimes Ae_k\big) \cr
&=\sum_k b_k\,\,\big((C^T\otimes 1_c)\odot(1_a\otimes A)\big)e_k \cr
&=\big((C^T\otimes 1_c)\odot(1_a\otimes A)\big)\,b \cr
}$$

Best Answer

Let $e_1,e_2,\dots,e_b$ denote the canonical basis of $\Bbb R^b$. We compute $$ \begin{align*} \operatorname{vec}(A \operatorname{diag}(b) C) &= \operatorname{vec}\left(A \left[\sum_{i=1}^b b_i e_ie_i^T\right] C\right) \\ & = \operatorname{vec}\left(\sum_{i=1}^b b_i (Ae_i)(C^Te_i)^T\right) \\ & = \sum_{i=1}^b b_i \,(C^Te_i) \otimes (Ae_i) \\ & = \pmatrix{(C^Te_1) \otimes (Ae_1) & \cdots & (C^Te_b) \otimes (Ae_b)} \pmatrix{b_1\\ \vdots \\ b_b} \end{align*} $$ (as you did, I have used $b$ to indicate both the diagonal vector of $B$ and the size of $B$). It then suffices to rewrite the matrix on the left as $$ \pmatrix{(C^Te_1) \otimes (Ae_1) & \cdots & (C^Te_b) \otimes (Ae_b)} = \Big((C^T\otimes 1_a)\odot(1_c\otimes A)\Big) $$ One way to do so is to write $$ \pmatrix{(C^Te_1) \otimes (Ae_1) & \cdots & (C^Te_b) \otimes (Ae_b)} =\\ \pmatrix{\operatorname{vec}([Ae_1][C^Te_1]^T) & \cdots & \operatorname{vec}([Ae_b][C^Te_b]^T)} $$ and from there, apply your Hadamard formula to each column to see that the $i$th column is indeed $((C^Te_i) \otimes 1_a) \odot (1_c \otimes (Ae_i))$, so that the matrix on the left is indeed $(C^T\otimes 1_a1_b^T)\odot(1_c1_b^T\otimes A)$.


Another approach: it suffices to check that $$ \Big((C^T\otimes 1_a1_b^T)\odot(1_c1_b^T\otimes A)\Big)\,{\rm vec}(e_ie_i^T) = ((C^Te_i) \otimes 1_a) \odot (1_c \otimes (Ae_i)) $$ Since we have $$ \Big((C^T\otimes 1_a1_b^T)\odot(1_c1_b^T\otimes A)\Big)\,{\rm vec}(B) = \sum_{i=1}^b b_i\,\Big((C^T\otimes 1_a1_b^T)\odot(1_c1_b^T\otimes A)\Big){\rm vec}(e_ie_i^T) $$


Regarding the end of my first approach: I meant that we could use your last formula to note that $$ \operatorname{vec}([Ae_k][C^Te_k]^T) = \operatorname{vec}([Ae_k]_{a \times 1}\,[1]_{1 \times 1}\,[C^Te_k]^T_{1 \times c}) =\\ \Big(([C^Te_k]\otimes 1_a1_1^T)\odot(1_c1_1^T\otimes [Ae_k])\Big)\,{\rm vec}([1]_{1 \times 1}) = \\ ([C^Te_k] \otimes 1_a) \odot (1_c \otimes [Ae_k]) $$

Related Question