Let's say I have a robot consisting of a base $B$ and a manipulator $M$. The pose of the manipulator can be expressed as the transformation matrix $T_{BM}$. I also have a goal $G$ which I want to move the manipulator to, which can be expressed as the transformation matrix $T_{BG}$. My task is to compute the robot's joint angles $\theta$ which will set the manipulator to the goal pose.
To do this, I can use inverse kinematics. Now, I have some code which will take in the robot's URDF, and give me the Jacobian. This Jacobian tells me the rate of change of $M$ with respect to the rate of change of $\theta$. In other words, $J=\frac{d T_{BM}}{d \theta}$. And so to find the joint angles for the goal pose, I can use $d \theta = J^{-1} d T_{BM}$. This gives me the change in joint angles needed to reach the goal pose. (In practice, the Jacobian is just a local linearisation of the derivative, so I would perform this step multiple times).
My question is follows. The Jacobian is a 6-by-N matrix (for an N-DOF arm), and so I need a 6-by-1 vector to represent $d T_{BM}$. What should I use for $d T_{BM}$, given that all I know are the poses $T_{BM}$ and $T_{BG}$?
Here are my thoughts so far. For the linear position, it seems easy enough to just find the linear position difference between $T_{BM}$ and $T_{BG}$. But what I am confused about, is how to calculate the orientation component of $d T_{BM}$. The Jacobian defines the rate of change of rotation about the {x, y, z} axes, and so I need to express $d T_{BM}$ in terms of rotations about these axes. But how do I get this from $T_{BM}$ and $T_{BG}$? I know how to calculate $T_{MG}$ from these, and then convert the rotation into Euler angles. But it doesn't seem right that these Euler angles are what I should use for $d T_{BM}$, because the Jacobian expresses the instantaneous rate of change around all three axes simultaneously, whereas Euler angles describe a rotation by applying each of the rotations sequentially.
So, any help in understanding this would be great!