I will make an example. The Sun-Earth system - the Earth rotates about its own axis and at the same time it also orbits the Sun. I choose a coordinate system that corotates with the Earth (z axis is the spin axis) and I need to find how the direction vector to the Sun evolves with time. Unlike Earth - Sun system I presume circular orbit.
For example at t0 = 0, the non-normalized Sun direction vector is (1,0,1) and I want to know what is this vector at some time t (given the ω rotation angular speed and Ω orbiting angular speed).
(The same problem can be viewed from another coordinate system - Sun centric, where the z axis is perpendicular to the orbital plane and x-axis is the direction to the Earth at t0. In this case I need to know the time evolution of a normal to the Earth surface given at t0.)
The Earth - Sun system is just an illustration of the rotations involved. I need this for a general case of a body orbiting another body while rotating about its axis.
This cannot be done as composition of rotation matrices, they do not commute and the results depend on what rotation I do first. I believe the proper derivation must start with the equations of motion.