Hierarchy and Leadership in Society

Water Melody
Creative Commons License photo: steve_steady64

I saw a really interesting use of game theory in last week’s New Scientist about the origin of leadership and I wanted to share it here.

Regular readers will know that I’ve written about game theory many times in the past: I find game theory to be a very elegant way of modelling human behaviour with many applications in economics and the social sciences.

This piece of game theory concerns the question of why hierarchy exists in society. Why do we have leaders? Imagine the following scenario. Let us imagine two people, Persons A and B, who both need to hunt in order to eat. They can choose from one of two forests to hunt in, but they must travel together for their protection.

Person A is familiar with Forest 1 as it is where he typically hunts. Person B is familiar with Forest 2: that is where he usually hunts.

Which forest will they choose to go to? Obviously each person will prefer to go to the forest that they are most familiar with and to hunt there: by doing this they maximise their own success (the “number of kills” and the amount of food they can bring back). The following diagram shows the payoffs:


9th open Archeon Longbow shoot
Creative Commons License photo: hans s

Person A knows all the ins and outs of Forest 1, so he’s an efficient operator. In Forest 1, Person A gets 3 “kills” but Person B gets 1 “kill” as he doesn’t know it at all.

If they both decided to travel to Forest 2, the opposite is true. Person B gets 3 “kills” as he knows the forest well, Person A only gets 1.

If Person A and Person B couldn’t agree on which forest to travel to, neither of them would bring back any food, let alone reach a forest, because they can’t travel unless they travel together for protection.

In the scenario, what would happen? Well, Person A would choose to travel to Forest 1, the forest he knows the most well. If he chooses Forest 1, he has possible payoffs of either 3 kills or no kills. If he chose to travel to Forest 2, he has the possibility of no kills or 1 kill. Conversely as the payoffs are opposite for Person B, he will choose to travel to Forest 2, his favoured forest.

The end result is that both people will attempt to travel to their own favoured forest and neither of them would have any food to eat.

Desert Leader
Creative Commons License photo: Hamed Saber

For society, the best solution is that both people work together to agree where they want to hunt (this way society as a whole gains food from 4 “kills”). However, for this to happen, one person must take a lead but someone else must agree to follow: somebody must accept a smaller payoff and a smaller amount of food than which he would have had if he was leader.

This illustrates the importance of hierarchy and leadership in society: without somebody taking the lead to make a decision and other people following, society would not function. Society needs a leader and a follower.

Natural selection might be expected to select the leaders. After all, they are more successful at hunting and perform better. But natural selection at the group level would favour groups which worked well together (as the game theory diagram shows, groups which have a leader and follower are more successful as a whole).

Probability Brain Teaser II

A few days ago I posted a probability brain teaser which was getting me in a spin.

A family has 2 children. When you knock on the door one of the children, a boy, opens the door. What is the probability that the other child is a boy?

There were many interesting responses and as I expected, I had a mixture of two answers: a third and a half.

That which gives an answer of a third

When I first told this problem over dinner, I was told the answer was a third. The explanation is as follows:

You know that a boy opened the door. That means there is at least one boy. So out of the four possible permutations: boy-boy, boy-girl, girl-boy, girl-girl only the first three are possible. You could essentially rephrase the question as “There are two children in the family and it is not the case that both are girls”.

In the three of the permutations which are now possible (boy-boy, boy-girl, girl-boy), only one gives two boys. So the likelyhood of there being two boys is 1/3rd. Hence, the probability of the other child being a boy is a third.

That which gives an answer of a half

My immediate response was that the gender of the two children are independent and that the gender of one has no bearing on the other.

I also pursued a different technique which also lead to the answer of a half. There are two children in the family: giving the possible combinations of boy-boy, boy-girl, girl-boy and girl-girl. The probability of each is 25% or 1/4.

There are three possible ways that could lead to a boy opening the door. If there are two boys in the family then a boy will most definitely open the door. If there is one boy and one girl in the family, the chance that the boy will open the door in each case is only a half.

I’ve illustrated this information in a probability tree diagram where the probabilities shown are cumulative.

Tree Diagram

The total probability of a boy-boy combination with a boy opening the door is 25%. The total probability of there being one boy and one girl, and a boy opening the door is also 25%.

