Pages

Modulo for rational numbers


In our series on modulo, we have learned about modulo for integer numbers. Let us recall the definition.

Definition. Let $n$, $a$, $b$ be integer numbers. We say that $a$ is equal to $b$ modulo $n$, and write $$a = b \pmod{n}$$ if and only if $a-b$ is a multiple of $n$.

For example, $$8 = 0 \pmod{4},$$ $$9 = 1 \pmod{4},$$ $$-5 = -1 = 3 = 7 \pmod{4}, \dots $$

Today, we will learn a new concept - modulo for rational numbers. Before going into the details, let us list here a few examples, so that we may roughly see what modulo for rationals is about.

Examples of modulo for rational numbers: $$\frac{8}{5} =_{Q} ~0 \pmod{4}, $$ $$ -\frac{12}{55} =_{Q} ~0 \pmod{4},$$ $$\frac{29}{15} =_{Q} ~\frac{25}{15} = \frac{5}{3} \pmod{4}$$




To distinguish it with our usual modulo for integers, we will use the notation $$\alpha =_{Q} ~\beta \pmod{n}$$ to denote the modulo for rationals. The reason that we use this notation $=_{Q}$ is because the set of all rational numbers is usually denoted by the letter $Q$.

Remark: In the notation $$\alpha =_{Q} ~\beta \pmod{n}$$ the two numbers $\alpha$ and $\beta$ are rational numbers, but the number $n$ is an integer.



We will use the notation $\gcd(x,y)$ to denote the greatest common divisor of the two integers $x$ and $y$. So if the two integer $x$ and $y$ are co-prime then $\gcd(x,y)=1$. We are now ready to state the definition of modulo for rationals.

Definition. If $\alpha = \frac{x}{y}$ is a rational number written in lowest terms, i.e. $\gcd(x,y)=1$, then we say that $$\alpha =_{Q} ~0 \pmod{n}$$ if and only if $x = 0 \pmod{n}$ and $(y,n)=1$.

According to the above definition, the rational number $\alpha = \frac{x}{y}$ is equal to $0$ modulo $n$ if the numerator $x$ is divisible by $n$, and the denominator $y$ is co-prime to $n$. Therefore, $$\frac{9}{4} =_Q ~0 \pmod{9},$$ $$\frac{18}{5} =_Q ~0 \pmod{9},$$ $$-\frac{36}{25} =_Q ~0 \pmod{9},$$ $$18 = \frac{18}{1} =_Q ~0 \pmod{9},$$


We would like to make an important remark that in the above definition, when we check whether the rational $\alpha = \frac{x}{y}$ is equal to $0$ modulo $n$ or not, we write the rational $\alpha$ in its lowest terms. So, for example, even though $18$ is divisible by $9$, but $$\frac{18}{15} \neq_{Q} ~0 \pmod{9},$$ this is because when we write in lowest terms then $$\frac{18}{15} = \frac{6}{5}$$ and we have $$\frac{6}{5} \neq_{Q} ~0 \pmod{9}.$$


We have the following equivalent definition.

Definition. Let $\alpha = \frac{x}{y}$ be a rational and $n$ an integer. Then $$\alpha =_{Q} ~0 \pmod{n}$$ if and only if there exists an integer $k$ co-prime to $n$ such that $k \alpha$ is an integer and $$k \alpha = 0 \pmod{n} .$$


So far we know when a rational number $\alpha$ is equal to $0$ modulo $n$. Now, we will give a definition for two rational numbers $\alpha$ and $\beta$ to be equal modulo $n$.

Definition. Let $\alpha$, $\beta$ be two rationals and $n$ an integer. We say that $$\alpha =_{Q} ~\beta \pmod{n}$$ if and only if $$\alpha - \beta =_{Q} 0 \pmod{n}.$$

For example:
  • We have $$\frac{29}{15} - \frac{1}{3} = \frac{8}{5}$$ so $$\frac{29}{15} =_{Q} ~\frac{1}{3} \pmod{4}$$
  • We have $$\frac{25}{18} - 1 = \frac{7}{18}$$ so $$\frac{25}{18} =_{Q} ~1 \pmod{7}$$

Recall that in modulo for integers, we have "Addition rule", "Multiplication rule", "Exponentiation rule". We also have similar rules for modulo of rationals. We will learn about these rules in the next post. Let us stop here for now and hope to see you then.





Homework.

1. Let $\alpha$, $\beta$ be two rationals and $n$ an integer. Prove that $$\alpha =_{Q} ~\beta \pmod{n}$$ if and only if there exists an integer $k$ co-prime to $n$ such that $k(\alpha - \beta)$ is an integer and $$k(\alpha - \beta) = 0 \pmod{n}.$$

2. Verify that $$1 =_{Q} ~1 \pmod{7},$$ $$\frac{1}{2} =_{Q} ~4 \pmod{7},$$ $$\frac{1}{3} =_{Q} ~5 \pmod{7},$$ $$\frac{1}{4} =_{Q} ~2 \pmod{7},$$ $$\frac{1}{5} =_{Q} ~3 \pmod{7},$$ $$\frac{1}{6} =_{Q} ~6 \pmod{7},$$ and thus, $$1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \frac{1}{5} + \frac{1}{6} =_{Q} ~1 + 2 + 3 + 4 + 5 + 6 =_{Q} ~0 \pmod{7},$$

Verify that $$1 + \frac{1}{2} + \frac{1}{3} + \frac{1}{4} + \frac{1}{5} + \frac{1}{6} = \frac{147}{60}$$ whose numerator $147$ is a multiple of $7$.

Generalize the above observation.