# Why is modulus not a basic arithmetic operation?

In school I learned that there are four basic arithmetic operations: addition, subtraction, multiplication, and division. I always wondered why modulus is not a basic arithmetic operation. Is there any explanation that is also understandable by a math noob?

-
Who knows? Because modulus is defined in terms of the other four? Because modulus is first needed only much later? –  GEdgar Sep 24 '12 at 18:07
It's a bit hard to define for all numbers - it is peculiar to the integers (or at least, the meaning of the modulus of two rational numbers is obscure.) –  Thomas Andrews Sep 24 '12 at 18:15
What is the question exactly? What is the operation you are thinking of? On what numbers? Do you want "mod" to act as a binary operation like "x mod y"? –  rschwieb Sep 24 '12 at 19:03
@ThomasAndrews: One can get a perfectly good modulus operation on the reals by defining $a\bmod b$ to mean the smallest nonnegative number $c$ such that $a-c$ is an integer multiple of $b$. (It won't preserve multiplication the way integer modulus does, but sometimes you don't care about that). –  Henning Makholm Sep 24 '12 at 19:08
@HenningMakholm You think when OP writes, "In school I learned that there are four basic arithmetic operations: addition, subtraction, multiplication, and division. " he is talking about school where the notion of "additive subgroup" is something he also learned? I think perhaps he is talking about the math you learn when you are 6-12 years old... –  Thomas Andrews Sep 24 '12 at 19:18

When I learned division in elementary school, I learned "remainder" at the same time. I think it is mostly terminological that this is not called an "operation", because the division algorithm produces both the whole number quotient and the remainder of division of two natural numbers, at the same time.

On the other hand, when we move to the rationals, "remainder of division" is no longer a very interesting operation, because the rationals are a field. Students are taught to stop using the division algorithm and start using a different algorithm to divide fractions. This is perhaps a reason that the remainder operation is de-emphasized. But students are certainly still able to compute remainders if they are asked to; they just don't describe it as an "arithmetical operation".

-

Here’s a suggestion that you may or may not like. The operation you’re talking about, which takes $m$ and $n$ and finds the smallest nonnegative number congruent to $m$ modulo $n$, does not make sense everywhere, in particular in every field, whereas $+$, $-$, $\times$, and $/$ do. Taking residue modulo $n$ does not make sense in any structure that has characteristic $p$, and more generally is extremely problematic in any structure without an order. How could you define your “$z\mod{(2+i)}$” in the ring of Gaussian integers, for instance?

Even in an ordered ring that isn’t a field, like ${\mathbb{Z}}_{(2)}$, which is the set of all rational numbers with only odd numbers in the denominator, what would your “$2/3\mod{2}$” be? Some of the commenters would seem to accept $2/3$ as the value, but any algebraist would say that it should be $0$, because $2/3$ is in the unique maximal ideal of the local ring ${\mathbb{Z}}_{(2)}$.

-

If you're thinking of treating $x\pmod{y}$ as a binary operation, then that operation is not commutative or even associative on the integers. It also looks like it can't have an identity (on the right or on the left).

If that's the operation you have in mind, then it's really badly behaved: it's just not in the same class with the usual operations.

Further note of explanation While writing this I completely forgot about the viewpoint of subtraction and division as operations in their own right. This is mainly because long ago I let them blur into addition and multiplication and promptly forgot about them. They are a little bit like this!

However there doesn't seem to be any analogue of "addition" or "multiplication" in the case of "mod as an operation", so I'm still inclined to say it's not of the same class.

-
Oh? Subtraction isn't commutative or (two-way) associative either. –  Rick Decker Sep 24 '12 at 19:46
I would call $0$ a right-identity, although as Thomas Andrews mentions above, it starts to get somewhat counterintuitive. –  Erick Wong Sep 24 '12 at 20:02
@RickDecker You got me to a certain extent :) Really subtraction and division are best subsumed by addition and multiplication, but I can't imagine what would bundle up "x mod y" like that. –  rschwieb Sep 24 '12 at 20:11
@ErickWong True. –  rschwieb Sep 24 '12 at 20:12
Wow, this is the smarmiest downvote I've ever gotten :) –  rschwieb Sep 24 '12 at 20:18

I'll tell you exactly why :)

Imagine the most fundamental type of modulus which is called the least common positive residue. An example is 23 mod 5 which is equal to 3. It's the smallest (least) positive number that satisfies the mod.

Then you can show that for a least common positive residue that x mod y is the same as x-y(floor(x/y)). For our example I'll plug the example in for you.

23 -5(floor(23/5))

23 -5(floor(4.6))

Note: floor is a special kind of rounding which means to aggressively round down at the decimal so 4.6 goes to 4. No matter the decimal place in floor you cut it. Ceiling is opposite it means to aggressively round up, so 4.1 will become 5 in ceiling, the only exception is 4.0 in ceiling will be 4. Now we continue.

23 -5(4) 23 - 20 = 3

So now you know that the reason mod isn't considered a basic operation is because it involves the use of subtraction, multiplication, division, and aggressive rounding.

It's possible that you can consider the modulus to be an algorithm instead of an operation.

-