What's the derivative of this quadratic with respect to matrix A? What's $$\frac{\partial}{\partial \mathbf{A}}\left((x_1-(\mathbf{I}_T\otimes \mathbf{A})x_2)^\intercal \mathbf{K}^{-1}(x_1-(\mathbf{I}_T\otimes \mathbf{A})x_2)\right)$$?
K is symmetric
I'm thinking we could use some sort of chain rule getting $$2(x_1-(\mathbf{I}_T\otimes \mathbf{A})x_2)^\intercal \mathbf{K}^{-1}(-x_2)$$
Am I correct?
 A: For typing convenience define
$$\eqalign{
 y &= (I_n\otimes A)x_2-x_1\,\,\,\,\,&\big(I_n\in{\mathbb R}^{n\times n},\,A\in{\mathbb R}^{p\times q}\big) \cr
 M &= K^{-1} = M^T &\big(M\in{\mathbb R}^{pn\times pn}\big) \cr
}$$
Write the cost function in terms of these new variables and find its differential.
$$\eqalign{
\phi &= y^TMy \cr&= M:yy^T \cr
d\phi &= 2M:dy\,y^T = 2My:dy = (2Myx_2^T):(I_n\otimes dA) \cr
  &= B:(I_n\otimes dA) = {\rm vec}(B):{\rm vec}(I_n\otimes dA) \cr  
}$$
where $B\in{\mathbb R}^{pn\times qn}$
Now the trick is vectorizing the Kronecker product on the RHS.
$$\eqalign{
E_k &= I_q\otimes e_k^T &\big(E_k\in{\mathbb R}^{q\times qn}\big) \cr
U &= \big[\,E_1\,\,\,E_2\,\,\ldots\,\,E_n\,\big]^T &\big(U\in{\mathbb R}^{qn^2\times q}\big)\cr
{\rm vec}(I_n\otimes dA)
 &= (U\otimes I_p)\,\,{\rm vec}(dA) = &(U\otimes I_p)\,\,da \cr
}$$ where the {$e_k$} vectors are the columns of $I_n$ matrix.
Substituting
$$\eqalign{
d\phi &= b:(U\otimes I_p)\,da   &= (U^T\otimes I_p)\,b:da \cr
  &= {\rm vec}(I_p{\hat B}U):da &= {\hat B}U:dA \cr
\frac{\partial\phi}{\partial A} &= {\hat B}U \cr
}$$
where ${\hat B}\in{\mathbb R}^{p\times qn^2}$
Since they have different shapes, $\,{\hat B}\ne{B},$  however since they have the same elements and relative ordering $\,{\rm vec}({\hat B})={\rm vec}({B})=b.$

Update
Here is a more direct way of writing this result in terms of the problem variables
$$\eqalign{
\frac{\partial\phi}{\partial A}
 &= \sum_{k=1}^n\;\left(e_k^T\otimes I_p\right)B\,\big(e_k\otimes I_q\big) \\
 &= \sum_{k=1}^n\;2\left(e_k^T\otimes I_p\right)Myx_2^T\,\big(e_k\otimes I_q\big) \\
 &= \sum_{k=1}^n\;2\left(e_k^T\otimes I_p\right)K^{-1}\big((I_n\otimes A)x_2-x_1\big)x_2^T\,\big(e_k\otimes I_q\big) \\
}$$
