0
$\begingroup$

I have never dealt with congruences, and I want to stay as pragmatic as possible here. Using a similar approach to trigonometric equations, where the solution is rather a set of answers that fulfil the equation, and without being sloppy nor abusive, how do I solve the following? $$a = x \mod b,\quad a,b\in \mathbb{N}^+$$

I arrived at the following:

$$x = \left\lfloor \frac{x}{b}\right\rfloor b + a$$

and then under certain assumptions assume that the ceiling part is an integer and arrive at something like: $$x = n b + a, \quad \forall n\in\mathbb{N}$$.

But I'm not sure this is right, and I want to understand how to approach it methodically to know what x's actually fulfill the function, or in more general terms, why there are any solutions at all.

Thank you.

$\endgroup$
2
  • 2
    $\begingroup$ I don't understand. Given $a,b$, the solution to $a\equiv x\pmod b$ is the set of integers $x\in \{a+nb\,|\,n\in \mathbb Z\}$. By definition. $\endgroup$
    – lulu
    Commented Jun 29 at 10:28
  • 1
    $\begingroup$ By definition $a\equiv x \bmod b$ means that $b$ divides $x-a$. So we can write $x=nb+a$ with $n\in \Bbb Z$. Formally this might be "without congruences", but it is not, actually. It is still the same. $\endgroup$ Commented Jun 29 at 10:29

1 Answer 1

1
$\begingroup$

If you are looking for a solution of an equality $a = x\mod{b}$, instead of what we usually care about, i.e. the congruence, you have to be clear about what $x \mod{b}$ means. I also wonder what kind of solution you are looking for? Are you looking for integers or natural numbers? I think what you are intending is that $x \mod{b}$ is the unique integer $n$ satisfying $0\le n < b$ and $b | x-n$, in other words the remainder of $x$ after division by $b$.

From this it's clear that your equation does not always have a solution. If $a\ge b$ it is impossible to solve the equation.

However if the given numbers satisfy $a<b$, you can find infinitely many solutions.

Then what you write for $x = nb+a$ is close to correct, the only thing is you have to allow for $n$ to be zero, which I don't think is included in your concept of natural numbers.

To write it out clearly:

$ \begin{eqnarray} &a = x \mod {b}\\ &\Leftrightarrow 0 \leq a < b \text{ and } b|x-a \end{eqnarray} $

At this point we distinguish two cases one where $a \ge b$ and we don't have solutions, and one where $a<b$ and we do have solutions. In this case the divisibility condition is equivalent to stating $ \exists n\in\mathbb{Z}: bn = x-a. $ So all the solutions are of the form $bn + a$ for $n\in \mathbb{Z}$. If you are interested in integer solutions for $x$, then you are done at this point. If instead you are looking for natural numbers you need to solve $bn+a> 0$.

I would suggest that instead of taking this approach you become more comfortable with congruences. What I've done above is far less useful than solving the congruence $a \equiv x\mod{b}.$ Congruences are not at all sloppy, or "abusive", they are very rigorously defined. It's a good first example of a finite group and a finite ring, both are fundamental concepts in mathematics.

$\endgroup$
2
  • $\begingroup$ Yes, that's precisely what I meant. I will get comfortable with congruences, but I wanted to solve this easy equation just with the definition of "mod as a reminder". Could you please explain what is meant with $b|x-a$? $\endgroup$
    – Michel H
    Commented Jun 29 at 12:40
  • $\begingroup$ This means "$b$ divides $x-a$". $\endgroup$
    – jMdA
    Commented Jun 29 at 13:34

Not the answer you're looking for? Browse other questions tagged .