As an exercise in my conceptual algebra class we attempted to determine the reason why this theorem holds true in the forward direction. (Note we decided not to tackle the opposite direction) I wrote out a proof of it for the discussion that laid it out rather simply but I would like to make it more formal. However, the more formal version doesn't seem as clear to me as my original did.
Original plain English proof: If we take any rational number p/q and begin to work out the division we see that at each step we have a remainder. This remainder will always be a value between 0 and q-1 because if it was not we would know from the rules of division that our quotie t was wrong.
If our remainder is 0 then the decimal terminates and we are finished. If we never get 0 then there are only a limited set of numbers our remainder can be and eventually one of them will be repeated. As soon as a remainder is repeated the entire decimal will repeat itself giving us a repeating decimal.
Therefore every rational number is represented by a decimal that either terminates or repeats.
Formal proof attempt: Claim: if a number is rational, then it's decimal expansion either terminates or repeats.
Proof: let a/b be a rational number. Then by the definition of rational numbers a/b is a ratio of the integers a and b where b divides a.
Then by the division algorithm a=bq+r for some integers q,r and 0 <= r < b
It follows that if r is 0 the decimal terminates. If r is not 0 then, because r can only be a restricted set of integers, by the pigeonhole principle at some point r must repeat.
Thus the decimal expansion of a rational number either terminates or repeats.