-1

I am working with polynomials defined over the ring $\mathbb{Z}/n\mathbb{Z}$ of the form $$a_ix_i = A_i\pmod{n},$$ where $\gcd(a_i,n) \ne 1,$ for all $i \in \{0, \dots, k\}$, $n$ is a composite number. My goal is to find values $x_i$ for all $i \in \{0, \dots, k\}$. The values $x_i$ are distinct and the solutions are pre-guaranteed. That is, I know that there is a solution to each equation. Since the coefficients $a_i$ are not co-prime with the integer $n$, their inverses do not exist mod $n$. Thus, I can not express $x_i$ as $$x_i = (a_i)^{-1}A_i \pmod{n}.$$ Is it true that this problem is NP-complete?

It is my understanding that this problem is NP-complete since it is not possible to directly solve for the values $x_i$ but I can try every single element $x_i \in \mathbb{Z}/n\mathbb{Z}$ until a correct one, that satisfies the corresponding equation, is found. So in the worst case scenario I must try all possible $x_i$ with complexity $\mathcal{O}(n)$. However, to verify a correct solution is takes me polynomial time, because the verification will involve ring operations which are very fast. I am also looking for a formal name of this problem. If I were to look for it in the literature or mention it in a thesis what would this problem be called?

Bill Dubuque
  • 272,048
  • Question of clarification, you have $k$ modular equations that you'd like to solve, are the $x_i$ unique to each equation or do you want to find one $x$ that solves all the equations – wjmccann Dec 05 '22 at 15:58
  • 2
    NP complete? For each such congruence, it is easy enough to solve or to determine that no solution exists. Not sure how your family of congruences is meant to be connected...are these just $k$ separate problems? – lulu Dec 05 '22 at 16:01
  • 1
    Are you pre-guaranteed that thee is a solution or is that part of what you are trying to answer. Clearly there is no solution to $2x\equiv 1 \pmod 4.$ – Henry Dec 05 '22 at 16:02
  • 2
    \pmod{p} will produce the appropriate space, parentheses, and roman typeface. – Arturo Magidin Dec 05 '22 at 16:07
  • Thank you for your comments, I have edited the question. Each $x_i$ is distinct for each equation, and I know the solution exists for every equation. – Efe çiğdem Dec 05 '22 at 18:23
  • @lulu could you please clarify what solution tactic you have in mind when saying its easy enough. I have not found a better way than a brute force search through the entire space of integers mod n. Since n and a_i are not co-prime I can not calculate an inverse of a_i. My idea was to break the ring $\mathbb{Z}/n\mathbb{Z}$ into direct product and solve these equations in every subset and then lift the solutions back to the original ring $\mathbb{Z}/n\mathbb{Z}$. – Efe çiğdem Dec 05 '22 at 18:26
  • 2
    If $\gcd(a,n)=d$ then we need $A\equiv 0 \pmod d$ or there is no solution (evidently). If that condition is met, then you can divide $a, A$ and $n$ by $d$ and reduce to the relatively prime case. – lulu Dec 05 '22 at 18:29
  • 1
    @lulu thank you! Does this extend to polynomials in general form? That is, with many coefficients and all of them are not co-prime to $n$. – Efe çiğdem Dec 05 '22 at 18:34
  • 2
    Finding roots of polynomials of higher degree is generally non-trivial, even $\pmod n$. – lulu Dec 05 '22 at 18:46

1 Answers1

1

If you are looking to solve $ax=b \pmod n$, that is equivalent to finding $x, y$ such that $ax+ ny=b$. However, the extended Euclidean algorithm lets you easily find $x,y$ such that $ax+ny=\gcd(a,n)$, and if the original equation is solvable, then $b$ must be a multiple of $\gcd(a,n)$. Therefore, solve $ax+ny=\gcd(a,n)$, then multiply the equation by $b/\gcd(a,n)$.

Aaron
  • 24,207