[Math] Dividing a picture into N number of equal parts

geometry

I need a formula to divide a fixed area in 'N' number of equal parts.
For example I am having a picture/image of 800*800, So now I need to slice it into 10 number of equal parts (squares/ rectangles) and what will be the dimension (height * width) of the sliced portions.
Can you help me in that?
If in case it is an odd number then we will add +1 to it and will merge the last 2 images resulting in making a rectangle.

Best Answer

Let's assume that $N$ divides $800 \times 800 = 64000$ for now. Then in order to split up the $800 \times 800$ image we factorise $N$ into integers $(a, b)$ such that $a|800$ and $b|800$.

For example, if $N = 10$ then you have $(1, 10)$, $(2, 5)$, $(5, 2)$ and $(10, 1)$ as valid factorisations. Then each rectangular slice would have dimensions $\frac{800}{a} \times \frac{800}{b}$. So for $N = 10$ the solutions are:

  • $\frac{800}{1} \times \frac{800}{10} = 800 \times 80$

  • $\frac{800}{2} \times \frac{800}{5} = 400 \times 160$

  • $\frac{800}{5} \times \frac{800}{2} = 160 \times 400$

  • $\frac{800}{10} \times \frac{800}{1} = 80 \times 800$

Note that for some $N$, there may be. For example, $(1600, 1)$ is not a valid factorisation for $N = 1600$ because 1600 exceeds the side lengths of the initial $800 \times 800$ image.

If $N$ does not divide 64000 then you cannot divide the image into equal rectangles.