# Is integer division uniquely defined in mathematics?

I am currently studying java programming and am a bit shaken up by the concept of integer division. I guess it is just a matter of getting used to that $1/2=0$, but I am afraid it might take some time, given that this property of the division operator (/) is inconsistent with mathematics.

Or is it? Reading the section in Wikipedia on division of integers seems to imply that it is an ambiguous concept (see the following link). The statement that the set of integers is not closed under division (i.e. integer division might produce elements that are not integers) makes sense to me, as does option 2 in the following list. The list puzzles me, however. Its existence implies that we have a choice in the matter, and that one of them (option 4) permits you to call "$1/2=0$" a true statement.

So, is the meaning of integer division really just a matter of taste? Can "$1/2=0$" be a true statement, even in a strict mathematical sense, depending on how you interpret it?

-
You might want to have a look at this. – Alexander Thumm Mar 30 '12 at 12:44
It's definitely a different version of division than you are used to. Think of it as the first division you learned in grade school, where, when you do the division, you get a result and a "remainder." There is actually a "remainder" operator in most programming lnguages, too, usually the "%" character. – Thomas Andrews Mar 30 '12 at 12:45
One reason to do integer division like this in programming languages is that integer operations are much faster than floating point operations. Basically, the programming language is requiring you to explicitly convert your integer types to float if you want to do floating point arithmetic. – Thomas Andrews Mar 30 '12 at 13:21
The symbol means different things in different environments. Within math, if you are working in the integers, 1/2 is undefined. If you work in the rationals, it is 0.5. In computer languages originally integer variables were king, but you would like to define 1/2 so it was. Python went from integer divide to true divide as it went from version 2 to 3. In all cases it is well defined: given an input there is only one output. – Ross Millikan Mar 30 '12 at 13:23
@RossMillikan, I'd say if you are working in the rationals, it is $\frac 1 2$ :) Using decimal notion would be confusing if we later look at $1/3$. – Thomas Andrews Mar 30 '12 at 13:24

It all depends on what you want your "division" operation to do. In other words, what properties should it satisfy. In real numbers (or rationals, or complex, etc.), the most essential property relates $/$ to $\times$:

Division is Inverse to Multiplication: $a/b = c$ if and only if $b \times c = a$.

However, even in familiar number systems, the operation is not closed. $a/0$ is undefined (since there is no real (or rational, or complex) $c$ such that $0 \times c = a$. The situation is even more restricted in integers, where $a/b$ can only be defined when $b$ divides $a$.

The "integer division" operation (which exists in many computer applications using the same symbol "$/$"), fixes the closure property (that is, $a/b$ is defined for all integers except when $b=0$), but fails the Inverse property in general. IMHO, there ought to be separate notation, such as the "Quotient" function of Mathematica:

Quotient[a,b] = integer quotient of $a$ and $b$, roughly, how many whole times $b$ goes into $a$.

When you mention consistency, it is always with respect to the properties of the operation. Quotient does not have the same properties as $/$, and is a well-defined function of integers (except when the divisor is $0$).

Hope this Helps!

-
I totally agree that the notation should be separate, to avoid confusion. A question regarding your first paragraph though: You say "your" division operator. Is it really up to me? Or anyone? Shouldn't there a consensus in the field of mathematics about what "/" actually means for the set of integers? – andreasdr Mar 30 '12 at 12:59
There doesn't have to be. As Shaun says, it depends what you want the operator to do. As long as you say what you mean and are consistent with your notation it's fine. All you're doing really is defining a function $\mathbb{Z}^2\to\mathbb{Z}$, and it's only called "division" for cultural reasons. For me as an algebraist I would say that there is no division in $\mathbb{Z}$ because I'd require it to be inverse to multiplication, but if somebody tells me they're using division with remainder because they don't require this property, I won't have an argument with them! – Matthew Pressland Mar 30 '12 at 13:04
You may be pleased to know Python has separate notation: 3 / 2 == 1.5, but 3 // 2 == 1 – Hurkyl Mar 30 '12 at 16:26
@Hurkyl: I did not know that (and probably should have because I use sage constantly). Thanks! – Shaun Ault Mar 31 '12 at 12:18

Remember the actual meaning of division: We say that $a/b=c$ if and only if $a = b \cdot c$. But since there is no integer $z$ such that $2z = 1$, this means that a simple definition of division over integers is, by neccesity, incomplete: $1/2$ does simply not exist in this sense.

On the other hand, there is a fairly simple solution, that is in fact also provided by common programming languages: You may define division as division with remainder, i.e.: We say that $a/b$ is $q$ with remainder $r$ if and only if $a = bq + r$. By specifiying that, e.g., $0 \le r < b$, this definition yields unique results for all $a$ and $b \neq 0$, and the value of $q$ is, for natural $a$ and $b$, exactly $\mathtt{a/b}$ for most programming languages. In C-derived languages (e.g., Java), the remainder $r$ is given by $\mathtt{a\%b}$.

-
So you are talking about option 1 in the cited Wikipedia article: that 1/2 simply isn't defined for the set of integers. Is this interpretation universally accepted in the field of mathematics, or is there an actual debate? We are talking about mathematics after all, can there really be multiple interpretations of what "/" means when operating on integers? – andreasdr Mar 30 '12 at 12:56
The operation "/" is well defined using division with remainder, and this is the definition that is commonly used for natural numbers and integers. Of course, you have things like "1/2=0", but this is only half of the truth here, since there is also the remainder to consider. – Johannes Kloos Mar 30 '12 at 12:59
I just meant to say that there is no way to define division of integers without remainder and without contradictions. – Johannes Kloos Mar 30 '12 at 13:00

As others have mentioned, mathematical notation is heavily overloaded where one symbol can be used for several, potentially incompatible, notions. The correct notion is (usually) given or can be inferred from context, at least to the level of detail needed. Programming languages exacerbate this problem.

Ultimately, you can have any symbol mean anything as long as you provide a definition. That said, integer division isn't an ad-hoc contrivance, though it is arguably incorrectly implemented in most programming languages. Taking Shaun's "essential property" of division, we can weaken it to another property that completely characterizes integer division. Let $b$ be a positive integer, and $a$ and $c$ any integers. Then the following property (a Galois connection or adjunction) characterizes integer division: $$\textrm{forall }a \textrm{ and } c\quad a\times{}b \leq c\quad \textrm{if and only if}\quad a \leq c/b$$ Note that this is equivalent also to $$\textrm{forall }a \textrm{ and } c\quad a\times{}b \gt c\quad \textrm{if and only if}\quad a \gt c/b$$ So what should $5/3$ be? If we say $0$, then we'd have forall $a$, $a \gt 5/3 = 0$ implies $a\times{}3 \gt 5$ which is not true for $a=1$. If we say $2$, then we'd have forall $a$, $a \leq 5/3 = 2$ implies $a\times{}3 \leq 5$ which is not true for $a=2$. $a=1$ does satisfy the property. More interesting, work out what $(-5)/3$ should be and compare it to your favorite programming language.

-