“Wisdom accepts that all things have two sides.” [Carl Jung]

## Abstract

If you like to solve problems in a structured way you should first read George Pólya’s book “How to Solve It”.

Pólya focused mainly on mathematical problems but we can apply his principles in general.

## Pólya’s Principles

Pólya differentiates between 4 simple principles of problem solving in his book.

Let us look at his principles with a practical example at hand:

#### Example:

Convert a decimal number into its binary representation with Microsoft Excel.

### 1. Principle - Understand the Problem

First we need to understand the problem: Read and rephrase, visualize.

What is the unknown, what is the target?
Can we rephrase the problem with our own words?
What is the condition?
Is the condition sufficient to determine the unknown?

#### Example:

Given is an arbitrary decimal number. We look for its binary representation. Unfortunately the condition does not suffice to determine the unknown in general.

On one hand this is caused by Excel’s limitations:

• 15 digits are the maximum limit of Excel’s number precision.
• The smallest allowed negative number is -2.2251E-308.
• The smallest allowed positive number is 2.2251E-308.
• The largest allowed negative number is -9.99999999999999E+307.
• The largest allowed positive number is 9.99999999999999E+307.

We can push these limits by far if we represent decimal numbers and binary numbers with strings. The total number of characters that a cell can contain is 32,767 characters. This still is not sufficient for a general solution but it should cover all existing numbers in practical use.

On the other hand a challenge is on the representation:
Negative binary numbers are normally represented by a two’s complement. The leading digit is the sign (0 = positive, 1 = negative). For decimal places of variable length we cannot derive a two’s complement. We need to stick to a fixed-point representation or we restrict the conversion to positive decimal numbers. Good thing is this would not restrict the solution: We could introduce an additional sign ('+' and ‘-') and thus get rid of the restriction.

### 2. Principle - Devise a Plan

Next step is devising a plan: Remember and repeat solution approaches and definitions.

For which similar problems do we know solutions?
Can we divide the problem in smaller parts?
Which dimensions stay unchanged?
Are the dimension units correct?
We always go from unknown to the solution.

#### Example:

Excel has a built-in function DECTOBIN but this function is limited to integers from -512 to +511 and decimal digits will be ignored.

So we need to implement the conversion of decimal numbers represented by string on our own. These user-defined-functions are of help:

• sbBinNeg - Calculate the two’s complement of a binary number.
• sbDivBy2 - Divide a positive decimal number by 2.

### 3. Principle - Carry out the Plan

Now we carry out our plan.

We check each step thoroughly.
Can we prove that each step is correct?
Is the description of our solution comprehensive?
Which important insights did we gather?

#### Example:

See the implementation: sbDec2Bin.

### 4. Principle - Look Back

Finally we need to examine our solution obtained.

Can we check the result? Can we check the argument?
Can we derive the solution differently? Can we see it at a glance?
Can we use the result, or the method, for some other problem?

#### Example:

We notice that we cannot avoid inaccuracies. We cannot implement periodical representations in the binary system (the decimal number 0.1 has no finite binary representation, for example). And we are facing necessary cut-offs of decimal places because of limited numbers of digits.

Note: The IEEE Standard 754 was introduced to deal with such inaccuracies. But we cannot avoid them completely.

## Literatur

Polya, G. (2004). How to Solve It.