Let's say I have $2 \equiv 35x \bmod 71$. Wolfram tells me $x=67$ but how can I solve this without guessing and checking from $0$ to $71$? What if the variable is an inverse?
Asked
Active
Viewed 357 times
2
-
1$35 x\equiv 2\pmod{71} \iff x\equiv 2\cdot 35^{-1}\pmod{71}.$ So, you need to get the inverse of $35$ mod $71.$ – mfl Aug 21 '17 at 22:53
-
1You should include why 35 has an inverse, else it is meaningless and could lead to some major misunderstanding on the asker's part. – amWhy Aug 21 '17 at 22:56
-
is it only possible when they are relatively prime @amWhy? – user473765 Aug 21 '17 at 22:57
-
1you can rewrite it as 2=71y+35x – Aug 21 '17 at 22:58
-
1@amWhy Since $71$ is a prime number every number (different from zero) has a multiplicative inverse mod $71.$ – mfl Aug 21 '17 at 23:00
-
1@RoddyMacPhee how exactly does that help? – user473765 Aug 21 '17 at 23:01
-
You do not need to tell me, @mfl. But for the asker's benefit, thanks. – amWhy Aug 21 '17 at 23:01
-
gets rid of the mod you can prove things about the sign values of x and y through things like even = odd+odd or even= even + even. this can then prove that either both 71y and 35x are odd or they are both even. you also can rearrange it to -35x=71y-2 and prove things about that. this will show at least one solution the coprimality of 35 and 71 helps out after that to prove other things. also the solution would probably be 67 mod 71 which covers a number of solutions. – Aug 21 '17 at 23:06
-
you can also simply to $-{35\over71}x+{2\over71}=y$ and solve for y given an x value, then prove something about the times that x will cause integer y. – Aug 21 '17 at 23:13
-
@RoddyMacPhee Write an answer if you want to answer; then at least you'll be held accountable for writing in a way that isn't so scattered. – amWhy Aug 21 '17 at 23:19
3 Answers
1
$\!\bmod 71\!:\,\ x\equiv \dfrac{2}{35}\equiv \dfrac{4}{70}\equiv \dfrac{4}{-1} \equiv 67\ $ by Gauss's algorithm.
Beware $\ $ Modular fraction arithmetic is well-defined only for fractions with denominator coprime to the modulus. See here for further discussion.
See this answer for a handful of ways to compute modular fractions.

Bill Dubuque
- 272,048
1
In general, you have to use the extended Euclidean algorithm to find modular inverses. For the problem at hand, there is a shortcut because $35$ and $71$ are closely related:
$2 \equiv 35 \bmod 71 \implies 4 \equiv 70x \equiv -x \bmod 71 \implies x \equiv -4 \equiv 67 \bmod 71$

lhf
- 216,483
-
Which is equivalent to what I wrote $5$ minutes ago, but eliminating the fractions. Follow the link in my answer for an algorithm to do such (with fractions or not). – Bill Dubuque Aug 21 '17 at 23:17
-
-
Since when does clearing denominators from a prior answer count as an innovation? I would simply have added a comment. lhf indeed! (low-hanging-fruit iirc) – Bill Dubuque Aug 21 '17 at 23:30
0
to sum up my comments:
- you can rewrite it as 2=71y+35x
- this tells you that both y and x are same parity mod 2 via even=odd+odd=even+even
- rearrangement gets you that x and y have to be of opposite sign through -35x=71y-2
- Further rearrangement gets you $y=-{35\over71}x+{2\over71}$ which gives a line of slope of$-{35\over71}$ which means if you increase x by 71 you decrease y by 35.
- this implies that if one value of x solves the equation with y an integer, so will all values with remainder x when dividing by 71
- $71-1=2\cdot 35$, and that means $2\cdot 71-2=4\cdot 35$
- this then implies that x=-4 works ( owing to negative times negative is positive)
- adding 71 we get 67 as expected and we can then show that adding 71 to this is also a solution. so the answer is x has a remainder of 67 when divided by 71.