2

I know how $\div$ and $\mathrm{mod}$ works but I have come across the following example and I do not understand it:

$-117 \pmod {352} = 235$

Shouldn't that be equal to $-117$?

kelua
  • 23
  • But $-117 = 235 + \color{red}{(-1)}\cdot 352$, so $-117$ is, by definition, congruent to $235$ modulo $352$ (since there exists an integer that fits in the red spot). – Arthur Jun 04 '16 at 10:41
  • You are thinking of "mod" as a binary operation, as is typical in a programming or computer science context. The mathematical perspective involves congruence classes, so that the "answers" $-117$ and $235$ correspond to the same congruence class modulo $352$. The programming versions will often provide options to accommodate various desires for "signed" inputs and outputs, so even then there is no single "correct" answer as you might have expected. – hardmath Jun 04 '16 at 10:56

2 Answers2

1

Note that $-117 = (-1)352 + 235 \in 235 + 352\mathbb{Z}$, which shows that $-117\equiv235 \mod 352$.

lattice
  • 805
1

From $0 \equiv 352 \pmod{352}$ it follows that $$ -117 = 0 - 117 \equiv 352 - 117 = 235 \pmod{352}. $$