# Does vector transformation order matter?

Theoretical question - imagine a car object. There are two (or more) 'forces' acting on this car, these forces will affect where the car will steer. But the forces are calculated using car's location in relation to the world, car's steering on the other hand relies on a vector within car's local space. Therefore these forces need to be translated to the car's own space before they can be applied on the car's steering.

Now the question is - should the vectors that represent these forces be summed first and the resulting force then translated to the car's domain? Or should both forces first be translated and then summed, within car's domain? Or does it not matter?

Because of the linearity (aka distributive property) of vector addition and matrix multiplication, it doesn't matter! Yay!

Transform(Sum(v_i)) = Transform(v_0 + v_1 + ... + v_n)
= Transform(v_0) + Transform(v_1) + ... + Transform(v_n)
= Sum(Transform(v_i))


EDIT: However, transformations are not commutative, so these are not equal:

Transform_A(Transform_B(v_i)) != Transform_B(Transform_A(v_i))

• +1 but please edit slightly. Per question title, transformation order does matter (when rotating), translation-only order does not.
– Jon
Apr 24, 2015 at 5:09
• Yes, mathematically speaking. However, the resulting operations are not the same, which might have an impact on performance (1 transform vs. N transforms), or maybe precision (just speculating here). Remember for example that grouping matrix multiplications has an impact on the required amout of work. Apr 24, 2015 at 8:42