2+2 = 1? Patterns in Modular arithmetic

November 20, 2011

When someone is talking about the absolute truth of mathematics and declares that once you have defined 2 and +, then 2+2 must equal 4, there is a slightly glib response:

but 2+2 = 1…Mod 3

Despite this surprise, we actually all use modular arithmetic regularly, quite literally on a daily basis. When we consider six hours after 8am, the answer is not 14, but 2pm. Well you could argue for using a 24 hour clock, but no one would claim that 3am on a Tuesday morning is really 27:00 on Monday (well apparently some do, thanks to kuromagi on reddit for ref) In these cases we are not counting as we usually do, but counting on a circle mod 12 or 24. It is not hard to see that we could do this with other numbers. if we do decide that 2+1 is 0, and not 3 we are now working mod 3. In this case 2+2 is 1, as is 2*2. We can put together a small table:

+ 0 1 2
0 0 1 2
1 1 2 0
2 2 0 1

Showing what happens when the values for the column and row are added together. We can make the same table for multiplication:

x 0 1 2
0 0 0 0
1 0 1 2
2 0 2 1

I have to admit these table are a little boring, we can make things more interesting by replacing the numbers by colours. As we are working with modular arithmetic we know that the range of numbers we will come across, lies between 0 and the value we are using for modulus, so we can map these onto some circle of colours. So work mod 151 we get a new table for addition:

Using the same system of colours we can do the same thing for multiplication:

Which is starting to get interesting. We do not need to stop there, we can produce an image where the row number is taken to the power of the column:

This looks a little jumbled, in fact it seems to have very little structure at all. This is not very useful if our goal is to make pretty images, and on this blog that is normally the goal, but it other areas it turns out to be incredibly useful. The process of modular exponentiation is an essential part of public key cryptography, one of the technologies that allows secure communication over the internet. The jumble and lack of pattern that we can see is a sign that modular exponentiation is a good method to use to jumble things up. if there were structure that could be used to help decrypt the messages!

Returning to images, lets make a big version of the multiplication image, mod 1583 (you need to click it to get the full effect, scaling the image down blurs out a lot of structure):

Another option is to make an animation. what happens as we move the modulus value:

There is plenty to study in these images, for example, the curves that can be seen are approximately hyperbolae as they occur when x*y is some fixed value. The central star point occurs in the middle of the image, and there are further stars at 1/3, 2/3, 1/4, 3/4 etc. Can you work out why?

The appearance of hyperbolae perhaps implies that other curves might be possible. What happens if we consider x^2 + y^2? An obvious guess from this formula would be circles and we indeed get (for 151):

Playing around a little further this image comes from x^2 - y^2 +3 x y:

These images are certainly worth repeating for 1583 (again the details get blurred out, so click the images to see the full detail):

To finish let us consider something even simpler. Taking the value of a square to be \frac{x \mod y}{y} this will always give a value between 0 and 1. We can then colour again, and animate with \frac{x \mod Q y}{y} and Q going from 5 to 0:

I first came across these patterns in the December Issue of notices of the AMS, I have always been surprised how little they have been explored. This post is my attempt to do a little to correct that.


The University Project: Stories and Science

September 25, 2011

For background you might start with these two pieces from Dougald Hine:
About this university…
The University Project: Five Reasons

I can’t tell stories. I am a mathematician, I find rules. I want to break everything down into its simplest components, to things that feel self-evident. This can be stereotyped as reductionism, even criticised for taking away the beauty and mystery of the world. That is the cultural wars crap. To me the process of seeking the simple, understanding the rules, is itself simple. To cut away the things that are simple so that we can get to the true complexity. To see problems clearer by cutting away the simple stuff that initially looks complicated. Right now my rules based understanding is screaming:

The world needs story tellers and stories

Stories that et us work more effectively with he world. Stories that allow us to grab the understanding gleaned from some deep scientific study without having to get to the bottom of its details.

Think about fairy tales, there is something magical about them and it is not just the witches. On the surface they are fantasy, things that clearly made up, 1000 year sleeps, pumpkins becoming coaches, houses made of cake… Yet at their core they have deep psychological truth and wisdom. They can help prepare children for the darkness of the world around them. In fact any work of fiction is by definition lies, but novels have had as great an effect on my life than just about any understanding I got from science and maths.

You do not get this wisdom just by being a story. It comes from the authors wisdom, understand and beliefs about the world. And there’s the rub. The understanding of the world that we have been able to grasp with the tools of mathematics and science is immense and detailed. Even the experts can only grasp parts of it. In fact the amazing work of Gödel, Turing, Church, Post, Chaitin and others means that this can be exactly quantified. To butcher another great story teller:

