# Using pre multiply or post multipy for rotational matrix to get a new homogenous transformation matrix?

I am confused about how do I multiply the rotational matrix in this case. I know that both T1 and T2 needs to be multiplied by a rotational matrix but I don't know how to multiply the rotational matrix. Do I use the post multiply or pre multiply?

Since from what I read that post multiply is used when the moving coordinate is rotated with the reference of its own coordinate, and pre multiply is used when the moving coordinate is rotated with the reference of the fixed coordinate. So I would like to know in this case which one is moving coordinate and which one is moving coordinate?

I have tried to find the new transformation matrix, but I'm not sure whether it is correct or not. When working with rigid-body transformations, it is crucial to understand which coordinate frame the transformation is defined in. Further, there are different notations for this, so it is important to know which is in use. Let's assume that $$T_b^a$$ describes the coordinate axes of frame $$b$$ with respect to the coordinate axes of frame $$a$$. (Note that this is the same transformation that transforms data in frame $$b$$ and expresses it in frame $$a$$.)

Observe that with this notation, the composition of transformations is clear and follows mnemonic that subscripts and superscripts that are next to each other cancel, as in $$T_c^a = T_b^a T^b_c$$.

In your case, $$T_1$$ is really the description of the cube's coordinate frame ($$1$$) w.r.t the camera's coordinate frame ($$C$$), written $$T_1^C$$.

Likewise, $$T_2$$ describes the base coordinate axes ($$2$$) w.r.t the camera ($$C$$), written $$T_2^C$$.

Now, considering the rotation of the camera, we have the new camera axes ($$C'$$) w.r.t the original camera:

$$T_{C'}^C = \begin{bmatrix} R_z(\frac{\pi}{2}) & 0 \\ 0^\top & 1 \end{bmatrix} = \begin{bmatrix} \cos\frac{\pi}{2} & -\sin\frac{\pi}{2} & 0 & 0 \\ \sin\frac{\pi}{2} & \cos\frac{\pi}{2} & 0 & 0 \\ 0&0&1&0 \\ 0&0&0&1 \end{bmatrix}.$$

Having defined all of our transformations, we can now easily calculate our desired quantity, $$T_{C'}^2$$, which can be composed as $$T_{C'}^2 = T_C^2 T_{C'}^C = (T_2^C)^{-1} T_{C'}^C.$$