1

How many different rectangles can be seen in an $$ n \times n $$ grid like the one shown? Of course the rectangles must be at least one box wide and deep, and squares are allowed. https://i.stack.imgur.com/xHdVr.jpg

I'm ask for a help hand. greetings.

user180834
  • 1,453

2 Answers2

3

$\binom {n+1}2^2$

Let the rectangle be defined by its top-left point ($x_1, y_1$) and bottom-right point ($x_2, y_2$) such that $0 \le x_1 < x_2 \le n$ and $0 \le y_1 < y_2 \le n$. The number of ways to pick such pairs of $x_1, x_2$ is $\binom {n+1}2$, and ditto for $y_1, y_2$.

Irvan
  • 2,208
1

Such a rectangle can be specified by choosing the $x$ coordinates of the vertical sides and the $y$ coordinates of the horizontal ones. In other words, choose integers $x_1,x_2,y_1,y_2$ such that $0\le x_1< x_2\le n$ and $0\le y_1< y_2\le n$. How many ways are there to do this?

Mike Earnest
  • 75,930