Isomorphism – Mathematics of Programming

Recommended

Preface 

Martin Gardner gives an interesting story in his popular book aha! Insight. In a country fair, there was a game called “Fifteen” on the carnival midway. Mr. Carny, the carnival operator explained to people the rules: “We just take turns putting down coins on a line of numbers from 1 to 9. It doesn’t matter who goes first. You put on nickles, I put on silver dollars. Whoever is the first to cover three different numbers that add to 15 gets all money on the table.”

A lady joined this game. She went first by putting a nickle on 7. Because 7 was covered, it couldn’t covered again by either player. And it’s the same for other numbers. Mr. Carny then put a dollar on 8.

The lady next put a nickle on 2, so that one more nickle on 6 would make 15 and win the game for her. But the man blocked her with a dollar on 6. Now he could win by covering 1 on his next turn.

Seeing this threat, the lady put a nickle on 1 to block his win.

The carnival man then put a dollar on 4. He would win by covering 5 next. The lady had to block him again. She put a nickle on 5.

But the carnival man placed a dollar on 3. He won because 3 + 4 + 8 = 15. The poor lady lost all nickles.

Many people joined to play the game. The town’s Mayor was fascinated by the game, too. After watching it for a long time, he decided that the carnival man had a secret that made him never to lose the game except he wanted to. The Mayor was awake all night trying to figure out the answer.

The key to the secret can be traced back to 650BC. There was a legend about Lo Shu in ancient China around the time of huge flood. A turtle emerged from the river with a curious pattern on its shell: a 3 × 3 grid in which circular dots of numbers were arranged.

This is known as Lo Shu Square, a magic square of order 3. The sum of the numbers in each row, column and diagonal is the same: 15. For example, the sum of the first row 4 + 9 + 2 = 15; and the sum of the third column 2 + 7 + 6 = 15; the sum of the diagonal from left up to right bottom 4 + 5 + 6 = 15. The insight to the carnival fifteen game is exactly the magic square. All three numbers sum to 15, form the rows, columns, and diagonals in that square. If the carnival man hold a secret Lo Shu map, he is essentially playing the tick-tack-toe game with other people.

The game between the lady and Mr. Carny is equivalent to such a tick-tack-toe game. The man trapped the lady in step three. He could line up both a column and a diagonal. If the lady puts on 3, then the man could win the game by playing on 5. If you know a bit about game theory or programming, one will never lose the tick-tack-toe game if plays carefully. The carnival man with the secret Lo Shu square map does have the advantage over other people. As the fifteen game proceeds, the carnival operator mentally plays a corresponding tick-tack-toe game on his secret map. This makes it easy for the operator to set up traps of winning position.

This interesting story reflects an important mathematical idea, isomorphism. A difficult problem can be transformed to an isomorphic one, which is mathematical equivalent and easy to solve. A line of 9 numbers corresponds to a 3 x 3 grids; the sum target of fifteen corresponds to one of the rows, columns, and diagonals; Lo Shu pattern corresponds to magic square of order 3. This is what this book intents to tell: programming is isomorphic to mathematics. Just like in art and music, there are interesting stories and mathematicians behind the great minds.

There is another further idea in this story: under the surface of the problem hides the theoretical essence, which is abstract and need to understand. With the rapid development of artificial intelligence and machine learning, can we keep moving forward with a little cleverness and engineering practice? Are we going to open the mysterious black box to find the map to the future?

Attribution

Xinyu Liu (2022), Isomorphism – Mathematics of Programming, URL: https://github.com/liuxinyu95/unplugged

This work is an open book provided by Xinyu Liu, thank you for providing this useful book to us.

VP Flipbook Maker

Have no idea how to display your work in an interesting way? Visual Paradigm Online Flipbook Maker is a useful tool for your to create digital flipbook or convert your work in other format to flipbook. Try it now!