And therefore as a stranger give it welcome.
There are more things in arithmetic, Horatio,
Than are dreamt of in your philosophy.

Yes, humble arithmetic can be studied for as long as you care and yet still reveal new secrets. When this is the case, how do we expect someone who also needs to learn the delicate arts of telling stories, or performing to also gain a deep understanding of science or medicine. Just as we cannot expect those who have spent many years learning how to create science to also tell compelling stories. There have been many examples of course, but very clever people in a single field are rare, so we should not just wait for the few who are brilliant in more than one, when we can bring the one-fielders together.

We need the skill and art of storytellers forged by the ability of science to cut through the crap and give a sense of what is real. Stories that on the surface are engaging fictions but whose heart and core message can be backed up by spreadsheats and data.

This bring me to the university project. Yet when I try to say why it becomes difficult. Everything above is really just part of the classical ideal for the university. Universities still act as the haven for many, many wonderful things. Why then do I feel we need to explore alternatives? Yet I do. I feel that due to a combination of pressures universities do not nurture such collaborations in the ways they need to be. The value system within academia has become too focussed on ability within a specialisation and a certain value system based on certain forms of publication. This is especially true at the hiring level. Working outside a discipline is consider a great thing, but only after you have mastered your field. The problem to me is that working outside an expertise is not a trivial task. It needs to be studied, worked on and developed. Successful collaborations can take years to develop real output, and there are other collaborations that last years without getting there.

The university project feels different, placing open connections at its institutional core. Using play and friendship as ways to overcome the barriers of the jargons and fixed ideas we have to develop to become successful specialists. It is not about replacing the university, or even reinventing it, but about giving options opening new paths to the beautiful concept:

The cultivation of knowledge.


These ideas have been fermenting for a long time, and have developed during my involvement with the University project and the discussions and ideas around it, most notably the thinking of Dougald Hine (of course) Alex Fradera, Nick Stewart and Rhett Gayle. These crystallised into a concrete idea when I read a tweet from Vinay Gupta.

I am not claiming any particular originality in the thinking, and there are many examples of the sort of combination that I ask for. I want this to increase, not to start! As examples you can look to authors such as Borges, Nabakov, Perec, and Pratchett, and coming from the science side to tell stories Asimov and Sagan. It does feel that this sort of endevour is growing. The theatre production A disappearing number by Complicté working with mathematician Marcus du Sautoy is an incredible example. It is discussed in the broader setting by Joe Winston, whose work on stories, beauty and education is wonderful.

Other people telling stories with and of mathematics include my friends Paul Prudence and Rohit Gupta. Both of whom provide lyrical beauty and whimsy to mathematical ideas.

There is so much possibility  and to me the grand push of the university project is to try to explore and find ways of unleashing it to the true benefit of humanity and the world.


The Academy: Axiom 1

September 3, 2011

The rule

This post is not trying to do anything clever. It is making a statement that seems self-evident:

There are three ways to gain understanding of the world:

  • Personal experience
  • Systems of rules
  • Stories

All are equally important, and each has its strengths and weaknesses.

The important point is not the content of the statement but the stating of it. This is not just something that feels correct (to me) but something that feels fundamental. This mirrors one of the quests of mathematics to find the simplest statements on which to build the whole subject. I have my suspicions that the same thing would not work completely here, though writing the “Elements of the Academy” with this as one of the axioms might make a curious exercise!

This axiom maps onto the world of academia. The Sciences are primarily concerned with the use of rules to understand the world; the Arts centred on the creation of objects that attempt to transfer personal experience; and the Humanities write, dissect and try to understand the stories of the world.

All three areas, of course, do and should take advantage of the strengths of the other two methods as well as their primary concern.

The story

As a mathematician I obviously come from the grand tradition of finding rules to understand the world. For much of human history this was known to be rather limited in its scope. It was applicable to commerce, certainly; but also to questions of measurement, and to the study of the stars and music. Then, with the acceptance of arguments based on infinitesimals and the genius of Newton and Liebniz, the models of calculus opened up a vast array of phenomena to understanding through rules. It was so successful that many started to believe that it would eventually explain everything.

I do not believe this to be the case. Chaos theory shows that even perfect models can be severely limited by small, unavoidable, measurement errors. The work of Gödel and Turing shows that even in the purely theoretical world, there are unanswerable questions. Some even believe that as fundamental a system as arithmetic might contain contradictions. Before we even get to these hard limits we must deal with the soft limits imposed by the great ideas that we have yet to have.

Unfortunately, or fortunately depending on situation and personal preference,  the world offers many questions that we cannot answer with a systematic, rules based approach. Questions we cannot ignore. I wanted to define for myself the other options, and place them in some imagined framework.

The personal experience

