This Saturday, hundreds of competitors will gather in Toronto for the rock, paper, scissors (RPS) world championships. Now into its third year, the championships have become the highlight in the rock, paper, scissors calendar, with teams travelling from all over the globe to pit their wits against the finest exponents of the sport.

The rules are simple. Two players count "1 ... 2 ... 3 ... Go!" and then offer up their hand in one of three ways: rock (clenched fist), paper (open, flat hand), or scissors (forefinger and middle finger form a 'V'). The winner is decided according to the rules that rock blunts scissors (rock wins), scissors cut paper (scissors win), and paper covers rock (paper wins). If the weapons are the same, then the game is a tie.

The game has suffered criticism from outsiders, who claim that it is an entirely artificial construct - typically, if entity A is better than entity B, and entity B beats entity C, then entity C cannot beat entity A. It would defy com mon sense. The first reaction from the RPS community was to offer variations such as cow, UFO, microbe - cow eats microbe, UFO dissects cow and microbe contaminates UFO. Unfortunately, this is still a rather artificial example of A beats B beats C beats A.

However, over the last decade, biologists have come to the rescue by discovering several natural examples of RPS systems. For example, ecologist Brendan Bohannan of Stanford University has described the strange interactions between three strains (labelled S, R & C) of E. coli. Strain S grows more quickly than strain R, and in turn strain R grows more quickly than strain C. The sting in the tail is that strain C is armed with a toxin that allows it to overpower strain S if they are competing for territory in a petri dish. Crucially, strain R is resistant to the toxin.

So S beats R, R beats C, and C beats S. This sets up a very stable equilibrium. If strain S becomes rampant for some reason, then it overruns territory occupied by strain R. If the population of strain R declines, then strain C is able to grow more rapidly, but the toxin from the newly abundant strain C then kills off much of strain S. This allows strain R to prosper again, which reduces the strain C population, which then allows strain S to recover, and so on.

Mathematicians, too, have proved that RPS is more than just an artificial game. Their interest in RPS started with the development of game theory, the branch of mathematics that deals with finding winning strategies in games. Today's game theorists tackle warfare and complex games such as chess and poker, but the field started by working out strategies for the simplest children's games such as noughts and crosses and RPS. Mathematicians quickly realised that the optimal RPS strategy, which means one that is capable of competing with a perfect opponent, involves selecting rock, paper scissors at random.

But the greatest achievement of mathematicians with respect to RPS has been to invent a dice game. The game involves two players, each rolling a die, and the one with the higher number wins. Each player starts by choos ing a die from a selection of three, labelled A, B and C. Curiously, over the course of several throws, die A beats die B, while B beats C, while C beats A!

Common sense tells us that die C should not beat die A, because we have a notion that if A is better than B, and B is better than C, then A should be better than C. Mathematicians calls this usual relationship transitive. Consequently, the dice that defy this rule and instead obey the laws of RPS are called non-transitive dice.

Here are the faces for one possible set of three non-transitive dice. Each die has three numbers, each one repeated to cover the six faces.

Die A -3, 3, 5, 5, 7, 7

Die B - 2, 2, 4, 4, 9, 9

Die C - 1, 1, 6, 6, 8, 8

So what happens if you play die A against die B? If A shows a three, then it will win 1/3 of the time. If A shows a five then it will win 2/3 of the time. And if A throws a seven then it will again 2/3 of the time. Hence, on average A beats B 5/9 of the time.

Similarly, we can analyse die B played against die C. If B shows a two, then it will win 1/3 of the time. If B shows a four then it will win 1/3 of the time. And if B shows a nine then it will win 3/3 of the time. Hence, on average B beats C 5/9 of the time.

Finally, we can play die C against die A. If C shows a one, then it will win 0/3 of the time. If C shows a six then it will win 2/3 of the time. And if C shows an eight then it will win 3/3 of the time. On average C beats A 5/9 of the time.

Curiously, the numbers of the three dice form the rows of a magic square. Indeed, another set of non-transitive dice can also be constructed, by using the numbers in the three columns of the same magic square.

6, 1, 8

7, 5, 3

2, 9, 4

This discovery of mathematical RPS dates back to the 1970s, and it has been used by mathematicians ever since as way of paying their rent. Typically, a savvy mathematician might go into a bar, show how die A beats die B and how die B beats die C, and then he challenges drinkers to a game of highest number wins. Every opponent picks die A, which appears to be the superior dice, but the crafty mathematician then wins by picking dice C.

Keen to come up with an even cleverer set of non-transitive dice, Bradley Efron of Stanford University developed sets of four dice, whereby every die could be beaten by at least one other die. The advantage of these sets of four dice is that they can offer a greater chance of winning on each throw and therefore a bigger profit margin.

Die A - 0, 0, 4, 4, 4, 4

Die B - 3, 3, 3, 3, 3, 3

Die C - 2, 2, 2, 2, 6, 6

Die D - 1, 1, 1, 5, 5, 5

Die A beats B 2/3 of the time, B beats C 2/3 of the time, C beats D 2/3 of the time, and D beats A 2/3 of the time.

Even better, Allen J Schwenk of Western Michigan University discovered a set of three non-transitive dice that exhibit a very peculiar (and useful) property. The dice have the following faces:

Die A - 1, 1, 1, 13, 13, 13

Die B - 0, 3, 3, 12, 12, 12

Die C - 2, 2, 2, 11, 11, 14

First, as before, if your opponent picks any die, then you can always pick one that beats it. However, if you are forced to pick first and your opponent happens to then pick the better die, then a slight rule change still gives you the edge. Just play the game such that each die is rolled twice and it is the highest total that wins. Bizarrely, your inferior die suddenly becomes superior.

If you happen to bump into a mathematician in a bar playing non-transitive dice, then you might want to fight back by offering a game of extreme rock, paper, scissors, which has the added twist that the winner of a bout can punish the loser by using their winning hand. A winning rock leads to a punch, a winning paper to a slap, and a winning scissors to a poke. This adds immense complexity to the game. The mathematician might be tempted to offer rock rather than scissors as it will allow a punch rather than a poke if it wins, but a skilled opponent will anticipate this and offer paper, which defeats the rock and allows a slap in return.

Perhaps such retaliation might help restore some integrity and decency to the ancient game of RPS. The Romans, who played micare digitis (flash the fingers), used to say of an honest man: "Dignus est quicum in tenebris mices", which meant that he could be trusted to play RPS in the dark.

· Simon Singh is a writer and broadcaster. His latest book, Big Bang, a history of cosmology, is published this month by Fourth Estate at £20. To buy for £18.40 with UK p&p call Guardian Book Service on 0870 836 0875 or go to guardian.co.uk/bookshop