# Simplify not considering all assumptions properly

I have the following expression:

expr1 = Simplify[RotationMatrix[angle*x/n, {a, b, c}], {angle \[Element] Reals, x \[Element] Reals, n \[Element] PositiveIntegers, a \[Element] Reals, b \[Element] Reals, c \[Element] Reals, 0 <= x <= 1}]


which I then want to further simplify by stating that the vector {a,b,c} is a unit-vector:

expr2 = Simplify[expr1, a^2 + b^2 + c^2 == 1]


This works as expected. But if I put the unit-vector-constraint in the list of assumptions of the first expression directly, it will not end in the same result. So this:

expr3 = Simplify[RotationMatrix[angle*x/n, {a, b, c}], {a^2 + b^2 + c^2 == 1, angle \[Element] Reals, x \[Element] Reals, n \[Element] PositiveIntegers, a \[Element] Reals, b \[Element] Reals, c \[Element] Reals, 0 <= x <= 1}]


Will not simplify to the same expression as expr2. Why is that ?

• It is rather simple. If you evaluate RotationMatrix[angle*x/n, {a, b, c}] you will see that it has no such a construct as a^2 + b^2 + c^2 in the explicit form. In the best case, you can find something like Abs[a]^2 + Abs[b]^2 + Abs[c]^2. Account for the condition like a^2 + b^2 + c^2 == 1 requires that the corresponding part of your expression exactly fits the left-hand part of the condition. Which in your example is not the case. In contrast, after the first simplification, you get such explicit expressions and, therefore, you can simplify further. Mar 19 at 16:09
• Simplify[expr3 - expr2, {a^2 + b^2 + c^2 == 1}] produces {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}. Mar 19 at 16:22
• hmm, shouldn't Simplify try to simplify as much as possible ? And what is also weird is that expr3 actually is more complicated than expr1. so the extra constraint of x^2+y^2+z^2==1 made it even more complicated... Mar 19 at 16:48

The following will also get you to a similar expression, perhaps a bit faster:

Assuming[a^2 + b^2 + c^2 == 1,
Simplify@
ComplexExpand[RotationMatrix[angle*x/n, {a, b, c}], TargetFunctions -> {Re, Im}]
]


If you want something closer to the output of your second Simplify, you can specify that you want to minimize the number of times $$a,b,c$$ appear in your expression:

Assuming[a^2 + b^2 + c^2 == 1,
Simplify[
ComplexExpand[RotationMatrix[angle*x/n, {a, b, c}], TargetFunctions -> {Re, Im}],
ComplexityFunction -> (10 Count[#, a | b | c, Infinity] + LeafCount[#] &)
]
]