Generally speaking, most puzzles that are written are intended to be answered using the minimum number of assumptions possible to arrive at the correct solution. William of Ockham first stated this principle as a guideline, commonly known as Occam's Razor. The exceptions to this principle are those that are trick questions, which are usually worded in a way that suggest that the immediately obvious answer isn't correct, or appear as an optical illusion of some sort.
Even questions that are trick questions generally have one correct answer; we can arrive at the suitable solution by way of Occam's Razor as well. The types of problems that we are given in school textbooks, for example, all abide by Occam's Razor; the intent is to prove critical thinking and analysis skills, not "thinking outside the box" skills (a sad truth, really, as we'd do much better as a society if the latter were true).
This puzzle, and others along the same vein, are generally meant to invoke critical thinking; find the correct answer with the minimum number of assumptions necessary to solve the problem. The question is asking is to find the number of squares, a square being defined as a closed object with four sides, with each side meeting at 90 degree angles, and each side being the same length.
For example, this Stock Photo shows a square window; it's mentioned as such in the description. The fact that it contains four smaller squares is irrelevant here; most people will naturally state that this is a square window (note, I didn't actually measure it, so it may not be perfectly square, but it appears as such, and we'll take it at face value for purposes of this discussion). This window actually has five squares; the frame plus the four smaller squares from the lattice that reinforces the glass.
Since the question doesn't state that any of the squares are floating or are in any other way special, and since the question also doesn't appear to be an optical illusion, such as this optical illusion question, we can apply Occam's Razor to come up with the obvious solution.
Using Occam's Razor, we can state the following "truths" about this image:
- Each angle in the image appears to be 90 degrees.
- Each line in the image appears to be unbroken, and can thus participate as a side in a closed object that has four corners connected at 90 degree angles and may either be a rectangle or a square.
- The lines for the offset squares in the middle of the grid appear to be the same length as any of the other 1x1 squares in this grid, and their vertices appear to land exactly in the middle of the squares in the grid.
Assuming that this question isn't an optical illusion, which it clearly does not appear to be, the obvious solution to the question is 40. We arrive at this answer by enumerating all of the squares of various sizes and adding them together.
- 1 square for the outside border of the square grid $(4\times 4)$
- 4 squares that are 9/16th the entire size of the square grid $(3\times 3)$
- 9 squares that are 1/4th of the entire size of the square grid $(2\times 2)$
- 18 squares that are 1/16th of the entire size of the square grid $(1\times 1)$; the 16 aligned in a grid plus the 2 that are overlaying the grid.
- 8 squares that are 1/64th of the entire size of the square grid $(0.5\times 0.5)$, caused by the offset squares being bisected by the grid lines.