Count probability of getting rectangle

57 Views Asked by At

Suppose we have a grid of squares with n rows and k columns. I need to find the probability of getting a rectangle upon selecting 4 squares such that they form a rectangle. example - in a grid of size 4 rows and 3 columns, selection of (1,1) (1,3) (3,1) (3,3) is a valid selection

2

There are 2 best solutions below

3
On BEST ANSWER

Determining the number of ways to form a rectangle

We choose $2$ (different) rows out of $n$ and $2$ (different) columns out of $k$. Their intersections are the vertices of the rectangle.

So, assuming there are $n$ rows and $k$ columns, there are

$$\binom n2\cdot\binom k2=\frac{n(n-1)}2\cdot\frac{k(k-1)}2=\frac{n(n-1)\cdot k(k-1)}4$$

possibilities of forming a rectangle.

Determining the total number of ways to choose four squares

There are $nk$ squares, so the number of possibilities is

$$\binom{nk}{4}=\frac{(nk)!}{(nk-4)!4!}\frac{nk(nk-1)(nk-2)(nk-3)}{24}$$.

Probability

So, the probability is

$$\left(\frac{\frac{n(n-1)\cdot k(k-1)}4}{\frac{nk(nk-1)(nk-2)(nk-3)}{24}}\right)\\=\frac{6\cdot n(n-1)\cdot k(k-1)}{nk(nk-1)(nk-2)(nk-3)}\text.$$

1
On

You need to select two of the rows and two of the columns. This determines the four squares at the corners of the rectangle.