(definition)

**Definition:**
A function where f(A, B) = f(B, A).

**See also**
*associative*.

*Note:
Multiplication is associative, e.g., 2 × (3 × 4) = (2 × 3) × 4, and commutative, e.g., 2 × 3 = 3 × 2. Subtraction is neither associative, e.g., 2 - (3 - 4) ≠ (2 - 3) - 4, nor commutative, e.g., 2 - 3 ≠ 3 - 2. Because of rounding floating point addition on a computer is not associative, e.g., (1000000 + .00001) + .00001 ≠ 1000000 + (.00001 + .00001) (actual values depend on the details of the computer addition), but is commutative, e.g., 1000000 + .00001 = .00001 + 1000000. Cartesian product is associative, e.g., {1, 2} × ({a, b} × {X, Y}) = ({1, 2} × {a, b}) × {X, Y}, but is not commutative, e.g., {1, 2} × {a, b} ≠ {a, b} × {1, 2}.*

Author: PEB

Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul Black.

Entry modified 14 August 2008.

HTML page formatted Wed Mar 13 12:42:45 2019.

Cite this as:

Paul E. Black, "commutative", in
*Dictionary of Algorithms and Data Structures* [online], Paul E. Black, ed. 14 August 2008. (accessed TODAY)
Available from: https://www.nist.gov/dads/HTML/commutative.html