Consider that reformulating an Euler angle problem (3 variables) as a quaternion problem (4 variables) or a rotation matrix problem (9 variables) often makes it easier to solve, especially with computer assistance. Yes, you wind up with more equations, but plain algebraic equations are much more tractable than trig functions.
By "substitute", I mean what Replace does.