I am trying to find the possible values of the expression
$$a \bmod 2x-a \bmod x.$$
I suspect they might be $0$ or $x$, but I'm really not sure. I can't seem to be able to write down a proper argument.
I am trying to find the possible values of the expression
$$a \bmod 2x-a \bmod x.$$
I suspect they might be $0$ or $x$, but I'm really not sure. I can't seem to be able to write down a proper argument.
First of all, you're using "mod" as a function, which is not the way mathematicians view it. To a mathematician, $a \mod 2x$ is an equivalence class (every integer whose difference from $a$ is divisible by $2x$), not a specific integer. However, I guess you're talking about $u - v$ where $u \equiv a \mod 2x$ with $0 \le u < 2x$ and $v \equiv a \mod x$ with $0 \le v < x$. Then either $u = v$ or $u = v + x$.
I guess by $a \bmod 2x$ you mean the remainder $r$ of Euclidean division of $a$ by $2 x > 0$. Let's write $s = a \bmod x$ for the other remainder.
By definition you have $$ a = (2 x) q + r, $$ for some $q$, where $0 \le r < 2 x$. Rewrite as $$ a = x(2 q) + r, $$ so if $r < x$, then $r = s$ and $r - s = 0$. If $x \le r < 2 x$, then $0 \le r - x < x$, and $$ a = x(2 q + 1) + r - x, $$ so that $s = r - x$, and $r - s = x$.
Hint $\rm\ \ \ \ n\equiv a\,\ (mod\ x)\:\Rightarrow\: n\equiv a,\, a\!+\!x\,\ (mod\ 2x)$
Indeed $\rm\: n\equiv a\,\ (mod\ x)\:\Rightarrow\: n = a + k\,x.\:$ Either $\rm\,\color{#C00}{k = 2n}\,$ is even, or $\rm\:\color{#0A0}{k = 2n\!+1}\,$ is odd, and
$$\ \ \ \begin{eqnarray}\rm a &+&\rm (\color{#C00}{2n\!+0})\,x\ &\equiv&\rm a\qquad\ (mod\ 2x)\\ \rm a &+&\rm (\color{#0A0}{2n\!+1})\,x&\equiv&\rm a+x\ \ (mod\ 2x)&\end{eqnarray}$$