Sunday, October 31, 2010

Naughts and Crosses

Owing to a debate at home regarding the age old game of Naughts and Crosses I decided to do a statistical analysis of the game itself. My initial premise was that the person making the first move is at an advantage and the analysis seems to validate this. Admittedly, I just analyzed the first six moves as most games are decided by that time (truth is I got lazy after 6 rounds of iteration :-) )
Maths Alert:

If you are easily nauseated by mathematical models and concepts or are below 100 years of age then please stop reading here.

Since you have not stopped reading I sincerely pity you but anyways here are the mundane details

1) The first question to be answered of course is how many moves are possible in the game itself. Simple math tells us that the number of ways two symbols (X and O) can be arranged in 9 positions is given by 2^9 which is 512. As usual, simple maths is not sufficient as we have to take into account the rules of the game which says that the symbols "X" and "O" must be placed alternately thus invalidating many of the combinations calculated by the mentioned method. I looked at it from a different perspective and realized that the game would involve 5 "X"s and 4 "O" upon conclusion. Thus the number of ways in which 5 "X"s can be placed in 9 places is 9C5. This is 9!/(5!*4!) = 126. The remaining 4 positions can be filled by 4 "O"s in 1 way. Thus the total number of combinations possible is 126

2) Looking at the layout, it becomes apparent that there are 8 possible routes that spell victory (Figure 1). Thus the possibility that a "X" or "O" is placed on a path that may lead to victory is 8/126 = 0.06


Figure 1

3) Now the fun part :-).
For each possible moves there is a possibility that the placed symbol may lie on a number of "success" paths. Looking at the best case and worst case scenarios in each case we come up with the following:
For the first move by Mr "X" he can opt to put an "X" in positions that put the symbol on a path that is common to 4, 3 or 2 success paths. Taking the best case and worst case scenarios which look like Figure 2 we end up with probabilities of 0.24 (4*0.06) or 0.12 (2*0.06)








Figure 2

4) Now Mr "O" also has best case and worst case scenarios depending on what Mr "X" has done and we end up with the following scenarios (Figure 3)







Figure 3
The corresponding best case and worst case probabilities are therefore 0.18 and 0.06

5) Repeating this iteratively for 4 more moves we end up with the following scenarios (Figure 4)






Figure 4

The following table presents the Best Case and Worst case probabilities for each move and then sums up the probabilities for Mr "X" and Mr "O". The average overall probability considering equal weightages for Best case and Worst case scenarios is then calculated.

















6) My conclusions
a) The person beginning first has a 28.5% chance of winning
b) The person going second has a 24.5% chance of winning
c) Overall there seems to a 47% chance of a draw

NOTES: Please find below some of the answers to the questions that this blog article may prompt you to ask me.

1) Yes, I have a life
2) I do have a job
3) There was no point in doing this
4) You shouldnt bet money on this analysis
5) Oh Yeah?
6) Same to you.

:-)

Cheers
Sam

Sunday, October 3, 2010

Beware of Logic

I have recently realized that many of the morons I have encountered over the years are not to be blamed for their condition. Under normal circumstances, it seems that everyone has a preference to think logically (or at least try). So why is that, that an overwhelming majority still believe in God, Astrology, Birthstones and the like? The root cause of this seemingly contradictory behavior lies in a flawed sense of logic. Though most people would like to think logically, the very definition of logic seems to take on different colors for different people and as is obvious, most have no idea what logic really implies. I have tried to analyze some of the common fallacies that I have come across and I am pretty sure most of you would have encountered the same.

1) Burden of Proof – This tops the chart by a long shot and I have come across this in the context of practically every supernatural phenomenon you can think of ranging from God to gemstones. The premise is simple. The person holding the viewpoint is convinced that because I am not capable of proving that the thing being discussed does not exist, hence it must exist. To them this seems perfectly logical. Unfortunately, logic dictates that the “Burden of Proof” lies with the one holding the belief and thus unless someone can prove that God exists, logically it does not. There is no way to prove that something does not exist.

Invoking reductio ad absurdum, let’s say I say that I believe that there exists a three headed lion that can breathe under water and talk like a human. Can anyone prove to me that it does not exist and hence I conclude that it must exist? Seems silly now doesn’t it?

2) Appeal to tradition/popularity – This is the lazy mans definition of logic. The central premise of this is that if something has been going on for generations or is endorsed by a majority of the people then that is a necessary and sufficient cause to prove its validity. The fallacy here is that the age of a belief or the number of people following it has no correlation to its validity. Traditionally, we had believed in Earth being the center of the solar system, the earth being flat, speeds beyond 25 mph are lethal, diseases being caused by witches and demons and now we all know how these went. There is perhaps a link to this kind of logical fallacy and the natural tendency of people to shy away from anything new.

3) “Post hoc, ergo propter hoc” and Relativist Fallacy - Post hoc, ergo propter hoc literally means ”After this, therefore because of this” and this seems to be the root cause of many superstitions. This logical fallacy is ascribing cause and effect simply on the basis of when events occurred. Someone may have bought a lucky charm and after a month something happened and hence the conclusion is reached that the charm must have something to do with it. This is similar to someone jumping in India and an earthquake in California that happens a month later being described as cause and effect. Relativist fallacy is typical escapism. The idea here is that the truth is subjective. This typically comes up when a person has to admit that he/she is logically incorrect but then goes on to say that he/she has personally experienced something or “believes” that something is correct. This stems from an individual’s reluctance to give up long held beliefs and they find it easier to find escapism by making truth subjective and they conclude that they somehow fall outside the purview of what is logical.

I find this to be rather interesting, because it shows that most people would like to justify their beliefs and that is a good sign. The only problem being then is that what they deem as logic is unfortunately not so. A classic example is perhaps the belief in Astrology. Ancient civilizations found out that they could observe the motion of stars across the sky to predict seasons and that was invaluable to them for deciding when to plant crops and when to harvest etc. Thus to them it was also “logical” to assume that if the stars could influence the seasons then they were also bound to have some effect on human lives and destiny. Thus the belief in astrology started.

The fallacy here is obvious. The seasonal changes are actually caused by the rotation/revolution around the sun and the position of the stars have no role to play. Let me assure you that meteorologists can predict the monsoons accurately about a week in advance and they are not star gazing. So, we have stopped relying on the stars for predicting seasons but we still hold on to the secondary belief of them influencing us? Hilarious to say the least. Maybe logic should be made a compulsory subject in schools. The least we owe to the future generations is to give them the right to decide for themselves what is fact and what is fallacy.