0

I have a system of two modular congruences:

$x \equiv k \bmod{m}$

and

$x \equiv 0 \bmod{23}$

Where $k$ and $m$ are known quantities and I want to find $x$. I'm at a loss as to whether or not there's a closed form for this, and even if I find this value of $x$, how do I know what the next workable value of $x$ is? Would it be $x$, $x + 23m$, $x + 46m$, $x + 69m$, etc? Or is it multiples of $\text{lcm}(23, m)$?

  • I think you want the Chinese remainder theorem: https://en.wikipedia.org/wiki/Chinese_remainder_theorem – Ethan Bolker Dec 10 '18 at 01:09
  • @EthanBolker Problem is that requires coprime values, it's possible $k$ and $23$ are not coprime, $k$ can be any positive integer. – user624732 Dec 10 '18 at 01:09
  • Chinese remainder theorem requires $\gcd(m,23)$ divides $k$ in your system. There isn't a general restriction saying $k,m$ need to be coprime. – coffeemath Dec 10 '18 at 01:22
  • @coffeemath I think I meant $m$, $23$ is prime so $\gcd(m, 23) = 1$ unless $m$ is a multiple of $23$. The Chinese Remainder Theorem for these two congruences involves the inverse of $23$ mod $m$ does it not? – user624732 Dec 10 '18 at 01:34
  • If $m$ is a multiple of $23,$ then for a solution one requires $k$ also a multiple of $23.$ In that case the first congruence becomes stronger than (i.e. implies) the second. If gcd of $m,23$ is $1,$ it's the usual Chinese remainder theorem, solution unique mod $23m.$ Yes, I think one way to finish uses inverse of $23$ mod $m.$ But if $m$ isn't too large,, can get the solution directly using a program rather than finding that inverse. – coffeemath Dec 10 '18 at 02:24
  • @coffeemath If $m$ is a multiple of $23$ and $k$ is a multiple of $23$ then $x = k$, right? If $m$ is a multiple of $23$ but $k$ isn't, then $x$ has no solution? If $m$ is not a multiple of $23$ then it's regular Chinese remainder theorem, $(k \cdot 23 \cdot \text{inverse}(23, m)) \bmod{23m}$? – user624732 Dec 10 '18 at 02:26
  • I think the first statement of your comment doesn't necessarily hold. I agree with second statement. Try some examples with small values of everything. – coffeemath Dec 10 '18 at 02:28
  • @coffeemath What do you think I've been doing these past three hours, lol. There is like zero information online for what you're supposed to do with non-coprime cases. Also I'm pretty sure my last statement is right at least? – user624732 Dec 10 '18 at 02:29
  • Oops (edited statement, now I agree last statement right.) – coffeemath Dec 10 '18 at 02:31

1 Answers1

1

By the Chinese Remainder Theorem we can show that

$\ \ x\, \equiv\, 23(k\cdot 23^{-1}\bmod m)\,\ \pmod{\!23m}\ \ \ {\rm if}\ \ \ 23\nmid m$

$\ \ x\, \equiv\, 23(k/23\bmod m/23)\ \ \ \ \,\pmod{\!m}\ \ \ {\rm if}\ \ \ 23\mid m,k$

$\ \ x\,$ fails to exist $ $ (i.e. no solution exists) $\ \ \ \ \ \ \ {\rm if}\ \ \ 23\mid m,\ 23\nmid k$

Remark $ $ We can unify all cases by using general modular fractions, yielding

$\ \ x\, \equiv\, 23\left(\dfrac{k}{23}\bmod m\right)$

Bill Dubuque
  • 272,048