The Poyla Approach To Problem Solving

One of my mentors recommended that I read a book by Stanford mathematics professor G. Poyla titled “How To Solve It” and I’m going to take notes for you from the book.

First, we have to understand the problem. What is the unknown? What are the data inputs? Can you restate the problem in your own words? Can the unknown be determined from the data inputs? Is the data inputs sufficient to determine the unknown? Insufficient? Redundant? Contradictory? How should I label important pieces of data input that are a part of the problem? Draw a figure. Introduce suitable notation. Separate the various parts of the condition. Can you write them down?

Second, come up with concrete examples to help you understand the problem better. Find a connection between the data inputs and the unknown. You may be obliged to consider auxiliary problems if an immediate connection cannot be found. Have you seen it before? Or have you seen the same problem in a slightly different form? Do you know a related problem? Do you know a coding strategy that could be useful? Look at the unknown! And try to think of a familiar problem having the same or a similar unknown. Here is a problem related to yours and solve before. Could you use it? Could you use its result? Could you use its method? Should you introduce some auxiliary element in order to make its use possible? Start with a simple example. Could you restate the problem? Could you restate it still differently? Progress to more complex examples. What about examples with empty inputs? Any other edge case examples? What examples with invalid inputs? What is your updated plan here to find a solution?

If you still cannot solve the proposed problem, try to solve first some related problem. Could you imagine a more accessible related problem? A more general problem? A more special problem? An analogous problem? Could you solve a part of the problem? Keep only a part of the data inputs, drop the other part; how far is the unknown then determined, how can it vary? Could you derive something useful from the data? Could you think of other data appropriate to determine the unknown? Could you change the unknown or the data, or both if necessary, so that the new unknown and the new data are nearer to each other? Did you use all the data? Did you use the whole of the data inputs? Have you taken into account all essential notions involved in the problem?

Third, carry out your plan of the solution and check each one of your steps in pseudocode. If you can’t solve the problem, solve a simpler problem. Temporarily ignore the difficulty, write a simplified solution and then incorporate that difficulty back in. Can you see clearly that the step is correct?

Fourth, examine the solution obtained and refactor. Can you check your result? Can you check the argument? Can you derive the result differently? Can you see it at a glance? Can you make the code DRYer and refactor? Can you improve the performance? How have other people solves this problem?