Intereting Posts

Integral of $\int_0^{\pi/2} \ (\sin x)^7\ (\cos x)^5 \mathrm{d} x$
Congruence Equation $3n^3+12n^2+13n+2\equiv0,\pmod{2\times3\times5}$
Finding Eccentricity from the rotating ellipse formula
Distances between closed sets on metric spaces
Is the complement of countably many disjoint closed disks path connected?
$\mathbb C/(X^2)$ is isomorphic to $\mathbb R/((Y^2+1)^2)$
Evaluate $\int \cos(3x) \sin(2x) \, dx$.
What is the motivation defining Matrix Similarity?
Nested Square Roots
How to prove $D^n/S^{n-1}\cong S^n$?
Is $L^p \cap L^q$ dense in $L^r$?
Finitely generated ideals in a Boolean ring are principal, why?
Is it true that $ U \oplus W_1 = U \oplus W_2 \implies W_1 = W_2 $?
$\mathbb{Q}(\sqrt{2+\sqrt{2}})$ is Galois over $\mathbb{Q}$, but $\mathbb{Q}(\sqrt{1+\sqrt{2}})$ is not
Showing that $\log(\log(N+1)) \leq 1+\sum\limits_{p \leq N} \frac{1}{p}$

My cousin in grade 10, was told by his teacher that remainders are never negative. In a specific example,

$$-48\mod{5} = 2$$

I kinda agree.

- Proving $n^{17} \equiv n \;(\text{mod}\; 510)$
- Last digits, numbers
- Prove that ${2^n-1\choose k}$ and ${2^n-k\choose k}$ ar always odd.
- Modular congruence, splitting a modulo
- $n\mid \phi(a^{n}-1)$ for any $a>n$?
- Solve a congruence $1978^{20}\equiv x\pmod{125}$

But my grandpa insists that

$$-48 \mod{5} = -3$$

Which is true? Why?

- How to use the Extended Euclidean Algorithm manually?
- Primality Test for $N=2\cdot 3^n-1$
- How can I prove that $n^7 - n$ is divisible by $42$ for any integer $n$?
- Finding inverse of polynomial in a field
- Congruent Modulo $n$: definition
- Get the last two digits of $16^{100}$ and $17^{100}$
- Elementary proof that $3$ is a primitive root of a Fermat prime?
- If $p$ and $q$ are distinct primes and $a$ be any integer then $a^{pq} -a^q -a^p +a$ is divisible by $pq$.
- Show that every power of $2$ is sum of two squares.
- Probability that two random numbers are coprime

The first one is saying that $-48$ is $2$ *more* than a multiple of $5$. This is true. The second one is saying that $-48$ is $3$ *less* than a multiple of $5$. This is also true.

The teacher is within his/her authority to define remainders to be numbers $r$, $0\leq r < d$ where $d$ is the divisor. This is just a systematic choice so that all students can apply the same rule and arrive at the same anwer, but the rule is only a convention, not a “truth.” The teacher isn’t wrong to define remainders that way, but it would be wrong for the teacher to insist that there is no other way to define a remainder. And, anyhow, what your grandpa says is also perfectly true ðŸ™‚

I imagine that ordinary long division is taught with this remainder rule because it makes converting fractions to decimals smoother when students do it later. Another reason is probably that mixed fraction notation (as far as I know) makes no allowance for negatives in the fraction. What I mean is that $1+\frac23=2-\frac13$, but the mixed fraction $1\frac23$ is not usually written as $2\frac{-1}{3}$, although one could make an argument that it makes just as much sense.

As far as modular arithmetic is concerned, you *really want* to have the flexibility to switch between these numbers, and insisting on doing computations with the positive version all the time would be hamstringing yourself.

Consider the problem of computing $1445^{99}\pmod{1446}$. It should not be necessary to compute powers and remainders of powers of $1445$ when you can just note that $1445=-1\pmod{1446}$, and then $1445^{99}=(-1)^{99}=-1=1445\pmod{1446}$

The answer depends on whether you want to talk about modular arithmetic or remainders. These two perspectives are closely related, but different. In modular arithmetic, $2\equiv -3 \pmod 5$, so both answers are correct. This is the perspective most answers here have taken. In the division algorithm, though, where remainders are defined, in order to guarantee uniqueness, you need a specific range for the remainder — when dividing integer $a$ by integer $d$, you get $a=qd+r$, and the integers $q$ and $r$ are unique *if* $0\leq r<d$ (note that this also places a restriction that $d$ be positive). There are other ways you could set up the condition, but you need some similar range in order to guarantee uniqueness, and this range is the simplest and most common, so in this sense, a negative remainder doesn’t work.

