I was reading a book [1] and I saw the follow statement: "The set {0,1,2,3,4} can be a field [...]" - followed by a short answer why it can be a field. In this article I want to dive a little a bit deeper in this statement and show why it is true. I will define what is a set, a field and, from there, we will be able to conclude that this set is a field. I will keep the explanations clear and simple because I want everyone to understand and because I am not an expert in mathematics (just a curious and passionate enthusiast).
A set is any collection of objects. This means that it can contain numbers, functions or any other mathematical object. E.g you can create a set with all the names of your favorite cats: $$ \tag{1} favCats = \{Udy, Kira, Pipoca\} $$ The set which we will work with, is: $$ \tag{2} \{0,1,2,3,4\} $$
A field is any set closed under addition and multiplication with commutative, associative, distributive properties as well as addition and multiplication identities and inverses. Now you ask: "What means being closed under addition and multiplication?" - that is a nice question! Being "closed under" addition/multiplication means: for any values $ a $ and $ b $ in your set when we add them: $ a + b $ - or multiply them: $a \cdot b$ - the result needs to be inside your set too. Mathematically we say: $$ \tag{3} \forall a,b \in A: a + b = c \in A$$ and $$\tag{4} \forall a,b \in A: a \cdot b = c \in A$$ where $A$ is your set and $\cdot$ is the symbol used for multiplication.
Since your set is closed under addition and multiplication those other properties should be verified too. Let me help you remember what each one means:
I will give you an example which will clarify this. Assume that our set is all the real numbers represented by $\mathbb{R}$. Now we will define $a = 2$, $b = 3$, $c = 4$ and we know that $a,b,c \in \mathbb{R}$.
Given the properties let us replace the letters by the assigned numbers:
You can set the values of $a,b,c$ to whatever you want as long as they are in $\mathbb{R}$. However the set I showed you at the beginning is not $\mathbb{R}$. Let's now try to verify these properties on it.
We do not need to verify many properties since the set is not closed under addition. Let our set be defined as: $A = \{0,1,2,3,4\}$, and let $a = 3$ and $b = 4$ where $a,b \in A$. Then $a + b = 3 + 4 = 7 \notin A$. $7$ is not in the set $A$, so the set is not closed under addition and you will assume that this set cannot be a field. Well ... something you will learn in [2] is that 2 + 2 is not always equal to 4.
Forget everything you have read so far and imagine an analog watch like the one below The day starts at 0AM which is the same as 12AM. If I say: "Already passed 5 hours from the beginning of the day" - you will do: $0 + 5 = 5 $ which means is 5 AM. But can you do $12 + 5 = 5$? Yes, because you place the pointer on 12 and count 5 hours, clockwise, reaching 5 AM. If I say: "Already passed 23 hours from the beginning of the day" - you will place the pointer in 12, do a complete rotation, clockwise, reaching 12 PM which means you completed 12 hours and are remaining 11: $23-12 = 11$. After rotate 11 clockwise you will reach 11PM which is the final result. So 23 is not in the set of the clock, since it only has integers from 1 to 12, but you can reach any passed hours using only 12 integers like you just saw.
What we did before is named Modular Arithmetic which just means you start counting in the first number of your set and when you reach the last number of your set, you go to the beginning. For example, in the clock we have: $\{1,2,3,...,12\}$, so if I count from 1 to 14 it will be: 1 2 3 4 5 6 7 8 9 10 11 12 1 2. Adding numbers is like counting, so in this set if I add: $11 + 5$ means counting to 11: 1 2 3 4 5 6 7 8 9 10 11 - and count more 5: 12 1 2 3 4 - so $11 + 5 = 4$.
We can name this addition: Addition modulo 12 - which means when you reach 12th number you go to the beginning. I know, this is easy because we are using small sets, but exists an operation named modulo (represented by $ mod $) which allow us to calculate this additions easily. You just need to divide the number by the $n$th number, where $n$ is the modulo number referred before, in this case is 12, and get the remainder. Using the previous example where we have $11 + 5$, let's divide 16 by 12 and get the remainder: $16 \bmod 12 = 4$ - like when we did $11+5$.
In our $A$ set we will have an addition modulo 5, because we start at 0 and end in 4, we have a total of 5 numbers. Now you are thinking: "Ok, we are closed under addition using this new addition, but are we closed under multiplication?" - multiplications are additions. When you say: $25 \cdot 2$ - your are saying: $25 + 25$ or $2+2+2+...+2$, having a total of 25 number twos. So, $25 \cdot 2 = 50$ which means: $50 \bmod 5$ in our set $A$, resulting in $0$. It works in the same way you just need to solve your multiplications and then apply the modulo operator.
It is closed under addition and multiplication and it is easy to see that commutative, associative and distributive properties are verified, since each multiplication and addition modulo 5 will result in an element of set $A$. The identities and inverses could be a little bit harder, but in this small set you can see quite easily, e.g what is the value of $b$ such that $4 + b = 4$? It is $0$, and in case of $4 + b = 0$, $b = 1$. The same will be observed in multiplication identity and inverse, since $4 \cdot 1 = 4$ and $4 \cdot 3 = 1$.
This is just another way to think about the modular arithmetic. First, we need to learn about an integer being congruent to another. For example, in our set $A$, 5 and 0 are congruent because $ 5 \bmod 5 = 0 \bmod 5 = 0 $. Mathematically we write: $$ \tag{12} 5 \equiv 0 \pmod 5$$. This means 5 and 0 correspond to the same number in $A$. Thinking in modulo operation, when we have $a \bmod b = c$ then: $$ \tag{13} a \equiv c \pmod b $$. So the dividend, $a$, and the remainder, $c$, are congruent on modulo $b$. This can be represented algebraically but first let's remind how long division works.
The image below show the division between $a = 14$ and $m = 5$ having a remainder $b = 4$, so: $a \equiv b \pmod m$. But we know more than that. $k \cdot m = c \Rightarrow a - c = b \Leftrightarrow a - b = c $. $m$ divides $c$, then it divides $a-b$. With this we can formulate that two integers, $a$ and $b$, are congruent in modulo $m$ if there is an integer $k$ such as: $$ \tag{14} a-b = k \cdot m $$ which is the same as: $$ \tag{15} a = k \cdot m + b$$ With this we can find congruent integers having one of the congruent integers, the modulus, $m$, and the quotient, $k$. We can always find one variable if we have the values of the other three variables. But with this small set $A$ we don't need to know all those values, let me show.
Suppose we are calculating again the addictive inverse of: $4 + x = 0 $ with $x \in A$. If we ignore $x \in A$ we can do: $x = 1-4=-3$. Now we want some value of $A$ congruent to $-3$ in modulo 5. Given the equation $(15)$: $-3 = k \cdot 5 + b$ where $b \in A$. $b$ cannot be negative since all values in $A$ are non-negative, which means $k$ needs to be negative and if $k = -1$ then: $-3 = -5 + b \Rightarrow b = 2$. With this we find that 2 is congruent of -3 and $2 \in A$, so we can conclude that: $4 + x = 4 + (-3) = 4 + 2 = 1$ - where $4$ and $2$ $\in A$
With this I hope you better understand what is a set and a field, how modular arithmetic works and maybe you may have noticed that not all sets $\{0,1,...,p-1\}$ with addition/multiplication modulo $p$ are fields ... But that is content for a future post. Please if you have doubts or find something wrong (or poorly explained), contact me here.
[1] Stephen Abbot. (2015). Understanding Analysis Second Edition. Springer
[2] Edward Frenkel. (2013). Love and Math. Basic Books