# Form Common Geometric Shapes

You are given 1,000,000 units of straight thin stick and your task is to create one triangle, one square, one rectangle by cutting the stick into sides.

• None of the side of each shape has common side length with other shape's.
• Side lengths are different than each other for each shape too (except square since its side has to be the same to form a square).

In other words, triangle has distinct integer side lengths like $a$,$b$,$c$ sides, likewise rectangle has distinct integer side lengths such as $d,e$, and square has a distinct integer side length $f$. So $a,b,c,d,e,f$ are different than each other.

If you construct two sets of shapes following these rules, one with the greatest total area and one with the smallest total area - what is the difference in area of triangles between these two sets?

• Do "largest area" and "smallest area" refer to the triangle area alone, or the sum area of all three shapes? Aug 2, 2018 at 15:03
• What does "triangle area difference" mean? I assumed as I started reading that you wanted the difference between triangle sizes but then it goes onto say the sum of all shapes. Does "triangle area" mean something I'm not aware of? Aug 6, 2018 at 18:09
• @Chris you form largest area with all shapes, take the note of the triangle Area, X. Then you form smallest area possible with all shapes, take the note the triangle Area Y. and X-Y will be your answer.
– Oray
Aug 6, 2018 at 18:25
• @Oray: I've made an edit to phrase that part in a hopefully clearer fashion. Feel free to roll it back if you don't like it as much or feel it is incorrect. Aug 6, 2018 at 18:28
• @Chris it is much better Chris, Thanks a lot! :)
– Oray
Aug 6, 2018 at 18:31

As a follow-up to the excellent work already made by El-Guest and nickgard, here is my proposal:

• Minimum total area:

It can be achieved by using a side of 1 along with the maximum size for other sides. Since it's not possible for the triangle which sides are at least 3, we must use the rectangle. We must then build the minimum square (side of 2) and then build the minimum rectangle (sides 3, 4 and 5 ideally).

This yields the dimensions found by nickgard:
- Rectangle: 1 × 499989 (P = 999980, A = 499989)
- Square: 2 × 2 (P = 8, A = 4)
- Triangle: 3 × 4 × 5 (P = 12, A = 6)
- Minimum total area = 499999

• Maximum total area:

Here we must build one big shape and use the smallest number of units to build the two other shapes. The triangle having the least area-per-perimeter ratio, it must be the smallest possible (sides 3, 4 and 5). With the remaining 999988 units, the biggest square we can build has sides of 249995 units and there remain 2 units that must be "wasted" on shapes on lesser importance (this is the solution of nickgard).

However we can use those 999988 units to build the biggest rectangle while lowering the number of units spent on the square (i.e. side = 1). With 999984 units, we can build a 249995 × 249997 rectangle which will be obviously larger than a 249995 × 249995 square.

So here is the solution:
- Rectangle: 249995 × 249997 (P = 999984, A = 62498000015)
- Square: 1 × 1 (P = 4, A = 1)
- Triangle: 3 × 4 × 5 (P = 12, A = 6)
- Maximum total area = 62498000022

The difference of the two triangle areas is then

zero.