When -48 is divided by 5 the division algorithm tells us that there is a “unique” reminder r satisfying $0\leq r<5$. In that case there is only one possibility, namely $r=2$.

Here is a different perspective which is more technical but is also reflected e.g. in Hardy and Wright.

On the whole it is best to regard the expression $”-48 \mod 5″$ on its own as representing the set of numbers $a:a\equiv -48 \mod 5$, so it isn’t equal to a number at all, but to a set.

[Technically it is a coset in $\mathbb Z$ of the ideal generated by $5$, and consists of the numbers $-48 + 5 b$, where $b$ is an arbitrary integer].

Quite often it is useful to work with numbers rather than sets, and we choose a representative element of the set to work with. There are different ways in which this can be done (least positive, smallest absolute value etc). In this case $2$ and $-3$ are members of the set and could be used to represent it.

Maybe the teacher was thinking about Euclidean division, which states:

Given two integers a and b, with b â‰ 0, there exist unique integers q and r such that a = bq + r and 0 â‰¤ r < |b|, where |b| denotes the absolute value of b

We indeed have the remainder (“r”) being positive in this case, but if we talk strictly about congruences the grandpa’s expression as well as the teacher’s are both true.

For integers $a,b,c$ the following statements are equivalent:

1) $a\equiv b\text{ mod }c$

2) $a+c\mathbb{Z}=b+c\mathbb{Z}$

3) $c\mid a-b$

Note that $5\mid-48-2=-50$ *and* $5\mid-48-\left(-3\right)=-45$.

By convention, for a division $\frac{a}{b}=c$, if we are looking for a whole integer for $c$ (with no further stipulations) , the rounding method is towards zero. If $a<0$ and $b>0$, this means that in the equation $\frac{a}{b}=c+\frac{r}{b}$, $r$ must be $\leq 0$.

Also remainders and modulus are two different things.

This question touches parts of my old message Algebraic abstractions related to (big) integers in C++ on the boost developers mailing list.

Why should “modulo” be identical to “remainder”? Having a “remainder” function such that “r=remainder(a,m)” satisfies “0 <= r < m” is something convenient to have in a programming language. The quoted message presents some evidence that a “sremainder” function such that “s=sremainder(a,m)” satisfies “-m/2 <= s < m/2” would also be a good idea.

The meaning of modulo and modular arithmetic is not directly addressed by these considerations.

For variety, I want to point out that when doing *division with remainder* (as opposed to, e.g., *modular arithmetic*), there is sometimes utility in having “improper” results; e.g. saying $17 / 5$ is $2$ with remainder $7$.

An example where this would be useful is if you just need a value that is *close* to the correct quotient, and you can compute something close (and the appropriate remainder) relatively more easily.

- Probability describing how many adjacent hexagons overlap a circle of a given radius
- Proving that the given two integrals are equal
- Function $ f $ defined on unit disk $ D $ has real values on $ \partial D $, why is $ f $ real valued?
- Do discontinuous harmonic functions exist?
- $45^\circ$ Rubik's Cube: proving $\arccos ( \frac{\sqrt{2}}{2} – \frac{1}{4} )$ is an irrational angle?
- Help on the relationship of a basis and a dual basis
- Fitting a closed curve on the roots of ${x \choose k}-c$
- $Aut_\mathbb{Q}(\overline{\mathbb{Q}})$ is uncountable
- Expected number of triangles in a random graph of size $n$
- converge and converge absolutely of a series
- How to find unique multisets of n naturals of a given domain and their numbers?
- Proving inequality $\sqrt{\frac{2a}{b+c}}+\sqrt{\frac{2b}{c+a}}+\sqrt{\frac{2c}{a+b}} \leq \sqrt{3 \left(\frac{a}{b}+\frac{b}{c}+\frac{c}{a}\right)}$
- Why does $\sqrt{x^2}=|x|$?
- Fibonacci identity: $f_{n-1}f_{n+1} – f_{n}^2 = (-1)^n$
- Why does partial differentiation give centre of a conic?