If the chosen integers are a and b, then the sum of the squares will be ab.

This is almost obvious if you think about the problem geometrically. Start with a rectangle whose sides have lengths a and b, with a<b say. Chop off a square of side a from one end of this rectangle, leaving a smaller rectangle (with sides a and b–a). Chop off a square from one end of this rectangle, and continue this process until the whole original rectangle has been chopped up into squares. Clearly the sum of the areas of these squares will be the same as the area of the original rectangle.

The diagram illustrates this process with a = 7 and b = 11.