• Yes, I gave it a try the first day and was very surprised to see it was still unsolved today. That puzzle was a bit daunting at first but turned out to be quite a nice one finally ;-) Aug 8, 2018 at 11:44
• actually smallest area is 499998 but that's fine anyway :) fixed it...
– Oray
Aug 8, 2018 at 11:53
• @Oray. But you are then using two times a chunk of length 1. I have rolled back your edit but if I missed something, feel free to rollback my rollback of course. Aug 8, 2018 at 12:25
• Nice. I even alluded to an almost-square rectangle in my answer. Pity there was a bug in my program :( Aug 8, 2018 at 13:11

I'm going to take a (non-rigorous) stab at this. I'm going to try to use logical deduction more than a strictly mathematical proof here...and I'm likely going to be missing something important but oh well!

Let's start by figuring out the maximum area:

Since the square has greater area per perimeter than the rectangle, which has greater area per perimeter than the triangle, in order to maximize area you have to maximize the area of the square; in order to minimize area you have to maximize the area of the triangle.... To max area of the square, you need to take most of the 1M units and use them on the square. The problem is forming the triangle. 1M is even, and so are the perimeters of the square and the rectangle; therefore the triangle perimeter must be small and even. We can't use 1 as a side length, because any scalene triangle with one side length = 1 unit will be degenerate. If we use 2 as a side length, in order for the perimeter to be even, the two larger sides must (a) differ by an even amount and (b) adhere to the inequality $2 + b > c$. That is, $2 > c-b$ and $2\leq c-b$...so 2 is out as well. On to 3, where we take 3 as the smallest side length, and 4 and 5 will work too because they are the next smallest. This removes 12 units. We therefore need to create the smallest rectangle we can where $4|2(d+e)$. Taking $d = 1$ to minimize area of the rectangle, we must have $2|1+e$, where $e\neq 1,3,5$. The next smallest number is 7, and so we have $f = (1000000-12-16)/4 = 249993$. The combined "max area" is therefore $\frac{1}{2}(3)(4) + (1)(7) + (249,993)^2 = 13 + 62,496,500,049 = 62,496,500,062$.

Now let's move on to the minimum area:

We're going to maximize the allocation of the perimeter to the triangle, by creating the flattest scalene triangle we can. The remainder can go to the square and the rectangle. We're going to make one side of the triangle $a=3$. Remember, the widest, flattest triangle will have one really small side and two really long sides. To minimize the square, we take side length $f=1$. Then to minimize the rectangle, take side length $d=2$ and $e=4$. We have left $a+b+c = 1000000-4-12 = 999984$. To make the flattest triangle that we can, we notice that we must have $a+b = c+2$ (since the perimeter remaining is even). By solving we see that $a+b = 999984-c = c+2$, so $c = \frac{1}{2}(999982) = 499991$. Then $b = 999984-499991-3=499990$ by necessity. The combined min area (thanks to Heron's formula) is $707,093 + 1 + 8 = 707,102$.

I'm excited to see the Puzzling.SE community beat this area difference: my difference is currently

$62,495,792,960$

because I think it can be done (I'm not bragging, I just don't think this is optimal, ha-ha!)

When comparing the triangle area differences, we get my final answer of

$707,093 - 6 = 707,087$.

Please let me know if you find any math errors or any issues with the calculations, I think this was a pretty interesting puzzle to work on!

• For the minimum area, why chose a=3? The flattest scalene triangle is with a=1. Do I miss something? Aug 2, 2018 at 20:56
• For any triangle, the sum of any two sides must be strictly greater than the third. If a = 1, then b + 1 > c and c + 1 > b which is impossible with integer side lengths. Aug 3, 2018 at 6:37
• I may have asked wrong, edited the question accordingly, the question is asking the largest and smallest area in total, not just triangle area.
– Oray
Aug 3, 2018 at 6:47

For minimum area:

We'd expect the triangle to have the smallest area:perimeter ratio, but because of the triangle inequality and the requirement that the total perimeter length is even $(1,000,000)$ it turns out that the shortest side length of the triangle must be at least $3$. This gives a triangle whose area approximates $3/2 \times$ [big number], but this is less efficient that a $1 \times$ [big number] rectangle. So, we'll use a big rectangle.

We can use a $1\times499,989$ rectangle, a $3,4,5$ triangle and a $2\times2$ square giving a total area of $499,999$.

For maximum area:

This time we want to maximize the area of the square (although there's a slight possibility we might need an almost-square rectangle). We need to get the total perimeter of the rectangle and triangle to be divisible by $4$ so that the remaining lengths form a square.

It turns out we can use a $1\times2$ rectangle, a $3,5,6$ triangle and a $249,995\times249,995$ square giving a total area of approximately $62,497,500,034.4833$

The difference between the two areas is:

approximately $62,497,000,035.4833$

and the difference between the area of the triangles is:

approximately $1.4833$.

• " triangle area difference"
– Oray
Aug 4, 2018 at 9:48
• "What is the triangle area difference between the largest area and the smallest area of sum of all shapes by using all pieces you can form by cutting the stick with the rules above?" check the question please. it is even bold written.
– Oray
Aug 4, 2018 at 10:13
• you form largest area with all shapes, take the note of the triangle Area, X. Then you form smallest area possible with all shapes, take the note the triangle Area Y. and X-Y will be your answer.
– Oray
Aug 4, 2018 at 10:16
• you may want to check both areas.
– Oray
Aug 6, 2018 at 18:32