Dudeney triangle/square puzzle
Vertices of the equilateral triangle
In[]:=
pA={0,0}​​pB={1,0}​​pC={1/2,Sqrt[3]/2}
Out[]=
{0,0}
Out[]=
{1,0}
Out[]=

1
2
,
3
2

Midpoints of AC and BC
In[]:=
pD=(pA+pC)/2​​pE=(pB+pC)/2
Out[]=

1
4
,
3
4

Out[]=

3
4
,
3
4

Area and side length of square
In[]:=
a=Area[Triangle[{pA,pB,pC}]]
Out[]=
3
4
In[]:=
s=Sqrt[a]​​s//N
Out[]=
1/4
3
2
Out[]=
0.658037
Find Point F along AB
Assume length of EF is the side length of the square
In[]:=
solnF=Solve[pE[[2]]^2+(pE[[1]]-xF)^2==a,xF]
Out[]=
xF
1
4
3-
-3+4
3
,xF
1
4
3+
-3+4
3

In[]:=
pF={xF,0}/.solnF[[1]][[1]]​​pF//N
Out[]=

1
4
3-
-3+4
3
,0
Out[]=
{0.254508,0.}
Find Point G along AB
Assume it is at Point F + 1/2
In[]:=
pG=pF+{1/2,0}​​pG//N
Out[]=

1
2
+
1
4
3-
-3+4
3
,0
Out[]=
{0.754508,0.}
In[]:=
Simplify[pG]
Out[]=

1
4
5-
-3+4
3
,0
Slope and equation of Line FE
In[]:=
mFE=(pE[[2]]-pF[[2]])/(pE[[1]]-pF[[1]])​​mFE//N
Out[]=
3
4
3
4
+
1
4
-3+
-3+4
3

Out[]=
0.873904
In[]:=
eqFE=Expand[y-pF[[2]]==mFE(x-pF[[1]])]
Out[]=
y-
3
3
16
3
4
+
1
4
-3+
-3+4
3

+
3(-3+4
3
)
16
3
4
+
1
4
-3+
-3+4
3

+
3
x
4
3
4
+
1
4
-3+
-3+4
3

Slope and equation of Line DH
In[]:=
mDH=-1/mFE​​mDH//N
Out[]=
-
4
3
4
+
1
4
-3+
-3+4
3

3
Out[]=
-1.14429
In[]:=
eqDH=Expand[y-pD[[2]]==mDH(x-pD[[1]])]
Out[]=
-
3
4
+y
1
4
1
3
(-3+4
3
)
-
1
3
(-3+4
3
)
x
Get Point H by intersection and check if DH is half the side length
In[]:=
solnH=Solve[{eqFE,eqDH},{x,y}]
Out[]=
x
1
8
(2+
3
),y
1
8
2
3
-
-3+4
3

In[]:=
pH={x,y}/.solnH[[1]]​​pH//N
Out[]=

1
8
(2+
3
),
1
8
2
3
-
-3+4
3

Out[]=
{0.466506,0.185267}
In[]:=
ArcLength[Line[{pD,pH}]]//N​​Simplify[ArcLength[Line[{pD,pH}]]]==s/2
Out[]=
0.329019
Out[]=
True
Slope and equation of Line GJ
In[]:=
mGJ=-1/mFE​​mGJ//N
Out[]=
-
4
3
4
+
1
4
-3+
-3+4
3

3
Out[]=
-1.14429
In[]:=
eqGJ=Expand[y-pG[[2]]==mGJ(x-pG[[1]])]
Out[]=
y-1+
3
4
+
5
4
1
3
(-3+4
3
)
-
1
3
(-3+4
3
)
x
Get Point J by intersection and check if GJ is half the side length
In[]:=
solnJ=Solve[{eqFE,eqGJ},{x,y}]
Out[]=
x
1
8
10-
3
-2
-3+4
3
,y
1
8
-3+4
3

In[]:=
pJ={x,y}/.solnJ[[1]]​​pJ//N
Out[]=

1
8
10-
3
-2
-3+4
3
,
1
8
-3+4
3

Out[]=
{0.538001,0.247746}
In[]:=
ArcLength[Line[{pG,pJ}]]//N​​Simplify[ArcLength[Line[{pG,pJ}]]]==s/2
Out[]=
0.329019
Out[]=
True
Define the pieces
In[]:=
r1=Triangle[{pF,pJ,pG}];​​r2=Polygon[{pE,pB,pG,pJ}];​​r3=Polygon[{pD,pC,pE,pH}];​​r4=Polygon[{pA,pD,pH,pF}];​​
Draw the triangle with all the points
Rotate the green triangle about Point G
Rotate the orange and green pieces together about Point E
Rotate the blue, orange, and green pieces together about Point D
Rotate the square to make the sides horizontal and vertical
Show full triangle with green triangle rotated 180° and moved up to Line DE