# How to represent the z-axis of a coordinate frame B using spherical coordinates defined in another coordinate frame A

I have two 3D rotation matrices, A and B. The columns of these rotation matrices can of course be interpreted as representing the x-, y- an z-bases of two new coordinate frames. What I want to know is, how can I define the z-basis of coordinate frame B in spherical coordinates defined in coordinate frame A.

The notation $$R^P_Q$$ denotes the rotation matrix whose columns represent the coordinate axes of the frame $$Q$$ expressed in the coordinate frame $$P$$. If I understand your statements correctly, you have $$R^E_A$$ and $$R^E_B$$, where $$E$$ is some reference coordinate frame, and you seek $$R^A_B$$. The z-axis of the frame $$B$$ expressed in frame $$A$$ is simply the third column of this matrix. $$R^A_B = R^A_E R^E_B = (R^E_A)^{-1}R^E_B$$
Since you already have the right hand side of this equation, $$R^A_B$$ is readily obtained and you can extract its third column which I denote by $$(x,y,z)$$. Now, you can simply convert it into spherical coordinates using the relevant formulas for coordinate transformations. See this for instance.