A Relaxing Geometry Problem

Question: Figure shows an equilateral triangle with side length equal to
1
. Three squares of side length
a
,
2a
and
3a
​
placed side by side just fit inside the triangle as shown.Find the exact value of
a
.
Dr Penn
discussed
the interesting geometry problem on his channel today. You may watch the video to get idea about of the steps of derivation or go to this
SElink
to read them. I am going to show how to use Wolfram language to create a nice visualization about the general case in which you can have more squares with arithmetic progression side length sitting in a equilateral triangle just like stated in the problem.
(Local) In[]:=
Clear[n]
The idea is that the side of the large triangle is the sum of the side of squares plus two trailing segments. Both trailing segments are computed using simple trigonometry

(Local) In[]:=
cot(60 degree)
Cot
60
°

(Local) Out[]=
1
3
For three squares the two trailing segments are
a
3

and
3a
3

. And everything in between sums up to
a(1+2+3)=6a
. If I extend 3 to n, I have the following solution for
a
(recall that it is the side length of the smallest square that we are looking for) in terms of
n
using the same deduction.
(Local) In[]:=
Solve
a+n*a
3
+a*Sum[k,{k,n}]1,a
(Local) Out[]=
a
6
(1+n)(2
3
+3n)

Then I need to how much a square in the list are shifted to right from the left most vertex of the bounding equilateral triangle (set at origin = {0,0}).
◼
  • the first square with side length
    a
    : its bottom-left corner is at
    ax1
    3
    ,0
    and upper-right corner
    ax1
    3
    ,0+ax{1,1}
  • ◼
  • the second square with side length
    2a
    : its bottom-left corner is at
    ax1+1
    3
    ,0
    and upper-right corner
    ax1+1
    3
    ,0+ax{2,2}=ax1+2+1
    3
    ,2
  • ◼
  • the third square with side length
    3a
    : its bottom-left is at
    ax1+2+1
    3
    ,0
    and upper-right corner
    ax1+2+1
    3
    ,0+ax{3,3}=ax1+2+3+1
    3
    ,3
  • ...
    ◼
  • the nth square with side length
    nxa
    : its left bottom-left is at
    ax1+2+...+n-1+1
    3
    ,0
    and upper-right corner
    ax1+2+...+n-1+1
    3
    ,0+ax{n,n}=ax1+2+3+...+n+1
    3
    ,n
  • The pattern tells us that we can use the following formula to compute the sum of arithmetic progression from 1 to n.
    
    (Local) In[]:=
    sum from 1 to n
    Sum[n,{n,1,n}]
    (Local) Out[]=
    1
    2
    n(1+n)
    I use the exact formula to compute the coordinates of two diagonal corners for each square. Then I insert them into Rectangle to draw each piece. Hue is added to make the list of rectangle vibrant.
    (Local) In[]:=
    squareList[n_]:=Witha=
    6
    (1+n)2
    3
    +3n
    ,​​TableHue
    i/n
    ,1,1,0.7,​​Rectanglea*
    1
    3
    +
    1
    2
    (-1+i)i,0,a*
    1
    3
    +
    1
    2
    (1+i)i,i,{i,n}​​
    Eventually I wrap up the function above into a Manipulate function and play around the number of squares sitting in the triangle.
    (Local) In[]:=
    ManipulateGraphics​​Transparent,EdgeForm[{Blue,Thick}],Triangle{0,0},{1,0},12,
    3
    2,​​squareList[k]​​,PlotRange{0,1},-0.05,
    6*k*2.4
    (1+k)2
    3
    +3k
    ​​,{k,1,20,1}
    (Local) Out[]=
    ​
    k
    The PlotRange is tuned so that it does not truncate the top vertex of triangle when the number K is set to three and the plot window zooms in when there are many squares are generated. Notice that the side of largest square
    nxa
    approaches zero when n approaches infinity
    (Local) In[]:=
    Limitn*
    6
    (1+n)2
    3
    +3n
    ,nInfinity
    (Local) Out[]=
    0
    The plot of the above expression shows the same trend as n increases.
    (Local) In[]:=
    DiscretePlotn*
    6
    (1+n)2
    3
    +3n
    ,{n,1,12}
    (Local) Out[]=
    2
    4
    6
    8
    10
    12
    0.15
    0.20
    0.25
    0.30
    0.35
    0.40
    0.45