# Extremely complex vector-matrix expression and its differentiation by vector

Given:

1. $$Q=R_z(\psi)R_y(\xi)R_x(\phi)$$ - rotation matrix

2. $$\boldsymbol{\theta}=\left[\begin{array}{@{}c@{}} \phi \\ \xi \\ \psi \end{array} \right]$$ - vector of angles

3. $$p=Q\left[\begin{array}{@{}c@{}} 0 \\ 0 \\ 1 \end{array} \right]$$ - vector

4. $$i_p=\begin{pmatrix} I_x & 0 & 0 \\ 0 & I_y & 0 \\ 0 & 0 & I_z\end{pmatrix}$$ - constant matrix;

5. $$[p]_×=\begin{pmatrix} 0 & -p(3) & p(2) \\ p(3) & 0 & -p(1) \\ -p(2) & p(1) & 0\end{pmatrix}$$ - skew-symmetry matrix for vector $$p$$

6. $$I_p=[p]_×[p]_×^T+Qi_pQ^T$$

Find general formula in vector-matrix form for derivative of matrix $$I_p$$ by vector $$\boldsymbol{\theta}$$, i.e. $$\frac{dI_p}{d\boldsymbol{\theta}}$$

My considerations:

$$\frac{dI_p}{d\boldsymbol{\theta}} \approx \frac{d[p]_×}{d\boldsymbol{\theta}}[p]_×^T+[p]_×\frac{d[p]_×^T}{d\boldsymbol{\theta}}+\frac{dQ}{d\boldsymbol{\theta}}i_pQ^T+Qi_p\frac{dQ^T}{d\boldsymbol{\theta}}$$

I think that the chain rule is suitable here, but I am not good at differentiating matrices by vector. And I'm guessing the tensor product might be needed here.

This is an excerpt from the article https://www.sciencedirect.com/science/article/abs/pii/S0094114X10000418. How do I write this using vector-matrix operations?

• what's $p(1),p(2),p(3)$? Commented Jul 16, 2021 at 8:07
• @razivo elements of vector $p$
– dtn
Commented Jul 16, 2021 at 8:07
• what are $I_x,I_y,I_z$? Commented Jul 16, 2021 at 9:37
• @razivo just arbitrary positive numbers
– dtn
Commented Jul 16, 2021 at 9:38

$$\def\l{\left} \def\r{\right} \def\lr#1{\l(#1\r)} \def\p{{\partial}} \def\g#1#2{\frac{\p #1}{\p #2}}$$For typing convenience, let $$P = [p]_\times$$ and note that $$P^T=-P \;\;{\rm and}\;\;Pp=0$$

Since $$p=Qe_3$$ is a unit vector \eqalign{ P^3 &= -P \\ P^2 &= (pp^T-I) \\ PP^T &= (I-pp^T) \\ &= I-Qe_3e_3^TQ^T \\ } which reduces your main function to \eqalign{ I_p &= I + Q\,\big(i_p-e_3e_3^T\big)\,Q^T \\ &= I + Q\,i_p^\prime\,Q^T \\ } The Rodrigues formula for a given axis $$\big(a,\,A=[a]_\times\big)$$ and angle $$(\theta)$$ can be differentiated \eqalign{ R &= I + (\sin\theta)A + (1-\cos\theta)A^2 \\ \g{R}{\theta} &= (\cos\theta)A + (\sin\theta)A^2 \;=\; AR \;=\; RA \\ } The given composite rotation matrix $$\big(Q=R_3R_2R_1\big)$$ can be likewise differentiated \eqalign{ \g{Q}{\theta_1} &= R_3R_2R_1A_1 \;&=\; QA_1 \\ \g{Q}{\theta_2} &= R_3A_2R_2R_1 \\ \g{Q}{\theta_3} &= A_3R_3R_2R_1 &= A_3Q \\ } and \eqalign{ \g{I_p}{\theta_k} &= \lr{\g{Q}{\theta_k}}\,i_p^\prime\,Q^T + Q\,i_p^\prime\,\lr{\g{Q}{\theta_k}}^T \\ } The paper that you're reading is uses the Kronecker product $$(\otimes)$$ to define a block-style gradient $$\nabla_X F = \lr{\g{}{X}\otimes F}$$ This is called the Vetter Matrix Calculus, and if you Google for that phrase one of the first links will be an excellent 1978 review article by Brewer from the IEEE Journal.

It's interesting, but I've always found it a bit awkward to use.

• greg, it's great! thank you for high-qualified answer! I will try test it in Mathcad
– dtn
Commented Jul 16, 2021 at 17:18
• In the proposed calculations, there is differentiation for each of the vector components separately. Can you write a general formula for the entire vector?
– dtn
Commented Jul 16, 2021 at 18:04
• The gradient is a third-order tensor, so it doesn't fit within standard matrix notation. If you allow the dyadic product $(\star)$, then you can use the Euclidean basis vectors $\{e_k\}$ to write the gradient as \eqalign{ \frac{\partial I_p}{\partial\theta} = \sum_{k=1}^3\left(\frac{\partial I_p}{\partial\theta_k}\right)\star e_k }
– greg
Commented Jul 17, 2021 at 0:10
• Thank you very much for help :))
– dtn
Commented Jul 17, 2021 at 4:53