I don’t believe I have said much here. It is, as I stated, self-evident. I also think it is important. It has been useful and practical to me. So, if you have managed to read this far, I thank you, but ask one further thing. Think about it yourself and see if it is a useful for you too.

Acknowledgements

This post grew out of a string of tweets, out of which grew very valuable discussion with  Colin Wright (@ColinTheMathmo) and Daniel Colquitt (@danielcolquitt), on twitter and elsewhere.


Will the next generation act?

July 21, 2011

Mathematics and policy need to meet in preschool

[A recent collaboration with Vinay Gupta, available as a pdf]

We are all products of our environment, so education is one of our best chances of producing a better human race in time to do something about our world’s plight. Our instinctive approaches to educating our children are rooted in our deep ancestry and our more recent cultural accumulations. As we see all around us, instinct and culture are failing us. Our inability to correctly model our world and act on our conclusions endangers us all.

Our ability to believe in our models rests firmly on our affinity for mathematics, yet centuries of breakthroughs in mathematical thought have not been broadly integrated into our culture. Although the fruits of pure mathematics – nuclear physics and digital computers and networking – more or less define the modern age our basic regard for the practice of mathematics has not increased in keeping with its importance, nor have our educational practices reflected the changing role of mathematics in the world. Cryptography is the backbone of all commercial use of the internet, and while hackers draw endless media attention, do you know the names Rivest, Shamir or Adleman?

Although mathematics is at least as old as agriculture our mathematical heritage is not as treasured as other cultural links with the distant past. Correcting our cultural bias against mathematics is an intergenerational struggle. In sport, art and music we encourage appreciation by non-practitioners, but interest in mathematics is expected to be confined to experts. Prejudices like if it’s not hard it’s not mathematics have interfered with our ability to appreciate or even identify mathematics.

Quilting and other forms of textile design, have some overt mathematics, counting and measuring, but making satisfying repetitive patterns uses the mathematics of symmetry. Tetris uses the tetrominos for pieces. Part of the satisfying regularity of the game is that the pieces aren’t arbitrary – all the possible shapes are there. Traditional card games lead to many areas of mathematics, but the deck itself is rather arbitrary – why four suits, rather than five? We need better artifacts to train thinking.

Games
Set In comparison to a standard deck, the Set card game is very ordered, having 81 cards (3x3x3x3). This forms a regular-yet-surprising deck, including every possible card for four choices of three options, and thus has the same sense of completeness as the Tetris blocks. Hands are matched all-same or all-different, and even very young children catch on quickly and can compete against adults!

Doodling You can make your own mathematical games on squared paper, or just play around with ideas. For inspiration you need look no further than Vi Hart’s videos.

Puzzles
Rubik’s Cube The ubiquitous Cube was the definitive puzzle of the 1980s. The 3x3x3 plastic puzzle encapsulates substantial group theory, and is solved by discovering or learning algorithms. Guides for learning how to solve the Cube have improved a lot over the years, it’s easier than ever to solve.

Penrose Tiles These two simple shapes fit together to produce an endless array of different patterns which never repeat and never run out. The puzzle pleases when decisions made earlier come back as you find you have to retrace your steps to continue laying the tiles. Beautiful patterns and shapes result.

Toys
Lego is the universal solvent for technical professionals. Everybody played with lego, and everybody describes how formative lego was in shaping their capacity to plan, execute and make. Modern lego has tended towards branding itself as a toy rather than a building system, but large boxes of basic bricks are still available. You can even bend it!

Zometool Want to see four dimensional space? This toy gets you about as close as is humanly possible, and you just have to build it. It is also brilliant for exploring three dimensions beyond the right angled system of Lego.

Polydron A simple idea, shapes that clip together at their edges forming a hinge. Mathematically they can look at how geometry jumps from two dimensions to three, what will you make out of them?

Meccano Another classic old toy that should not be underestimated. Metal and bolts vs. machined plastic. The long standing “Meccano people vs. Lego people” controversy can easily settled by buying both.

Scratch The easiest way for children to make software, taking their first steps into the source code that will run our lives. Scratch has excellent support for sound, graphics and even video, and is free.

Further Resources
Martin Gardner Ask mathematicians what got them into the subject as there is a very high chance that Martin Gardner will be mentioned. For years he talked puzzles, games and even broke new mathematical results in his Scientific American column. He left us with books stuffed full of curious intriguing and meaningful mathematics.

The Museum of Mathematics opens in 2012 in New York, this will be a mathematical wonderland, giving an intuitive glimpse even into many corners of mathematics. The website is packed with videos and resources.

Edmund Harriss & Vinay Gupta, Cloughjordan, 2011
with the kind support of Django’s Hostel


Follow

Get every new post delivered to your Inbox.

Join 213 other followers