I need examples of binary operations for real numbers that are
- associative and commutative
- associative but not commutative
The examples are for a programming class and need to be rather simple. Thus the operations have to work on real numbers and not on sets or matrices (which I would have to explain to the audience). The Fibonacci numbers would be a good counterexample.
The obvious choice for 1. would be multiplication and addition, but I would like to have another example to improve understanding.
Important is also that I need to be able to chain the operations. So the associative and commutative property should not only hold (or not hold) to a OPERATION b but also to a OPERATION b OPERATION c OPERATION d .... For example
$a\ MEAN\ b := \frac{a + b}{2}$
is associative and commutative for only $a$ and $b $, but not for $a\ MEAN\ b\ MEAN\ c\ MEAN\ d$.
Matrix multiplication is associative, but not commutative.
A different operation that is associative and commutative... addition and multiplication are really the canonical examples because if a binary operation "looks" like addition (or multiplication), we usually name it that. For example, the composition of two elements in a group, we call it multiplication in some situations since many times it behaves like the multiplication of two real numbers. If it does not, the word composition is used to describe the operation. So depending on what class of objects you are dealing with (i.e. real numbers, rigid motions of a regular polyhedron, infinitesimal rotations, etc.), there exists many examples of commutative associative binary operations that look and smell like multiplication, but are not exactly "multiplication of real numbers".
In short, it helps to know what exactly you are operating on - real numbers I'd assume. If that is the case, addition and multiplication are your best examples due to the real numbers being a mathematical structure called a "field".