The probability of a 1 boy, 1 girl combination is hence the same as the probability of 2 boys.

After thinking both of these arguments through, I can’t actually see the logical fallacy which exists in either. They can’t both be right however. It would be great to hear your thoughts once again!

A Probability Brain Teaser

A little probability brain teaser for all of you… I was given this last week and I’m still having problems working out what the answer is!

A family has 2 children. When you knock on the door one of the children, a boy, opens the door. What is the probability that the other child is a boy?

I’ve got an answer in my head but I can’t quite figure out which one is correct so it would be great to hear your thoughts on what you think the answer is!

Number Pad Layouts

Has anyone ever noticed how telephones have 123 on the top row whilst calculators have 123 on the bottom row?

According to How Stuff Works, the calculator layout with 123 at the bottom actually came first.

One theory was that touch tone telephone  engineers reversed the layout deliberately so data entry professionals, who were used to the calculator layout, would take a greater amount of time to enter the numbers. This was necessary as the tone recognition in old telephones wasn’t fast enough!

Thought Experiment II

I recently posted a thought experiment where you had to try and find 2/3rd of the average number.

I said that you can assume people’s guesses are uniformly distributed. I think that’s a reasonable thing to assume, and hence the average of all the numbers chosen would be 50. 2/3rd of 50 is 33.

Simple enough, but everybody else also knows this; they’ll all choose 33. But if everyone else chooses 33, 2/3rd of the average is actually 22. And so on… the logical answer to choose would be 0.

This question links to game theory, where mathematics is used to try and discover the behaviour of individuals where the behaviour chosen will depend on the behaviour exerted by other people. In some ways, this can also be a criticism of economics – economics makes certain assumptions which would predict everyone would choose 0. But in the real world, it is unlikely everybody would choose 0.

Another one 

One of my friends sent me this: “I’m going to give you £500 on a certain day this week but you won’t know it’ll be that day in advance.”

You can’t get the money on Saturday because if you haven’t received £500 by Friday, you’ll know the money will come on Saturday (the last day of the week). But it can’t be Friday either; if you haven’t received the money by Thursday, you’ll know that it’ll come on Friday. And so on.

Thought Experiment: Choose a Number

Just a thought experiment. I’ve got a thousand people and I ask them all the following question:

“Choose a number between 0 and 100. The aim is to choose a number which is two-thirds of the average choice.”

A reasonable place to start would be to assume that everybody else randomly chooses a number anywhere between 0 and 100. Assuming a uniform distribution, the average of all the numbers chosen would be 50. Therefore you should choose the number that is two-third of that, which is 33.

What’s the possible flaw?

PHP Fractal Generator

I was bored so I thought I’d write a PHP script to generate fractals (like you do). The Mandlebrot set is probably the most well-known fractal so I chose to write a script to generate fractals using the Mandlebrot set:

This is a 500×500 fractal plotted for x (real) values between -1.5 and 0.5 and y (imaginary) values between -1 and 1.

How it Works

The mathematics behind the mandlebrot set involve:

  • complex numbers (x+yi)
  • quadratics
  • argand diagram
  • limits

A complex numbers consists of a real component and an imaginary component. i is the square root of -1. A complex number could look like 3+2i, where 3 is the real component and 2 is the imaginary component.

An argand diagram is like a two dimensional number line. With normal real numbers, we can plot them on a one dimension number line, with negative infinity on one end, and positive infinity on the other end. Because complex numbers have an imaginary component too, we need a two-dimensional plane to plot the number.

The Mandlebrot set involves iterating through a sequence:

In words: the first value in the sequence is 0. To find the next value in the sequence, we square the current value and add the complex number (which is the variable). Depending on the input, the sequence will either tend towards infinity or it will remain bounded and oscillate/repeat. If the sequence remains bounded, then it is inside the Mandlebrot set. On my script, I’ve marked these pixels as black.

For those values outside the Mandlebrot set, we use colour to denote how long it takes to reach infinity (in fact we use a shortcut and stop when |z| > 2).

Quadratics come in when we square a complex number – you can just square them as you would with any other quadratic. However, i^2 = -1.


I think it’s pretty amazing how we can generate infinitely complex patterns using such simple mathematics. There is probably only about 10 lines of mathematics in the script; the rest is all PHP/image stuff.

