Why is the max of x modulo m m-1?

61 Views Asked by At

For a sixth grade science project I asked how to scale the following formula:

$X_{n+1} = (a X_n + b)\, \textrm{mod}\, m$

And in the answer (Which did work) They said that x generates whole numbers between 1 and m-1. But my understanding was that the max that $x\, \textrm{mod}\, m$ could be with x and m being any finite number is $m\div2-1$ which is when x is $m\div2+1$ My question is how can x ever reach to m-1 if the maximum it can be is $m\div2-1$?

Edit: I now understand why the max is m-1 and how it can be represented but are there any numerical examples of where $a\, \textrm{mod}\, b = b-1$?

2

There are 2 best solutions below

2
On BEST ANSWER

There are always $n$ integers modulo $n$. When we choose representatives for these, there are a lot of options available. A common choice is $\{ 0,1,\dots,n-1 \}$, for instance. However, any $n$ consecutive integers work. For instance, another relatively common choice is $\{ 1,2,\dots,n \}$. In certain applications, it's desirable to extend in both directions away from zero. When $n$ is even this can be done with $\{ -n/2,-n/2+1,\dots,n/2-1 \}$ or $\{ -n/2+1,-n/2+2,\dots,n/2 \}$. The situation is even more convenient when $n$ is odd because then the result can be symmetric: $\{ -(n-1)/2,-(n-1)/2+1,\dots,(n-1)/2 \}$.

0
On

$x \ mod \ 6 \in \{0,1,2,3,4,5\}$ for all $x \in \mathbb Z$, which is to say that a modulus of 6 partitions the integers into these 6 equivalence classes.

Is it true that $x \ mod \ 6$ has a maximum when $x \ = \frac{m}{2} + 1$, or $x = 4?$ Clearly not. $x \ mod \ 6 \in \{0,1,2,3,4,5\}$, and in fact, if we choose $x = 5$, then $x \ mod \ 6 = 5 \ mod \ 6 = 5$.

And of course, if $x = 6$, then $x \ mod \ 6 = 6 \ mod \ 6 = 0$. The same applies to any multiple of 6, or $x \in \mathbb Z : x = 6k$, for some $k \in \mathbb Z$, as they all belong the equivalence class of $0$, often denoted $[0]$.

Similarly, $x \in \mathbb Z : x = 5 + 6k$, for some $k \in \mathbb Z$, are congruent to 5, and so all such $x$ belong to the equivalence class $[5]$.

I hope this explains why the maximum of $x \ mod \ m \ $ is $ \ m-1$.