0

It's easy to figure out the answer which is 2. But I am trying to solve it in a different approach. My approach:

$2^x \equiv 2^4 + 2^4 \pmod 7 \Rightarrow x\log_2(2) \equiv 4\log_2(2) + 4\log_2(2) \pmod 7 \Rightarrow x \equiv 4 + 4 \mod 7 \Rightarrow x \equiv 8 \pmod 7 \Rightarrow x \equiv 1 \pmod 7 $

Here, the answer is 1(false) but it supposed to be 2. It works if I do the modular operation by 6.

PS: I read somewhere that it is related to Fermat's little theorem, but can't figure it out. Can someone give a detail explanation on this?

J. W. Tanner
  • 60,406
  • 1
    Logarithms in modular arithmetic don't work quite like that. You need to take more care. Also, the logarithm of a sum is not the sum of logarithms, in general. – Arthur Jun 14 '19 at 20:58

3 Answers3

2

Fermat's little theorem says $2^6\equiv1\pmod7$. In fact, $2^3=8\equiv1\pmod7$.

$2^4+2^4=2\times2^4=2^5 $, so, because $2^3\equiv1\pmod7$, $2^{3n+5}\equiv2^4+2^4\pmod 7$ for all $n\in \mathbb Z$

$(n>-2$ to avoid negative exponents).

So if $2^x\equiv2^4+2^4\pmod7$, then $x$ could be $3m+2$

(integer $m>-1$ to avoid negative exponents).

On the other hand, $2^{3m}\equiv2^0\equiv1$ and $2^{3m+1}\equiv2^1\equiv2,$

so these are not congruent to $4=2^2\equiv2^5=2^4+2^4\pmod7$.

J. W. Tanner
  • 60,406
  • 1
    Note: $2^1$ and $2^2\not\equiv1\pmod7$; Fermat's little theorem says $2^6\equiv1\pmod7$ – J. W. Tanner Jun 14 '19 at 20:58
  • Actually, $2^5 \equiv 2^2 = 4 \pmod 7$, so you should be saying something like $2^{5 + 3n} \equiv 2^5 \pmod 7$ or $2^{5 + 3n} \equiv 4 \pmod 7$. It's not true that $2^{5 + 3n} \equiv 1 \pmod 7$. – John Omielan Jun 14 '19 at 21:05
  • @JohnOmielan: I had realized I made some errors. How's the post now? (I still might edit the comment) – J. W. Tanner Jun 14 '19 at 21:08
  • I believe it's now correct. Although it's true that $n$ can be any integer, if $n \lt 0$ for $3n + 2$, then you get into "fractions", which if you consider inverses, it's still correct, but you may wish to put some sort of lower limits for $n$ (e.g., $-1$ for $3n + 5$ and $0$ for $3n+2$) to keep things somewhat simpler & more straightforward. – John Omielan Jun 14 '19 at 21:09
  • Note: $2^{3n}\equiv2^0\equiv1$ and $2^{3n+1}\equiv2^1\equiv2$, so these are not congruent to $4=2^2\equiv2^5\equiv2^4+2^4\pmod 7$; Fermat's little theorem says $2^6\equiv1\pmod7$ – J. W. Tanner Jun 14 '19 at 21:10
  • You may wish to consider adding something like your Note comment above to the body of your answer. – John Omielan Jun 14 '19 at 21:18
  • @JohnOmielan: I took your suggestions. I thought it was clever to use $2^4+2^4=2^5$, but in retrospect it's not hard to calculate that $2^4+2^4=16+16\equiv2+2=4\pmod 7$ – J. W. Tanner Jun 14 '19 at 21:31
  • 2
    What you have now looks very good. It's a great explanation not only for the OP, but also for anybody else who later reads your answer. – John Omielan Jun 14 '19 at 21:35
  • $5\equiv2\bmod 3\implies 3n+2$ for any positive n works and doesn't miss one. –  Jun 17 '19 at 15:10
1

$\!\bmod 7\!:\,\ 2\,$ has order $\,\color{#c00}3,\,$ so the correct modulus for $\,\ell := \log_2$ is $\,\color{#c00}3\ $ (not $7),\,$ i.e.

$\bmod 7\!:\,\ \overbrace{2^{\Large x}\equiv 2^{\large y}}^{\Large a\,\ \equiv\,\ b} \iff 2^{\large x-y}\equiv 1\iff \color{#c00}3\mid x-y\iff\!\!\!\!\! \overbrace{x\,\equiv\, y}^{\Large \ell(a)\ \equiv\ \ell(b)}\!\!\!\!\pmod{\!\color{#c00}3}$

Hence if you redo the calculation using modulus $\,\color{#c00}3\,$ instead of $\,7,\,$ and use $\,2^{\large 4}\!+2^{\large 4} = 2(2^{\large 4}) = 2^{\large 5},\,$ then you will obtain $\,2^{\large x}\equiv 2^{\large 5}\pmod{\!7}\iff x\equiv 5\equiv 2\pmod{\!\color{#c00}3}$

Remark $ $ Regarding you question about the relationship to little Fermat, since $\, a^{p-1}\equiv 1\pmod{p}\,$ if $\,p\nmid a,\,$ this implies that the order of $\,a\,$ divides $\,p-1.\,$ For algorithms to compute the order and solve the discrete log problem see here.

Bill Dubuque
  • 272,048
  • Above we used the basic order property in the Corollary here. $\ \ $ – Bill Dubuque Jun 14 '19 at 23:12
  • From Euler's totient function, $a^{\phi(n)} \equiv 1 (mod n)$ where gcd(a, n) = 1

    If I use $log_a$ on both sides then the equation will be like below?

    $\phi(n) \equiv 0 (mod \phi(n))$

    Am I correct? @Bill Dubuque

    – Pias Roy Jun 15 '19 at 08:52
  • @PiasRoy No, the final comngruence should be modulo $,{\rm ord}_n,a.,$ To obtain all the integer solutions this modulus must be the actual length of the cycle of powers of $a$ mod $n$, not some multiple of it (such as $\phi(n))\ \ $ – Bill Dubuque Jun 15 '19 at 13:25
  • E.g. $,2^{\large x}\equiv 2^{\large 5}\pmod{!7}\iff x\equiv 5\pmod{6},$ is wrong since it omits solutions $,x\equiv 2\pmod{6}.,$ Correct is that $,2^{\large x}\equiv 2^{\large 5}\pmod{!7}\iff x\equiv 5\pmod{!\color{#c00}3}\ \ $ – Bill Dubuque Jun 15 '19 at 13:44
  • Is there any algorithm to find $,{\rm ord}_n,a.,$ efficiently? @BillDubuque – Pias Roy Jun 15 '19 at 14:32
  • @PiasRoy See the thesis I coted in the linked answer. See also the Order Test. – Bill Dubuque Jun 15 '19 at 15:06
0

By Fermat’s little theorem, $2^6\equiv1\pmod7$, so if $x\equiv y\pmod6 $ then $2^x\equiv2^y\pmod7$. So to solve $2^x\equiv2^4+2^4=32\equiv4\pmod7$, you only have to check if the following are congruent to $4\pmod7: 1,2,4,8,16,32.$ That’s easy, no?

J. W. Tanner
  • 60,406