-2
$\begingroup$

I have this equation:

y = a^N mod M

N and M are constant.

I want to reverse the equation and calculate a using y.

something like this: a = ???

how can I do this?

assume I have N, M and y. Now I want to calculate a.

thanks

  • 0
    Please use [$\rm \LaTeX$](http://meta.math.stackexchange.com/q/5020/290189).2017-02-28

2 Answers 2

1

The simpler question of the existence of $a$, given $y$, $N=2$, $M=p$ (a prime) has an answer by the law of quadratic reciprocity and calculations via the Legendre symbol. It can be extended to the case when $M$ is square free (product of distinct primes), using the Chinese remainder theorem, since $y$ is a square modulo $p_1p_2\dotsm p_r$ if and only if it is a square modulo each of $p_1, p_2,\dots, p_r$.

Once you have a solution modulo $p_i$, you can recursively obtain a solution modulo $p_i^k$ for any $k$ via Hensel's lifting.

0

Note that the existence and uniqueness of $a$ satisfying the equation above given $y$, $N$, and $M$ is not, in general, guaranteed - there may be infinitely many such $a$, or none.

For example, take $y=0$, $N=1$, $M=2$. Your question in this particular case becomes: "I know that $a$ is even (i.e. $a^1 \equiv 0 \mod 2$); how can I compute $a$?"