# explaing the following prove

i need help with the proove of every finite integer domain is a field, the proof is as follows:

The main idea is that if $$R$$ is finite, then any map from $$R$$ to $$R$$ is injective iff it is surjective iff it is bijective.

We know $$a\in R$$ is a not a zero-divisor if $$f_a$$ is injective. Since $$R$$ is finite, then it is also surjective.

If $$f_{a}$$ is surjective then $$a$$ is a unit. Hence we have shown that any non-zero element in $$R$$ is a unit. Hence $$R$$ is a field.

I need to clarify why if $$R$$ is finite, then any map from $$R$$ to $$R$$ is injective iff it is surjective iff it is bijective.

and what is $$f_a$$ and why If $$f_{a}$$ is surjective then $$a$$ is a unit

First of all, if $$f:X\to X$$ is an injective map, then $$f(X)\subset X$$ and $$|f(X)|=|X|$$. If $$X$$ is finite, then it must be that $$f(X)=X$$ (this is false if $$X$$ is infinite, since $$\{1,2,3,\ldots\}\subset\{0,1,2,3,\ldots\}$$ have the same size but are not equal).
Now, the map $$f_a:R\to R$$ is defined by $$f_a(x)=ax$$. Since $$a$$ is not a zero divisor, the map $$f_a$$ is injective. Since $$R$$ is assumed to be finite, $$f_a$$ is surjective as well. Since $$f_a$$ is surjective, $$f_a(x)=1$$ for some $$x$$. This means that $$ax=1$$ for some $$x$$.