Projection of a hypercube into three dimensional space​
​by Oliver Seipel
In his lecture Linear Algebra at ETHZ, Prof. Ernst Specker* (1920-2011) https://en.wikipedia.org/wiki/Ernst_Specker challenged his students (and I was one of them) with the following question in a story :
“When I was young I noticed, that projecting a cube along its diagonal gives you a regular hexagon. So I asked myself, what do you get, if you project a four-dimensional hypercube along its hyperdiagonal? Is it a platonic polyhedron?”.
*He has Erdős number 1 https://en.wikipedia.org/wiki/Erd% C5 %91 s_number
Prof. Specker never told us, what he had found, and he never returned to this question, but I think I remember, he said it wasn’t a platonic polyhedron.
This question challenged me for a while, and I decided to approach it with Wolfram Language:
A vector
b
is to decomposed into a part parallel to vector
a
and a part orthogonal to
a
≠0.
In[]:=
parallel[b_,a_]:=
a.b
a.a
a
For real vectors parallel[b,a] is equivalent to Projection[b,a].
In[]:=
orthogonal[b_,a_]:=b-parallel[b,a]
We have
b=parallel[b,a]+orthogonal[b,a]
, with a≠0.
In[]:=
With[{b=RandomInteger[{1,5}]RandomReal[{-1,1},2],a=RandomReal[{-1,1},2]},​​With[{p=parallel[b,a],o=orthogonal[b,a]},​​Graphics[{{Blue,Arrow[{{0,0},b}]},{Red,Arrow[{{0,0},a}]},Line[{{0,0},p}],{Green,Line[{{0,0},o}]},Dashed,Line[{p,b,o}],Text["a",a/2],Text["b",b/2],Text["||",p/2],Text["⟂",o/2]}]]]
Out[]=
This is the parallel projection of a cube along its diagonal:
In[]:=
Graphics3D[PolyhedronData["Cube","GraphicsComplex"],ViewProjection"Orthographic",Boxed->False,ViewPoint->{1,1,1},Lighting"Neutral"]
Out[]=
And now we compute the projection of the cube from scratch:
These are the eight vertices of a cube:
In[]:=
vertices3D=Tuples[{0,1},3]
Out[]=
{{0,0,0},{0,0,1},{0,1,0},{0,1,1},{1,0,0},{1,0,1},{1,1,0},{1,1,1}}
We project along the diagonal i.e (1,1,1) and preserve the x-axis i.e. (1,0,0) and the y-axis i.e. (0,1,0). So we get rid of the z-axis (0,0,1).
We construct an orthonormal basis with Gram-Schmidt and therefore the transformation Matrix to the new basis:
In[]:=
M3=Reverse[Orthogonalize[{{1,1,1},{1,0,0},{0,1,0}}]]
Out[]=
0,
1
2
,-
1
2
,
2
3
,-
1
6
,-
1
6
,
1
3
,
1
3
,
1
3

These are the projected vertices in the new basis:
In[]:=
newvertices3D=Simplify[Map[M3.#&,Map[orthogonal[#,{1,1,1}]&,vertices3D]]]
Out[]=
{0,0,0},-
1
2
,-
1
6
,0,
1
2
,-
1
6
,0,0,-
2
3
,0,0,
2
3
,0,-
1
2
,
1
6
,0,
1
2
,
1
6
,0,{0,0,0}
As you can see the z-components are all zero. We can drop them to make it 2D.
In[]:=
pts2D=Map[Most,newvertices3D]
Out[]=
{0,0},-
1
2
,-
1
6
,
1
2
,-
1
6
,0,-
2
3
,0,
2
3
,-
1
2
,
1
6
,
1
2
,
1
6
,{0,0}
In[]:=
Graphics[{EdgeForm[Black],GrayLevel[0.85],Polygon[pts2D[[{1,4,3,7}]]],GrayLevel[0.99],Polygon[pts2D[[{1,7,5,6}]]],GrayLevel[0.5],Polygon[pts2D[[{1,6,2,4}]]]}]
Out[]=
Now we are doing the same one dimension higher:)
The vertices of a four-dimensional hypercube:
In[]:=
vertices4D=Tuples[{0,1},4]
Out[]=
{{0,0,0,0},{0,0,0,1},{0,0,1,0},{0,0,1,1},{0,1,0,0},{0,1,0,1},{0,1,1,0},{0,1,1,1},{1,0,0,0},{1,0,0,1},{1,0,1,0},{1,0,1,1},{1,1,0,0},{1,1,0,1},{1,1,1,0},{1,1,1,1}}
The projection vector:
In[]:=
projectionvector={1,1,1,1};
The new basis and the transformation matrix:
In[]:=
M4=Reverse[Orthogonalize[{projectionvector,{1,0,0,0},{0,1,0,0},{0,0,1,0}}]]
Out[]=
0,0,
1
2
,-
1
2
,0,
2
3
,-
1
6
,-
1
6
,
3
2
,-
1
2
3
,-
1
2
3
,-
1
2
3
,
1
2
,
1
2
,
1
2
,
1
2

The projected vertices in the new basis:
In[]:=
newvertices4D=Simplify[Map[M4.#&,Map[orthogonal[#,projectionvector]&,vertices4D]]]
Out[]=
{0,0,0,0},-
1
2
,-
1
6
,-
1
2
3
,0,
1
2
,-
1
6
,-
1
2
3
,0,0,-
2
3
,-
1
3
,0,0,
2
3
,-
1
2
3
,0,-
1
2
,
1
6
,-
1
3
,0,
1
2
,
1
6
,-
1
3
,0,0,0,-
3
2
,0,0,0,
3
2
,0,-
1
2
,-
1
6
,
1
3
,0,
1
2
,-
1
6
,
1
3
,0,0,-
2
3
,
1
2
3
,0,0,
2
3
,
1
3
,0,-
1
2
,
1
6
,
1
2
3
,0,
1
2
,
1
6
,
1
2
3
,0,{0,0,0,0}
As before, the last component is always zero. We drop them to be in 3D:
The convex hull:
This polyhedron has 12 rhombic faces and is therefore called rhombic dodecahedron https://en.wikipedia.org/wiki/Rhombic_dodecahedron. It is the dual of the cuboctahedron https://en.wikipedia.org/wiki/Cuboctahedron (one of the 13 Archimedean polyhedrons).
Putting it all together:
New challenge: Write a program that projects a five dimensional hypercube along any five dimensional axis into four dimensional space and from there project it along any four dimensional axis into three dimensional space and render it.