0

If $xy \equiv 1 \pmod a$, can I write $x \equiv \frac{1}{y} \pmod a$.

I was thinking about this while solving IMO 2005 P4, so in particular can I write $$2^{p-2} + 3^{p-2} + 6^{p-2}\equiv\frac{1}{2} + \frac{1}{3} + \frac{1}{6} \pmod p?$$

Bill Dubuque
  • 282,220
Aditya_math
  • 1,887
  • Normally not... it's more common to write $y^{-1}$. Also, if $a$ is not prime, then there are element that are not invertible. – Surb Nov 16 '20 at 08:54
  • 1
    What Surb commented. Typically, you have to first demonstrate that there exists a unique integer $k \in {0,1,2,\cdots, (a-1)}$ such that $ky \equiv 1\pmod{a}.$ Usually, this demonstration is not that hard; in fact it is often immediate. However, the issue should be considered. – user2661923 Nov 16 '20 at 09:03
  • Yes, modular arithmetic works for all fractions writable with denominator coprime to the modulus - see the linked dupes. – Bill Dubuque Oct 31 '24 at 21:06

1 Answers1

1

As long as $\gcd(a,y)=1$, yes, you could. If not, then you can't.

Find some integer solution to $my+na=1$, say by the extended Euclidean algorithm. Modulo $a$ this yields $my\equiv 1$, which means that $m$ corresponds to $\frac 1y$.

As noted in the comments above, though, it is more common in modular arithmetic to write $y^{-1}$.

Arthur
  • 204,511
  • so if i was writing the solution i have mentioned in the second para of my question, would it be allowed? – Aditya_math Nov 16 '20 at 09:00
  • 1
    @Aditya_math As long as $p$ is a prime greater than $3$ (or any other number divisible by neither $2$ nor $3$, such as $35$), then yes, that would make sense. – Arthur Nov 16 '20 at 09:06