Assume you have a current orientation $x$ and a desired orientation $x_d$ expressed as $3 \times 1$ vectors containing XYZ (roll, pitch, yaw) Euler angles.
The easiest approach to computing the error between these two orientations is to simply perform vector subtraction, however, I have seen an alternative approach which involves converting each Euler angle representation into rotation matrices $R$ and $R_d$, computing the error as $R_e = R_dR^T$ and then extracting XYZ Euler angles $x_e$ from $R_e$.
Question: What is the interpretation of the three numbers in $x_e$ that result from this approach?
My initial guess was that it would still be some sort of error such that $x+x_e=x_d'$ and $x_d'$ (which does not, in general, contain the same numbers as $x_d$) would represent the same orientation as $x_d$. The motivation for my thinking is that the shortest distance from $355^\circ$ to $5^\circ$ on the unit circle is to add $10^\circ$ rather than subtract $350^\circ$ because $365^\circ$ and $5^\circ$ correspond to the same 1-D orientation. I thought somehow this rotation matrix approach was accounting for the wrap-around in 3-D and essentially finding an $x_e$ with the smallest magnitude. This could be checked by comparing the rotation matrices that result from $x_d$ and $x_d'$, however I have found that these matrices are not the same.
There are about two dozen ways Euler angles can be defined (including Tait-Bryan variants), so who knows? Better yet, why work with the wrong tool?
If you used unit quaternions instead, with $\mathbf{b}$ describing the first orientation, $\mathbf{a}$ describing the second orientation, then $\mathbf{c}$, $$\mathbf{a} = \mathbf{c} \mathbf{b} \quad \iff \quad \mathbf{c} = \mathbf{b}^{-1} \mathbf{a}$$ would describe the difference between the two orientations. Quaternion multiplication (it's called Hamilton product) and reciprocal are described in the Wikipedia Quaternion article; this is a straightforward operation using four components per quaternion variable.
The Wikipedia Quaternions and spatial rotation article describes how to convert a quaternion into a 3×3 rotation matrix, and how to recover the quaternion given a 3×3 rotation matrix. Unlike Euler and Tait-Bryan angles, unit quaternions have only one definition, and do not suffer from gimbal lock or other oddities.
Furthermore, if you used $$\mathbf{c} = c_w + c_i \hat{i} + c_j \hat{j} + c_k \hat{k}$$ then $$\left\lbrace\begin{aligned} c_w &= \cos\left(\frac{\theta}{2}\right) \\ c_i &= a_x \sin\left(\frac{\theta}{2}\right) \\ c_j &= a_y \sin\left(\frac{\theta}{2}\right) \\ c_k &= a_z \sin\left(\frac{\theta}{2}\right) \\ \end{aligned}\right. , \quad \hat{a} = \left[\begin{matrix}a_x\\a_y\\a_z\end{matrix}\right]$$ where $\theta$ is the angle of rotation, and $\hat{a}$ is the unit vector describing the rotation axis, that rotates $\mathbf{b}$ to $\mathbf{a}$.
Note that versors aka unit quaternions are quaternions for which $c_w^2 + c_i^2 + c_j^2 + c_k^2 = 1$. Whenever you get a quaternion, you can safely normalize it using $$\begin{aligned} \displaystyle n &= \sqrt{c_w^2 + c_i^2 + c_j^2 + c_k^2} \\ \displaystyle q_w &= \frac{c_w}{n} \\ \displaystyle q_i &= \frac{c_i}{n} \\ \displaystyle q_j &= \frac{c_j}{n} \\ \displaystyle q_k &= \frac{c_k}{n} \\ \end{aligned}$$ Unlike matrix normalization, this has no direction preference, so it is safe to do after each operation that yields a quaternion.
You can even interpolate $0 \le \alpha \le 1$ between two quaternions, using $$\mathbf{c} = (1 - \alpha)\mathbf{b} + \alpha\mathbf{a}$$ if you normalize the result as above. Then, the orientation described by $\mathbf{c}$ is such that points travel in great circle arcs, either the shortest or longest way around.
(If $b_i a_i + b_j a_j + b_k a_k \lt 0$, it'll take the long way around. Fortunately, you can negate all four components of a versor without affecting the orientation it describes, so you can simply do that to one of the two versors to make sure you take the short way around.)
This also means that if you do have two pure rotation matrices, and want to find the (minimum) amount of rotation between the two (but do not care about the axis), you can do it rather easily by recovering $\mathbf{b}$ and $\mathbf{a}$ quaternions from the two matrices, and then calculating $2\arccos(c_q)$; you do not need to calculate any of the other components of $\mathbf{c}$.
In my opinion, you should complain, loudly, to whoever taught you Euler angles instead of versors. It's like teaching a plumber how to solder PCBs, but not how to solder copper pipes.