### Solving problems by logic

Feb. 16th, 2009 03:38 pm___

Lets start with a simple problem. A friend tosses a coin, it lands on the table out of sight, you can hear it roll, and then stops. The friend places a hand over the coin so you have no chance of seeing it, then asks you "Which side up did it land?"

This is a problem for which deductive logic applies. For a given set of assumptions*, a single question will deduce the answer for you "Did it land tails up?".

Regardless of whether the answer is yes or no, this is deductive logic. Probably clearer if the answer was "no", because at this point you have eliminated all the options bar one. This one must therefore be the answer.

But does it. Lets come back to those set of assumptions from further up. There are facts that you are assuming. You're assuming the coin has just two sides, and that they are different. You're assuming that there was no possibility for the coin to land on an edge still, or for something else to happen. I did rather imply these at the start, but they are still assumptions, as you don't have enough information.

What are

*not*assumptions though is the set of conclusions beyond the answer. Going back to the original problem, what if the question is wrong. Rather than asking "Which side up did it land?", what if the question were "Which side up is it now?". These may seem trivially the same in isolation, but I hope you can see the significant difference. Valid questions may also include "Where is the coin?", and "Which way up is the coin under my hand?".

For these other questions, you have to consider a somewhat wider set of variables. If the coin were a British 2p coin which you had provided, several options can be eliminated. The question of the fairness of the original coin can be eliminated, you provided it, and you probably know that it has one head and one tail. Assuming it's a 2p, it's probably reasonable to be able to conclude whether it's likely on it's edge from the shape of the hand. If it's near flat on the table, (and assuming the coin is still there), then it must be flat.

That last one brings up the next point, which is whether the coin is still there. Most games of chance require some degree of reveal, so for those you can probably assume the coin is there, although it may have been tampered with. I'm not going to go into the variables required to answer the question "Where is the coin now?", as I hope you can see they get very, very large.

Luckily, the original problem is pure deductive logic. You heard the coin land, and you heard it roll to a stop. Therefore, there are but 3 possibilities, each side (lets use heads and tails, I realise this may not be fair), or the edge. The edge has been eliminated by the question. The questioner asked for "which side", so it wasn't the edge. A single question can then solve the problem.

The means of solving deductive logic was well phrased by Sherlock Holmes, in The Blanched Soldier, by Sir Arthur Conan Doyle. Holmes stated "When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.", and whilst very true for deductive logic, isn't so good for inductive logic.

The game of Mastermind (the one with the pegs and the holes, not anything else, and certainly nothing to do with a black chair) is a game of deductive logic. You have a limited set of parameters to work with, and there's no game options for working outside those parameters. The parameters may not be understood by all, but they are there none the less. It is possible to calculate the maximum number of moves required to solve a game of mastermind for a given set of rules. If you're playing say with 2 holes, which must be filled, and but one peg colour, there is only 1 solution. For two peg colours, there are 4 solutions (00, 01, 10, 11), and if the rules are just "correct" or "incorrect" marking, it will take no more than 3 guesses. As this expands both in number of holes, colours and complexity of the marking scheme, I hope you can see how an optimal solution can be found.

Yet as much as Sherlock Holmes might have wanted it to be true, a lot of life's problems are not deductive. Interpreting a simple sentence "Fruit flies like a banana" (Thank you

**luckykaa**) is inductive. It could mean that when throwing fruit it all travels rather like a banana does, it could be refering to the dietary preferences of the fruit fly, or one of a number of different things. When written as C code, it could be remapped into a program to calculate pi probably (I'll admit to not being able to program in C, but having seen poems compile, I'll believe anything). It could mean multiple options. There are not a limited number of options, and as a result, it's never possible to be entirely sure what was meant.

So while both Doyle and Holmes were brilliant men, Holmes wasn't entirely right, and the world is more complex for it.