A few notes:

  • The script is pretty server intensive. The source code I’ve provided is configured to produce a 100×100 image by default. This took 2 minutes to execute on my machine, but 5 seconds on my friends machine. Both of them are roughly the same spec. Your mileage may vary.
  • If you try to generate an image with too many pixels, your PC may crash. You have been warned 🙂
  • Try changing the x/y min/max values to zoom or to pan.
  • Feel free to hack the script, rip it apart or do whatever you want with it. It’s public domain.

Pi Day

It’s Pi Day tomorrow! March the 14th, or 3/14 as written in the American MM/DD date format. This is of course a worldwide celebration of the mathematical constant which is the ratio of the circumference of a circle to the radius.

Ideas to celebrate Pi day:

  • Pi recitation contest. I reached 55 digits once but I’m currently down to 40: 3.1415926535897932384626433832795028841971
  • Pie eating contest (first you have to measure the circumference and radius of the pie to ensure that it is a perfect circle).
  • Hypnotise yourself on YTMND.
  • Allow your computer to celebrate pi day by making it calculate 256 million digits of pi!
  • Watch the film Pi.

A few facts:

  • In the movie The Matrix Reloaded, 314 seconds is "the length and breadth of the window" which Neo has to reach the "source" of the matrix.
  • In the Star Trek episode "Wolf in the Fold", when the computer of the Enterprise is taken over by an evil consciousness, Spock tells the computer to figure π to the last digit, which incapacitates the entity as all computer resources are devoted to this impossible task. (obviously the USS Enterprise doesn’t have dual-core technology. Could a forkbomb take down the USS Enterprise?)
  • In Time Warp Trio, Sam shuts down a threatening robot by telling it that his number was π.

Have a good Pi Day!

The Book of Nothing

I’ve just completed The Book of Nothing by John D. Barrow, which as you may guess is a book about nothing. The book is really divided into two parts – the first describing the history of the number zero in maths and the second looking at nothing (the vacuum) in science.

The book looks at different numeral systems and the advent of the number zero. It took a surprisingly long amount of time for zero to appear – to have a digit which represents nothing.

The first half of the book goes into a lot of detail about how number systems evolved in different cultures – roman numerals, "modern day" arabic numerals, and numbers in different base systems (e.g. Mayans and base 60).  

There’s a lot of stuff to get you thinking. I particularly liked the Zeno paradox. It goes a bit like this:

There is a man and a turtle. The man walks at 400 metres per hour. The turtle walks at 40 meters per hour.

The turtle starts the race 400 meters in front of the man.

By the time, the man has travelled 400 metres, the turtle will have travelled 40 meters so will be 40 meters ahead.

The man travels another 40 metres, but by then the turtle is 4 meters ahead.

The man travels another 4 metres, but the turtle is 0.4 meters ahead.

And so on…

The man can therefore never overtake the tortoise.

The trick of this paradox is that we’re tending towards a certain point (444.44m) in increasingly small amounts. We can iterate the above statements an infinite number of times, each time the difference in length tending towards zero.

The second part of the book focuses on zero or nothing, in science. It talks about the vacuum and the ether in history, but goes on to discuss "vacuum energy" or dark energy, and how it can answer some of the fundamental questions about our universe.

This book combines a lot – mathematical history, religious philosophy and scientific theories. Barrow goes to quite a bit of length to try and show the beauty of zero and mathematics – there are quotations and poetry dotted all over the place. 

I personally found the first half of the book much more interesting than the second; the end of the book was quite technical and the book lost me a few chapters before the end. Which half of the book you enjoy will probably depend on your own area of interest, but this is certainly a book of two halves.

An enjoyable and interesting book.

Maths Laughs

I recieved these off a friend (source unknown) and I couldn’t resist posting them.


If you’re still with me, terrible maths joke:

Q: What is the volume of a pizza with radius z and height a?

A: pi z z a 

And I got this one off a university graduate. I was sat there stone faced when he told me it.

There is a maths party and all the functions are invited to it. Sine, cosine, log e^x and everybody else is there. During the party, cos notices that e^x is in the corner, by himself. Sp cosine walks up to e^x and asks him: "Why don’t you come and integrate with everybody"? e^x replies, "I can’t, I only integrate with myself". 

Yep, terrible – be glad I didn’t post HTML jokes!