How to find the first same-proportion rectangle(s) whose both sides are also whole numbers?

807 Views Asked by At

Let's elaborate the issue with an example:

I have an arbitrary rectangle. Let's choose the rectangle to be $5.6 \times 4.2$. The width-to-height ratio is $\frac 4 3$. The rectangle is in between the two whole-numbered rectangles of $4 \times 3$ and $8 \times 6$, both having the same ratio.

issue-depicted

So, given an arbitrary rectangle, how do I find (if any) the closest* rectangle(s) whose sides are both whole numbers and also has (have) the same ratio?


* By closest, I mean the rectangle(s) whose sides have the same ratio, and both sides have a whole-numbered length that are the first possible whole numbers that form such a ratio.

3

There are 3 best solutions below

8
On BEST ANSWER

In general, a whole-numbered rectangle with the same ratio exists only if the ratio of width to height is a rational number.

Let's focus on rationals. You have a rectangle with a ratio of $p:q$ where $p,q\in\mathbb Q$. Since $p,q$ are rationals, you can write them as $p=\frac mn$ and $q=\frac op$.

You are looking at the set of all whole-number rectangles with with-to-height ratios of $\frac{p}{q}$. This would be equivalent to the set $$\{(n_1,n_2)|\frac{n_1}{n_2}=\frac pq\}$$

which is the same as

$$\left\{(n_1,n_2)\left|\frac{n_1}{n_2}=\frac{\frac mn}{\frac op}\right.\right\} = \left\{(n_1,n_2)\left|\frac{n_1}{n_2}=\frac{pm}{on}\right.\right\} $$

clearly, one such rectangle one with a width of $pm$ and height of $on$. In general, however, you can simplify the fraction $\frac{pm}{on}$ to get the smallest integer rectangle $(r_1,r_2)$, and then you can show that every rectangle must be of the form $(kr_1,kr_2)$ for some $k\in\mathbb N$. Therefore, if the sides $r_1,r_2$ are smaller than the sides of your triangle, it is possible to find what you are looking for. Otherwise, it is not.

4
On

For this to be possible, sides must be rational numbers (other than the case when sides are multiples of same irrational like $\sqrt 2,2\sqrt2$). Then suppose you have the sides as $a\over b$, $c\over d$, where $a,b,c,d \in Z$ and $b,d \neq 0$.

Suppose the simplest form representation of these fraction itself is $a\over b$ and $c\over d$. Then integral sides will be obtained by multiplying both numbers by lcm of their denominators, that is, say, $bd$.

So we get the sides $ad,bc$. But these may not be simplest as $a,c$ ie the numerators of original sides may have some common factor. So you need to simplify the sides $ad,bc$. This can be done by dividing both by their hcf.

Eg. In your case, we see the sides are $\frac{56}{10}$ and $\frac{42}{10}$. These can be written as $\frac{56}{10}$ and $\frac{42}{10}$. So we multiply them by lcm of their denominators, that is $10$ to get the sides $56$ and $42$. Now we divide both by hcf of these numbers to get $4,3$

1
On

General algorithm

Let's say we start from a rectangle with side lengths $w$ and $h$ (in your case $w=5.6$ and $h=4.2$). Now you try to express $w/h$ as a rational number $p/q$ with $\gcd(p,q)=1$. In your case we have

$$\frac{5.6}{4.2}=\frac{56}{42}=\frac{\color{red}2\cdot 2\cdot 2\cdot \color{blue}7}{\color{red}2\cdot 3\cdot \color{blue}7}=\frac{2\cdot 2}{3}=\frac 43.$$

So we have $p=4$ and $q=3$. Define $\alpha=w/p$. In your case we find $\alpha=5.6/4=1.4$. Then compute

$$\check w = p\cdot \lfloor \alpha\rfloor = 4\cdot \lfloor1.4\rfloor = 4\cdot1 = 4, \qquad \check h = q\cdot \lfloor \alpha\rfloor = 3\cdot \lfloor1.4\rfloor = 3\cdot1 = 3, $$

$$\hat w = p\cdot \lceil\alpha\rceil = 4\cdot \lceil 1.4\rceil = 4\cdot 2 = 8, \qquad \hat h = q\cdot \lceil \alpha\rceil = 3\cdot \lceil 1.4\rceil = 3\cdot 2 = 6. $$

and so we found your nearest rectangles $(\check w,\check h)=(4,3)$ and $(\hat w, \hat h)=(8,6)$. And this works in general.