Is $1/3$ and/or $-17$ in the set of integers modulo $7$? Is $1/3$ and/or $-17$ in the set of integers modulo $7$?
So I say that $1/3$ is in the set of integers modulo $7$ because $3 \cdot 1/3 = 1$, so $3x \bmod 7 = 1$. For $x = 5$, this works, so $1/3$ is congruent to $5 \bmod 7$. So I say that by congruence, $1/3$ should exist.
For $-17$, it is congruent to $4 \bmod 7$. So does that mean $-17$ also exists? Is my idea for $1/3$ correct or flawed?
 A: Let $R$ be the set of integers modulo $7.$ (Commonly written $\mathbb Z/7\mathbb Z.$)
It is an abuse of notation to say $-17\in R,$ (or even $4\in R,$) and it is an abuse of notation to say $\frac13\in R.$
But we allow the abuse of notation in the case of $-17$ and tend to frown on the abuse of notation in the case of $\frac13,$ because the latter can cause confusion and errors.
Usually, we prefer $3^{-1}$ to the notation $\frac13$ as a notation for the element of $R.$
Technically, no integer or rational number is in $R,$ because the elements are equivalence classes of integers.
If we write the equivalence class containing $m$ as $\langle m\rangle$ then
$-17$ is not in $R,$ but $\langle -17\rangle$ is. We have that, since $-17\equiv 4\pmod 7$ that $\langle -17\rangle =\langle 4\rangle.$
The rational number $\frac13$ is not a representative of an element. However, there is a multiplicative inverse of $\langle 3\rangle$ in the ring.
The main reason we tend not to use $\frac13$ for elements in this ring is that it gives an impression that there is a homomorphism $\mathbb Q\to R.$ There is a homomorphism from $\mathbb Z\to R,$ so we talk about $-17\in R$ a little more freely than we talk about rationals.
It is probably best to be careful with the language at first, and not get ahead of yourself.

There is a subring, $\mathbb Z_{(7)}\subset \mathbb Q,$ of rationals with denominators relatively prime to $7,$ and a homomorphism $\mathbb Z_{(7)}\to R,$ but that is a more complicated beast.
A: Yes, you are correct with both.
$-17\equiv 4 \pmod 7$. Similarly, $\frac13\equiv x$ for $3x\equiv 1 \pmod 7$.
You correctly identified $x\equiv 5$. This technique uses modular inverses and is pretty useful in calculating integer division with mods.
A: The answer is a bit more subtle than that.
The set of integers mod $7$ is by definition the set of equivalence classes of $\mathbb Z$ modulo the equivalence relation “$x-y$ is a multiple of $7$”.
The number $-17$ unequivocally belongs to $\mathbb Z$ and therefore is represented in exactly one equivalence class.  We conventionally use $0,1,2,3,4,5,6$ as representatives of the equivalence classes, but those are by no means set in stone.  In some contexts it is more convenient to use $-3,-2,-1,0,1,2,3$ instead.  And there is nothing in the definition that forbids us from using $-17,-16,-15,0,1,2,10$.
But the same is not true of $1/3$, which doesn’t even belong to $\mathbb Z$ in the first place.  Precision is very important in math: it would not be accurate to say that $1/3$ belongs to the set of integers modulo $7$.
But most working mathematicians would understand your intent.  That’s because the set of integers modulo $7$ overlaps substantially with another mathematical object, the field of integers modulo $7$, often denoted $\mathbb F_7$ or $\mathbb Z/7\mathbb Z$.  The elements of $\mathbb F_7$ are exactly the same as the set of integers modulo $7$, but the field additionally endows these with the ability to add, subtract, multiply and divide elements (except for $0$).  In the field setting, it is perfectly normal to write $1/3 = 5$.
A: There are several equivalent ways of looking at this.
At an introductory level, it is reasonable to think of the integers mod $7$ as the set $\{0,1,2,3,4,5,6\}$, with specific rules for the arithmetic operations. In this context, $1/3$ is an expression, not an "integer mod $7$"; and it can be evaluated, using the aforementioned rules, as $5$. Likewise $-17$ is an expression that can be evaluated as $4$ when working mod $7$.
Another slightly different take is that $-17$ (and $11,18$ etc.) are aliases for $4\bmod 7$. (But $1/3$ is still an expression, not an alias.)
A more satisfactory definition, mathematically speaking, is that an integer mod $7$ is a residue class, which is an equivalence class of integers, defined by the equivalence relation
$$x\equiv y\iff x-y \text{ is a multiple of } 7$$
So, for instance, $\{\ldots,-10,-3,4,11,\ldots\}$ is an integer mod $7$. And we can define the arithmetic operations on these equivalence classes in the obvious way.
But normally you don't have to bother with such distinctions $-$ you can just think of these entities in the way that feels most natural to you. The arithmetic operations turn out the same, after all.
A: This is more of an extended comment.
Well, this question actually hints at a much larger point, at least one that I had as a freshman: Why does everyone talk about [say] $\mathbb{Z}/7\mathbb{Z}$, but not say the set of rational numbers mod $7$ i.e., say, $\mathbb{Q} \cap [0,7)$. Wouldn't the latter system make sense? What happens is that the laws of addition and multiplication collapse the latter system to $\mathbb{Z}/7\mathbb{Z}$.
For example, $5 \times 3 \equiv_7 1$. Well but what about the fraction $\frac{1}{3}$ and why can't we take $\frac{1}{3}$ to be distinct from $5$. Well but then as $5 \times 3$ and $\frac{1}{3} \times 3$ are both $1$ in this system, it follows that $\left(5-\frac{1}{3}\right)\times 3$ has to be $1-1=0$ by the distributive law. So then $\left(5-\frac{1}{3}\right)\times 3 \times \frac{1}{3}$ must also be $0$. But then the associative law gives $\left(5-\frac{1}{3}\right)\times \left(3 \times \frac{1}{3}\right)$ $=$ $\left(5-\frac{1}{3}\right)\times 1 =0$. So either $5$ and $\frac{1}{3}$ are the same after all, or either the associative law of multiplication or the distributive law of addition and multiplication does not hold.
You can use this above line of reasoning to show that if one were to try to define [say] the ring $\mathbb{Q} \cap [0,7)$, then each rational number $\frac{m}{n}$; has to collapse to $(m \times n') \mod 7$, where $n'$ is the integer in
$\{0,1,2,3,4,5,6\}$ that satisfies $n \times n' \equiv_7 1$. And so indeed, if one were to try to define $\mathbb{Q} \cap [0,7)$, the laws of addition and multiplication collapse everything to $\mathbb{Z}/7\mathbb{Z}$.
