2
$\begingroup$

Could someone please provide the math proof;

$$ ((g^a)\bmod p)^b \bmod p = ((g^b)\bmod p)^a \bmod p $$

$\endgroup$
0

1 Answer 1

3
$\begingroup$

Let $g^a = x \bmod p$ and $k \in \mathbb{Z}$ the we can write $g^a$ with the help of the remainder theorem; $$g^a = x + k \cdot p$$ Now take $b$-th power of both sides under modulus $p$.

\begin{align} (g^a)^b &= (x + k \cdot p)^b &\pmod p\\ g^{ab} &= \binom{b}{0} x^b + \binom{b}{1}x^{b-1}(k \cdot p) + \cdots + \binom{b}{b}x^0(k \cdot p)^b &\pmod p\\ g^{ab} &= x^b &\pmod p \end{align}

Similarly;

Let $g^b = y \bmod p$ then $g^b = y + \ell \cdot p$ now take $a$-th power and as above

\begin{align} (g^b)^a &= (y + \ell \cdot p)^a &\pmod p\\ g^{ab} &= \binom{a}{0} y^a + \binom{a}{1}y^{a-1}(\ell \cdot p) + \cdots + \binom{a}{a}y^0(\ell \cdot p)^a &\pmod p\\ g^{ab} &= y^a &\pmod p \end{align}

Now we have $$x^b = g^{ab} = y^a \pmod p$$ Therefore both side has the same values.

$\endgroup$
2
  • $\begingroup$ The binomial coefficient is missing. $\endgroup$
    – DINEDINE
    Mar 5, 2022 at 12:30
  • $\begingroup$ @DINEDINE Thanks again, I've corrected it. $\endgroup$
    – kelalaka
    Mar 5, 2022 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.