# Generalizing patterns

Once we have recognized our pattern, we need to go through **pattern generalization** and **abstraction**. That is, we want to make sure that the solution we come up with can be used for multiple instances of the problem we have identified. Pattern generalization can be something as simple as writing a basic linear mathematical algorithm, like we did for the cost of a party, where the cost per child was $12. So, the cost for any number *k* of children would be given by 12*k*. But pattern generalization can be much more than that.

If we go back to *Problem 1*, where you could choose $250 or you could choose your height in quarters, our pattern **generalization** would allow us to check for anyone's height against the $250 in order to determine whether you would get more money by choosing the cash option or by choosing the quarters.

**Abstraction** lets us focus on the things we need and discard things we do not need in order to create the best algorithm for our problem. Now...