I'm trying to understand why the result of a composition of linear transformations (two rotations) it is different from mapping the base vectors from $R^3$ to $R^3$ twice. I'll explain. I have a mapping: ϕ that maps vectors in $R^3$ to $R^3$ as a linear combinations of the canonical base vectors (e1,e2,e3). The transformation matrix associated with ϕ is the following:
\begin{bmatrix}\cos(a)&0&\sin(a)\\0&1&0\\-\sin(a)&0&\cos(a)\end{bmatrix} That is the classic counterclockwise rotation with respect to the e2 axis.
Now I want to map the canonical base vectors (e1,e2,e3) using ϕ.
$ϕ(\mathbf{e1}) = \cos(a) \bigl( \begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix} \bigr) + 0 \bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr) - \sin(a) \bigl( \begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix} \bigr)$ = $\bigl( \begin{smallmatrix} \cos(a) \\ 0 \\ -\sin(a) \end{smallmatrix} \bigr)$
$ϕ(\mathbf{e2}) = 0 \bigl( \begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix} \bigr) + 1 \bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr) + 0 \bigl( \begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix} \bigr) = \bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr)$
$ϕ(\mathbf{e3}) = \sin(a) \bigl( \begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix} \bigr) + 0 \bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr) + \cos(a) \bigl( \begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix} \bigr) = \bigl( \begin{smallmatrix} \sin(a) \\ 0 \\ \cos(a) \end{smallmatrix} \bigr)$
After that, I want to perform a counterclockwise rotation around the rotated base vector e3 (e.g. ϕ(e3)).
To do this, i'm using this transformation matrix:
\begin{bmatrix}\cos(b)&-\sin(b)&0\\\sin(b)&\cos(b)&0\\0&0&1\end{bmatrix}
And I map the "old" rotated basis onto the new basis using Ψ:
$Ψ(ϕ(\mathbf{e1})) = \cos(b) \bigl( \begin{smallmatrix} \cos(a) \\ 0 \\ -\sin(a) \end{smallmatrix} \bigr) + \sin(b) \bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr) + 0 \bigl( \begin{smallmatrix} \sin(a) \\ 0 \\ \cos(a) \end{smallmatrix} \bigr) = \bigl( \begin{smallmatrix} \cos(a)\cos(b) \\ \sin(b) \\ -\sin(a)\cos(b) \end{smallmatrix} \bigr)$
$Ψ(ϕ(\mathbf{e2})) = -\sin(b) \bigl( \begin{smallmatrix} \cos(a) \\ 0 \\ -\sin(a) \end{smallmatrix} \bigr) + \cos(b) \bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr) + 0 \bigl( \begin{smallmatrix} \sin(a) \\ 0 \\ \cos(a) \end{smallmatrix} \bigr) = \bigl( \begin{smallmatrix} -\cos(a)\sin(b) \\ \cos(b) \\ \sin(a)\sin(b) \end{smallmatrix} \bigr)$
$Ψ(ϕ(\mathbf{e3})) = 0 \bigl( \begin{smallmatrix} \cos(a) \\ 0 \\ -\sin(a) \end{smallmatrix} \bigr) + 0 \bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr) + 1 \bigl( \begin{smallmatrix} \sin(a) \\ 0 \\ \cos(a) \end{smallmatrix} \bigr) = \bigl( \begin{smallmatrix} \sin(a) \\ 0 \\ \cos(a) \end{smallmatrix} \bigr)$
Assuming that what is written is true, now I have tried to do the verification, checking if the composition of the two rotations actually gives me the same result.
Therefore:
\begin{equation} \begin{bmatrix}\cos(b)&-\sin(b)&0\\\sin(b)&\cos(b)&0\\0&0&1\end{bmatrix}*\begin{bmatrix}\cos(a)&0&\sin(a)\\0&1&0\\-\sin(a)&0&\cos(a)\end{bmatrix}=\begin{bmatrix}\cos(a)\cos(b)&-\sin(b)&\sin(a)\cos(b)\\\sin(b)\cos(a)&\cos(b)&\sin(a)\sin(b)\\-\sin(a)&0&\cos(a)\end{bmatrix} \end{equation}
If now I tried to make a linear mapping transforming the canonical basic vectors with this composition of rotations, I would find a different result from the one found before.
Therefore (calling τ this linear mapping):
τ(e1) = \cos(a)\cos(b) $\bigl( \begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix} \bigr)$ + \sin(b)\cos(a) $\bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr)$ - \sin(a) $\bigl( \begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix} \bigr)$ = $\bigl( \begin{smallmatrix} \cos(a)\cos(b) \\ \sin(b)\cos(a) \\ -\sin(a) \end{smallmatrix} \bigr)$
τ(e2) = -\sin(b) $\bigl( \begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix} \bigr)$ + \cos(b) $\bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr)$ + 0 $\bigl( \begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix} \bigr)$ = $\bigl( \begin{smallmatrix} -\sin(b) \\ \cos(b) \\ 0 \end{smallmatrix} \bigr)$
τ(e3) = \sin(a)\cos(b) $\bigl( \begin{smallmatrix} 1 \\ 0 \\ 0 \end{smallmatrix} \bigr)$ + \sin(a)\sin(b) $\bigl( \begin{smallmatrix} 0 \\ 1 \\ 0 \end{smallmatrix} \bigr)$ + \cos(a) $\bigl( \begin{smallmatrix} 0 \\ 0 \\ 1 \end{smallmatrix} \bigr)$ = $\bigl( \begin{smallmatrix} \sin(a)\cos(b) \\ \sin(a)\sin(b) \\ \cos(a) \end{smallmatrix} \bigr)$
Clearly: Ψ(ϕ(e1)) ≠ τ(e1), Ψ(ϕ(e2)) ≠ τ(e2), Ψ(ϕ(e3)) ≠ τ(e3)
When instead I should have expected the same result...
I noticed that by reversing the order of the matrix product, I get the same result instead... I can't understand why.
Note that$$\phi(e_1)=(\cos(a),0,-\sin(a))=\cos(a)e_1-\sin(a)e_3.$$Therefore\begin{align}\psi\bigl(\phi(e_1)\bigr)&=\psi\bigl(\cos(a)e_1-\sin(a)e_3\bigr)\\&=\cos(a)\psi(e_1)-\sin(a)\psi(e_3).\end{align}There is no reason for you to assume that this is equal to$$\cos(b)\phi(e_1)+\sin(b)\phi(e_2)+0\times\phi(e_3),$$which is what you did.