Derivative of vectorized block matrix in terms of derivatives of vectorized blocks

block matricesderivativesmatricesmatrix-calculusvectorization

Suppose I have some block matrix $\pmb{Y}$ that is a function of $\pmb{x}$:
$$
\pmb{Y} = \begin{bmatrix}
\pmb{A} & \pmb{C} & \pmb{E} \\
\pmb{B} & \pmb{D} & \pmb{F} \\
\end{bmatrix}.
$$

I am interested in obtaining the following derivative:
$$
\frac{\partial \mathrm{vec}\left( \pmb{Y} \right)}{\partial \pmb{x}}.
$$

However, let's say I only have expressions for every block that are not easily combined. Therefore, I can relatively easily obtain:
$$
\frac{\partial \mathrm{vec}\left(\pmb{A}\right)}{\partial \pmb{x}},
\frac{\partial \mathrm{vec}\left(\pmb{B}\right)}{\partial \pmb{x}}, \ldots
\frac{\partial \mathrm{vec}\left(\pmb{F}\right)}{\partial \pmb{x}}.
$$

It seems clear to me that the resulting values of these expressions constitute all values in $\partial \mathrm{vec}\left( \pmb{Y} \right)/\partial \pmb{x}$, but out of order. I can come up with some algorithms for determining this order I guess, but I was wondering if there isn't some easy straightforward way of writing the derivative of the vectorized matrix $\pmb{Y}$ in terms of derivatives of the vetorized blocks.

Best Answer

The gradient is hard to calculate, but the differential is easy.

For the A-block, let $v_a = {\rm vec}(A)$ and calculate the differential $$\eqalign{ dA &= {\rm Mat}\big(dv_a\big) = {\rm Mat}\bigg(\frac{\partial v_a}{\partial x}\,\, dx\bigg) \cr }$$ Doing the same for the other blocks leads to $$\eqalign{ dY &= \pmatrix{dA&dC&dE\cr dB&dD&dF} = {\rm Mat}\bigg(\frac{\partial v_y}{\partial x}\,\, dx\bigg) \cr }$$