2

I'm not sure how well I'm wording this, but I was wondering how you address cases in modular arithmetic when you plug in a number greater than the modulus, e g. $\sqrt{8} \pmod{5}$. If you leave $8$ as it is, and square root it, you get $\approx2.828$. If you mod $8$ before doing anything, you get $\sqrt{3} \pmod{5}$, which is $\approx1.782$ These are clearly different answers, so which one do you go with? Do you mod the input before or after you apply expressions to it?

I hope this question was worded well enough, I was just confused how you would handle that (and I'm sure I'm just misunderstanding something simple here).

e4494s
  • 475
  • 2
  • 5
  • 2
    It's unclear what $\sqrt 8 \pmod 5$, means. You might mean a solution to $x^2\equiv 8\pmod 5$ but which solution you might call $\sqrt 8$ isn't clear (note that there is no solution in this case, but in principle there could have been multiple solutions). – lulu Oct 22 '21 at 14:24
  • 1
    Usually, modulo is only applied to integers. To extend this to $r\mod n$ with positive real $r$ you could subtract the largest multiple of $n$ not exceeding $r$ from $r$. – Peter Oct 22 '21 at 14:25
  • Okay, thank you! I figured it was just me not understanding modular arithmetic. That makes sense why it would be ambiguous and you wouldn't really say it like that – e4494s Oct 22 '21 at 14:29
  • 1
    Besides the already posted comments, which I agree with, there is another flaw in your analysis. You assumed that because $8 \equiv 3\pmod{5}$ that therefore $\sqrt{8} \equiv \sqrt{3} \pmod{5}$. Ignoring that modular arithmetic is normally only applied to integers, in general $a \equiv b \pmod{c} \iff ~c ~| (a - b)$. While $5 ~| ~(8-3)$, it is not the case that $5 ~| ~\left(\sqrt{8} - \sqrt{3}\right).$ – user2661923 Oct 22 '21 at 14:35
  • 3
    Re previous comment, if $k \in \Bbb{Z^+}$, it is true that $a \equiv b\pmod{c} \implies a^k \equiv b^k\pmod{c}.$ However, the reverse implication does not necessarily hold. For example $\left(2^2\right) \equiv \left(3^2\right) \pmod{5}$, while it is not the case that $2 \equiv 3\pmod{5}.$ – user2661923 Oct 22 '21 at 14:39

0 Answers0