Modular equation solving

86 Views Asked by At

I have a modular equation that is pretty strange to solve for me. Basically it is nothing special, but that modulo is really embarrassing for me.

Equation is this :

$\mod(A,x-B)=-1$ , $x \in \Bbb N$

How can I find the $x$ that make this equation true ? Of course there are more than one solution, and it would like to be great to find a general formula to get all of them... Thanks in advance

1

There are 1 best solutions below

0
On BEST ANSWER

$\mod(A,x-B) = -1$ means that there is an integer $k$ so that $A = -1 + k(x-B)$ or that $A+1= k(x-B)$

If we solve for $x$ we get.....

$A + 1 = kx - kB$

$kx = kB + A + 1$.

So $x = \frac {kB + A+1}k= B + \frac {A+1}k$ where $k$ will allow that to be an integer.

In other words if $k$ is any factor $A+1$

Then $x = B + \frac {A+1}k$ will be a solution.

In for example of $A = 15$ and $B = 16$ ....

$A + 1 = 16$. $16$ has many factors. we can have $k=1, 2, 4, 8, 16$ and we can have

$x = B+\frac {A+1}k = 16+\frac {16}k = 17, 18, 20,24, 32$

And indeed $\mod(15, x-16)=-1$ means $15\equiv -1\mod (1,2,4,8,16)$

Everything is equiv $0\pmod 1$ (because $1$ divides everything) so $15\equiv -1 \equiv 0 \pmod 1$.

$15\equiv -1 \pmod 2$ as both $15$ and $-1$ or odd.

$15\equiv -1\pmod 4$ because $15 = -1 + 4*4$.

$15\equiv -1\pmod 8$ becuase $15 =-1 + 8*2$

And $15\equiv -1\pmod 16$ because $15 = -1 + 16*1$.