Skip to content

Commutative Swap

The Commutative Property of numbers says that we can re-order two addition or multiplication terms so that one occurs before the other in the expression, without changing the value of the expression.

The formulation of this property is the same for addition and multiplication:

  • Addition a + b = b + a
  • Multiplication a * b = b * a

The commutative property is used for re-arranging the order of parts of an expression, and is as such very important for working with mathematical expressions.

Transformations

Given a common parent node, this rule switches the order of the children of that node. It can only be applied to addition or multiplication nodes.

Addition

a + b = b + a

        +                  +
       / \                / \
      /   \     ->       /   \
     /     \            /     \
    a       b          b       a

Multiplication

a * b = b * a

        *                  *
       / \                / \
      /   \     ->       /   \
     /     \            /     \
    a       b          b       a

Examples

Rule file not found: commutative_property.json


Last update: December 29, 2019