I'm struggling with the following problem. It is necessary to find the derivative expression with respect to the vector $u$:
$r(u,v)=[(u-v)(u-v)^T]\begin{pmatrix} 1\\ 1\\ 1 \end{pmatrix}=[(u-v)\otimes (u-v)]\begin{pmatrix} 1\\ 1\\ 1 \end{pmatrix}$
If we use the results from the topic https://math.stackexchange.com/questions/3112634/derivative-of-kronecker-product-of-vector-with-itself, we get:
$\frac{dr}{du}=[(\big(I\otimes(v-u)\big) + \big((v-u) \otimes I\big))]\begin{pmatrix} 1\\ 1\\ 1 \end{pmatrix}$
When I try to figure out the bracketed expression using Mathematica, I get an error. As far as I understand, something is wrong in the original formula, because the summed arrays have different dimensions.
I need help from more experienced professionals. I would be glad and grateful for help.
Clear["Derivative"]
ClearAll["Global`*"]
u = {a, b, c};
v = {x, y, z};
KroneckerProduct[u - v, u - v] // MatrixForm;
(KroneckerProduct[DiagonalMatrix[{1, 1, 1}], v - u] +
TensorProduct[v - u, DiagonalMatrix[{1, 1, 1}]]) // MatrixForm
Dimensions
to diagnose the issue - yourKroneckerProduct
is dimension{3, 9}
but theTensorProduct
is dimension{3, 3, 3}
. $\endgroup$