# How many rectangles are in this image? [closed]

Entering 30 characters is quite a lo • Please don't use JPG for non-photographic images. Mar 15 '18 at 11:22

Assuming that

a pixel counts as a rectangle,

there are

14460060000 rectangles. That is the count of various sized rectangles in a grid of 600 x 400 rectangles. For example, there are $1152 = (600-589+1) \times (400-305+1)$ rectangles of size $589 \times 305$.

• I have an LCD, so all my pixels have three(?) subpixels. Wouldn't that change the number? Mar 15 '18 at 13:57
• @Alexander, this is a logic puzzle, so it's fair to assume we're talking about logical pixels, not physical ones ;-) Mar 15 '18 at 14:09

I will say that there is:

240000 rectangles. The image is 600x400 pixels, and since squares are a kind of rectangle, I'm going to go with that. I'm thinking its going to be more complex than that though.

Using a formula I found on a different question, the amount of rectangles found on a grid m wide and n tall is equal to mn(m+1)(n+1)/4. This gives us an answer of 14460060000 rectangles on a 400x600 grid.

• That can’t be it. A group of two or four squares still forms another rectangle Mar 15 '18 at 11:13
• Yeah, that is what I was thinking. I'm gonna try something Mar 15 '18 at 11:16
• I know, I accidentally deleted the edit the first time too! Ill get him next time :P Mar 15 '18 at 11:27
• All squares are rectangles, but not all rectangles are squares. So I would argue that a rectangle isn't a specialised case of a square. Mar 15 '18 at 11:30
• @ShinjiWins well we can apply all the same formulae of a square to a rectangle, and vice versa. Say the rectangle has length $a$ and width $b$ then area is equal to $ab$. And volume is equal to $abc$ if the rectangle had some depth $c$. And surface area of a rectangle in three dimensions would be $2(ab + bc + ac)$. We can apply the same formulae to a square, but for the shape to be a square in the first place, $a = b = c$. It seems like all rectangles can be squares if we just change the sign from being $\neq$ to $=$. Mar 15 '18 at 11:34

Well... I will say...

Zero? None of the red shapes is a real rectangle. If you focus you can see some orange rectangles flashing inside the red shapes but that is just optical illusions.

With the lateral-thinking tag I have another answer:

240 000, the total number of pixels of this image (600x400), a pixel is a square, and a square is a rectangle.

• It's the JPG compression. One should never use JPG for non-photographic images. Mar 15 '18 at 11:21

I think it is:

1 the image itself is a 1 giant white rectangle.

• exactly what i thought Mar 15 '18 at 11:20

Combining both the answer from Shinji Wins & Mhmd, one might conclude:

It has 240001, 240000 for the amount of pixels and one for the entire picture

There are as many rectangles as the meaning of the question will allow. So the answer is anything between 1 (the whole image) and infinity (if we allow the set of all possible rectangles which could be fitted in the bounding rectangle).