Computing the Euler totient function, part 2: seeing phi is multiplicative

In my last post, I claimed that \varphi(mn) = \varphi(m) \varphi(n) whenever m and n are relatively prime. (Recall that \varphi(n) counts how many numbers from 1 to n share no factors in common with n.)

Let’s get some intuition for this by looking at some m \times n Chinese remainder theorem grids and highlighting the numbers which are relatively prime to mn. So, for example, the first grid below is 3 \times 5; I’ve filled it in with consecutive numbers from 0 to 14 along the diagonal, and highlighted all the numbers that share no common factors with 15. (I’ve also labelled the rows and columns with smaller numbers counting from 0.) Below that I’ve also chosen to show similar 3 \times 8, 5 \times 6, and 8 \times 9 grids.

And here’s a slightly bigger example (14 \times 15):

There are some striking patterns here. The placement of the highlighted cells is clearly not random: they are precisely confined to certain rows and columns. (Incidentally, this is exactly what I was trying to show in my last post without words, though I think the colors may have been somewhat distracting.) Which rows and columns are they? Let’s have a look. Below I’ve drawn the 8 \times 9 grid again, this time highlighting the rows and columns where cells relatively prime to 72 occur:

Notice that the highlighted rows (1, 3, 5, 7) are exactly the numbers relatively prime to 8, and the highlighted columns (1, 2, 4, 5, 7, 8) are the ones relatively prime to 9. The number of dark blue intersection points is just the number of highlighted rows times the number of highlighted columns: there are four highlighted rows and six highlighted columns, making a total of 24 dark blue squares. That is, \varphi(72) = \varphi(8) \varphi(9).

You can check that this is true for the other examples I showed above as well. So can we turn this into a conjecture? Remember that when we label an m \times n grid with consecutive numbers along the diagonal, the number x ends up at the grid coordinates (x \mod m, x \mod n) (see this post). We’re guessing that cells containing numbers relatively prime to mn end up precisely where the row number is relatively prime to m and the column number is relatively prime to n, so we can translate this into the more formal statement

x is relatively prime to mn if and only if x\bmod m is relatively prime to m and x \bmod n is relatively prime to n

We’ll prove this next time!

About Brent

Assistant Professor of Computer Science at Hendrix College. Functional programmer, mathematician, teacher, pianist, follower of Jesus.
This entry was posted in arithmetic, computation, counting and tagged , , . Bookmark the permalink.

2 Responses to Computing the Euler totient function, part 2: seeing phi is multiplicative

  1. Pingback: Computing the Euler totient function, part 3: proving phi is multiplicative | The Math Less Traveled

  2. Pingback: Computing the Euler totient function, part 4: totient of prime powers | The Math Less Traveled

Leave a reply. You can include LaTeX $latex like this$. Note you have to literally write 'latex' after the first dollar sign!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.