Can inverse mod answers be negative or must they be in a “range”

inversemodular arithmetic

Rebound from this question: Debug back-substitution in extended Euclidean algorithm

My professor is telling me the correct answer to modular inverse of $28$ mod $45$ is $37$ and NOT $-8$. He says it has to be an answer in the range of 0-45. Is he correct?

My understanding of the definition suggests that both $-8$ and $37$ are valid answers.

Does the modular inverse definition requires a number within the range?

There is no context, I was asked on a homework problem to calculate the modular inverse of 28 mod 45. No clarification, no context.

EDIT: Well there was context that I was unaware of. My bad.

Best Answer

In modular arithmetic, all elements are members of an equivalence class and as such, referencing any member of a class is an acceptable way to represent that class.

For example, modulo $45$, the element $28$ is a representative of the equivalence class comprising integers of the form $28 + 45k$, where $k$ is any integer, where the equivalence relation $\equiv$ between two elements $a$ and $b$ is $45 \mid (a-b)$; i.e., their difference is divisible by $45$.

Because of this, there is no such thing as a unique representative of the set of equivalence classes; you can choose any representation you wish. The representation $\{0, 1, 2, \ldots, 44\}$ is in some sense "canonical," but it is not forced, because in referring to a class by a representative element, say $37$, we are not speaking of the specific element itself, but the entire class it represents.

Consequently, to accept $37$ as an answer but not $-8$ is mathematically incorrect. Both are multiplicative inverses of $28$ modulo $45$ since as was previously noted, $(37)(28) = 1036$ and $(-8)(28) = -224$, both of which are members of the same equivalence class $1$, modulo $45$. In order to make such a preference acceptable, the desired group representation must be explicitly stated in advance; e.g., "find the least nonnegative integer $a$ that $28a \equiv 1 \pmod {45}$," or something to that effect. Otherwise, simply saying "find the multiplicative inverse of $28$ modulo $45$" is misleading because the word "the" erroneously implies such an inverse is unique when in fact any member of the corresponding equivalence class is a solution.

Related Question