# How do I solve this matrix equation for infinitesimal rotations?

I have a matrix equation, taken from Wikipedia (Infinitesimale Drehungen), that looks not that complicated (note $$a$$ is a scalar, actually an angle as input paramter for the rotation matrix):

$$R(a)=\exp(aJ)$$

In my case I would like to obtain $$J$$ while $$R(a)$$ is given: $$R(a)=\left( \begin{array}{ccc} \cos\left(\sqrt{5}a\right)&-\frac{2\sin\left(\sqrt{5}a\right)}{\sqrt{5}}&\frac{\sin\left(\sqrt{5}a\right)}{\sqrt{5}}\\ \frac{2\sin\left(\sqrt{5}a\right)}{\sqrt{5}} & \frac{1}{5}\left(4\cos\left(\sqrt{5}a\right)+1\right) & -\frac{2}{5}\left(\cos\left(\sqrt{5}a\right)-1\right)\\ -\frac{\sin\left(\sqrt{5}a\right)}{\sqrt{5}} & -\frac{2}{5}\left(\cos\left(\sqrt{5}a\right)-1\right) & \frac{1}{5}\left(\cos\left(\sqrt{5}a\right)+4\right) \\ \end{array} \right)$$

I tried the following J[a_] := MatrixLog[R[a]]/a which does not work. Based on the equation $$J=\left.\frac{dR(a)}{da}\right|_{a=0}$$ that is also provided on the above-given Wikipedia page, I tried J[a_] := D[R[a], a] as well, which did not worked too.

My full listing looks as follows:

ClearAll["Global*"];
R[a_] := {{Cos[\[Sqrt]5 a], -((2 Sin[\[Sqrt]5 a])/(\[Sqrt]5)), Sin[\[Sqrt]5 a]/(\[Sqrt]5)},
{(2 Sin[\[Sqrt]5 a])/(\[Sqrt]5), (1/5) (1 + 4 Cos[\[Sqrt]5 a]), -(2/5) (-1 + Cos[\[Sqrt]5 a])},
{-(Sin[\[Sqrt]5 a]/(\[Sqrt]5)), -(2/5) (-1 + Cos[\[Sqrt]5 a]), (1/5) (4 + Cos[\[Sqrt]5 a])}};
J[a_] := MatrixLog[R[a]]/a;
J[a_] := D[R[a], a];
FullSimplify[MatrixExp[a*J]]
FullSimplify[Limit[MatrixPower[IdentityMatrix[3] + (a/n) J, n], n -> Infinity]]


The last two Print statements should yield the original matrix $$R(a)$$. I would be greatful for any help on obtaining the Matrix $$J$$.

• Asymptotic[R[a] - MatrixExp[a R'[a]] // Simplify, a -> 0] shows that expression is small O[a^2] Aug 22, 2022 at 11:05
• With a quick look, it seems to me the notation is a bit inconsistent, ie $a$ is in a dot product with $J$ in the 1st equation (hence is a matrix), but then appears as a scalar later on. I think this should be clarified before any attempts at a solution are made ;-) Aug 22, 2022 at 11:10
• You are right - $a$ is a scalar (an angle actually). And I fixed it in the OP to be treated consistently as a scalar. Aug 22, 2022 at 11:14
• Ok, thanks it's then more clear. Aug 22, 2022 at 11:16
• The use of Print is unnecessary in expressions like Print[FullSimplify[MatrixExp[a*J]]]; Just don't suppress the output with the semi-colon. Aug 22, 2022 at 14:21

Generally, Mathematica is strict when using multivalued functions (like Log), and that is why it won't fully "simplify" your expression unless you use some tricky functions (like PowerExpand or ComplexExpand).

The following works:

Clear[R, J];
R[a_] := {{Cos[\[Sqrt]5 a], -((2 Sin[\[Sqrt]5 a])/(\[Sqrt]5)),
Sin[\[Sqrt]5 a]/(\[Sqrt]5)}, {(2 Sin[\[Sqrt]5 a])/(\[Sqrt]5), (1/
5) (1 + 4 Cos[\[Sqrt]5 a]), -(2/5) (-1 +
Cos[\[Sqrt]5 a])}, {-(Sin[\[Sqrt]5 a]/(\[Sqrt]5)), -(2/5) (-1 +
Cos[\[Sqrt]5 a]), (1/5) (4 + Cos[\[Sqrt]5 a])}};

J = PowerExpand[FullSimplify[(MatrixLog[R[a]]/a)]];
J // MatrixForm


Check the result:

MatrixExp[a J] == R[a] // Reduce
(* True *)

• Works brilliantly: Print[FullSimplify[MatrixExp[a*J]]] yields the original matrix. Many thanks! Aug 22, 2022 at 11:20
• Just to provide a double-check: the limit-based equation FullSimplify[Limit[MatrixPower[IdentityMatrix[3] + (a/n) J, n], n -> Infinity]] yields the original rotation matrix as well. Aug 22, 2022 at 12:37

The derivative formula you found, $$\left.\frac{dR}{da}\right|_{a=0} = J,$$ is much easier to use than the MatrixLog functions; you just neglected to set $$a$$ to zero after you took the derivative. This can be done like so:

J = D[R[a], a] /. a -> 0
(* {{0, -2, 1}, {2, 0, 0}, {-1, 0, 0}} *)


Verifying:

Simplify[MatrixExp[a J] == R[a]]
(* True *)

Simplify[Limit[MatrixPower[IdentityMatrix[3] + (a/n) J, n], n -> Infinity] == R[a]]
(* True *)


Alternately, the matrix exponential is defined in such a way that $$\frac{dR}{da} = J R(a) \quad \Rightarrow \quad J = R^{-1} \frac{dR}{da}$$ which can also be done in Mathematica:

J = Simplify[Inverse[R[a]] . D[R[a], a]]
(* same as above *)

• This is really a very efficient alternative, which I also just tried and works great. Thank you! Aug 22, 2022 at 17:35

An alternative approach that might be useful in some cases.

You can compute the MatrixLog in the limit of small a

Limit[MatrixLog[Normal[Series[R[a], {a, 0, 1}]]]/a, a -> 0]
(* {{0, -2, 1}, {2, 0, 0}, {-1, 0, 0}} *)

• Thank you for this interesting approach, which works greatly as well. Do you have a reference (maybe wiki or math book) for this trick? On Wikipedia Page for Matrix Log I could not find it. Aug 23, 2022 at 5:44
• Your relationship is true for all values of a so it must be true in the limiting value of small a`. Aug 23, 2022 at 11:38