Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an area of $A = 320 \times 480$. I then have a number of rectangles of max size $128 \times 152$ which need to fit into the area. There can either be $1$ rectangle or $100$ rectangles. How would calculate the size that the rectangles need to be to fit into the given area?

Thanks in advance.

share|cite|improve this question
Can you see how $100$ $32\times48$ rectangles would fit? – Gerry Myerson Feb 11 '13 at 8:51
What would that equation look like if I may ask? – Cam Feb 11 '13 at 9:03
What equation? --- I'm talking geometry, not algebra. Take your big rectangle $A$, slice it in $10$ equal slices vertically, and in $10$ equal slices horizontally, and you get $100$ rectangles, each one-tenth as long and one-tenth as wide as $A$. – Gerry Myerson Feb 11 '13 at 12:04
up vote 1 down vote accepted

Given a number $n$ and a big rectangle of size $a\times b$, you want to find a rectangle size $x\times y$ such that $n$ such rectangles fit exactly into the big rectangle. A simple method to achieve this, is to find a factorization $n=m\cdot k$ of $n$ and let $x=\frac am$, $y=\frac bk$. This way it is possible to lay the small rectangles in a regular $m$ by $k$ pattern and thus fill the big rectangle.

For example, if $a=320$, $b=480$ as in your example and $n=100$, one might choose the factorization $n=10\cdot 10$ and thus arrange $10$ by $10$ rectangles of size $32\times 48$. Or we might factor $n=5\cdot20$ and arrange $5$ by $20$ rectangles of size $64\times 24$. Each factorization $100=1\cdot 100=2\cdot 50=4\cdot 25=5\cdot 20=10\cdot 10=20\cdot5=25\cdot 4=50\cdot 2=100\cdot 1$ gives rise to a different solution.

An interesting question arises: If we allow the small rectangles to be rotated by $90^\circ$ and thus use "mixed" patterns, could solutions with other sizes than those found by the method above come up? The somewhat surprising (partial) answer is: One of the fractions $\frac ax$, $\frac bx$ must be an integer, and one of the fractions $\frac ay$, $\frac by$ must be an integer (this can be shown using a clever integration trick). In special cases (e.g. if the given rectangle is a square, $a=b$), this already shows that $x\times y$ is among the solutions found with the factorization method described above.

share|cite|improve this answer
Thanks for the response. The next issue I am going to have is the factorization. If there are 41 rectangles and the max size the rectangle could be is 128 x 152 how would you work out the n = m | k ? – Cam Feb 11 '13 at 9:31
You said, "There can either be $1$ rectangle or $100$ rectangles," so where do these $41$ rectangles come from? Anyway, one way to do it would be to use rectangles that are $320\times(480/41)$. – Gerry Myerson Feb 11 '13 at 12:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.