I have a question about differentiating an expression which has multiple kronecker products.
I have the following objective function I would like to differentiate with respect to $\mathbf{Q}$: \begin{equation*} \lVert\mathbf{y}-\mathbf{A}(\mathbf{Q}\otimes\mathbf{Q}\otimes\mathbf{Q}\otimes\mathbf{Q})\mathbf{x}\rVert^2_2 \end{equation*} where $\mathbf{y}\in\mathbb{R}^m$, $\mathbf{A}\in\mathbb{R}^{m\times K^4}$, $\mathbf{Q}\in\mathbb{R}^{K\times K}$ and $\mathbf{x}\in\mathbb{R}^{K^4}$. I am confused with how the chain rule works with respect to matrix differentiation. This is how I proceeded:
Let $ f=\lVert\mathbf{y}-\mathbf{A}(\mathbf{Q}\otimes\mathbf{Q}\otimes\mathbf{Q}\otimes\mathbf{Q})\mathbf{x}\rVert^2_2$ and $\mathbf{B}=\mathbf{Q}\otimes\mathbf{Q}\otimes\mathbf{Q}\otimes\mathbf{Q}$. Therefore $\frac{df}{d\mathbf{Q}}=\frac{df}{d\mathbf{B}}\frac{d\mathbf{B}}{d\mathbf{Q}}$
When I calculate $\frac{df}{d\mathbf{B}}=\mathbf{A}^T(\mathbf{y}-\mathbf{ABx})\mathbf{x}^T$ I gain a $\mathbb{R}^{K^4\times K^4}$ matrix not a $\mathbb{R}^{K\times K}$ matrix that I am hoping for. Therefore I am using the chain rule wrong because of the change in dimensions i.e scalar to matrix.
Thank you for your help in advance.