Could someone please explain the mathematical difference between an operator (not in the programming sense) and a function? Is an operator a function?

**Answer**

Based on your comment it sounds like you’re actually asking about **operations**, not operators. A **binary operation** on a set $S$ is a special kind of function; namely, it is a function $S \times S \to S$. That is, it takes as input two elements of $S$ and returns another element of $S$. We can denote such an operation by a symbol such as $a \star b$ and then demand various additional properties of this operation, such as

**associativity**: $(a \star b) \star c = a \star (b \star c)$,**commutativity**: $a \star b = b \star a$

and so forth. On the other hand, an arbitrary function $f : A \to B$ between two sets only takes a single input and returns an output which is not necessarily of the same type, so one can’t speak of associativity or commutativity for such a thing. One might call a function $f : A \to A$ a **unary operation** but one still can’t speak of associativity or commutativity for such a thing.

**Attribution***Source : Link , Question Author : Nik , Answer Author : Qiaochu Yuan*