I am trying to do some calculations taking into account the orientations and translations of some rigid bodies. I have two right-handed coordinate systems that are rotated arbitrarily with respect to one another. I want to transform to the local coordinate system for the center of mass and then do the back transform to verify that everything is set up correctly. When I do the back transform, I correctly recover the original center-of-mass position in x, but not in y or z. What am I misunderstanding?
Let $\vec{e}_{X}$, $\vec{e}_{Y}$, $\vec{e}_{Z}$ be the unit vectors for the axes of the first system, the global system that has (1,0,0), (0,1,0), (0,0,1) as a basis, and $\vec{e}_{1}$, $\vec{e}_{2}$, $\vec{e}_{3}$ the unit vectors for the axes of the local system. Let $\vec{A}$ be any vector in the two frames of reference. By definition:
$$\vec{A}=A_{X}\vec{e}_{X}+A_{Y}\vec{e}_{Y}+A_{Z}\vec{e}_{Z}$$ $$\vec{A}=A_{1}\vec{e}_{1}+A_{2}\vec{e}_{2}+A_{3}\vec{e}_{3}$$
I do the coordinate transformation from the global to the local system, taking into account both orientations and translations, by:
$$A_{1} = \vec{e}_{1} \cdot \vec{A} + A_{X} = (\vec{e}_{1} \cdot \vec{e}_{X})A_{X} + (\vec{e}_{1} \cdot \vec{e}_{Y})A_{Y} + (\vec{e}_{1} \cdot \vec{e}_{Z})A_{Z} + A_{X}$$ $$A_{2} = \vec{e}_{2} \cdot \vec{A} + A_{Y} = (\vec{e}_{2} \cdot \vec{e}_{X})A_{X} + (\vec{e}_{2} \cdot \vec{e}_{Y})A_{Y} + (\vec{e}_{2} \cdot \vec{e}_{Z})A_{Z} + A_{Y}$$ $$A_{3} = \vec{e}_{3} \cdot \vec{A} + A_{Z} = (\vec{e}_{3} \cdot \vec{e}_{X})A_{X} + (\vec{e}_{3} \cdot \vec{e}_{Y})A_{Y} + (\vec{e}_{3} \cdot \vec{e}_{Z})A_{Z} + A_{Z}$$
which reduces to
$$A_{1} = e_{1,X} A_{X} + e_{1,Y} A_{Y} + e_{1,Z} A_{Z} + A_{X}$$ $$A_{2} = e_{2,X} A_{X} + e_{2,Y} A_{Y} + e_{2,Z} A_{Z} + A_{Y}$$ $$A_{3} = e_{3,X} A_{X} + e_{3,Y} A_{Y} + e_{3,Z} A_{Z} + A_{Z}$$
where $A_{X}$, $A_{Y}$, $A_{Z}$ are the coordinates of the center of mass in the global system. Then, I do the back transform:
$$A_{X} = e_{1,X} A_{1} + e_{2,X} A_{2} + e_{3,X} A_{3} - e_{1,X} A_{X} - e_{2,X} A_{Y} - e_{3,X} A_{Z}$$ $$A_{Y} = e_{1,Y} A_{1} + e_{2,Y} A_{2} + e_{3,Y} A_{3} - e_{1,Y} A_{X} - e_{2,Y} A_{Y} - e_{3,Y} A_{Z}$$ $$A_{Z} = e_{1,Z} A_{1} + e_{2,Z} A_{2} + e_{3,Z} A_{3} - e_{1,Z} A_{X} - e_{2,Z} A_{Y} - e_{3,Z} A_{Z}$$
Again, I am only able to recover the x-coordinate of the center of mass, but not the y- or z-coordinate. What am I misunderstanding?