# Hypercube

In geometry, a hypercube is an n-dimensional analogue of a square (n = 2) and a cube (n = 3); the special case for n = 4 is known as a tesseract. It is a closed, compact, convex figure whose 1-skeleton consists of groups of opposite parallel line segments aligned in each of the space's dimensions, perpendicular to each other and of the same length. A unit hypercube's longest diagonal in n dimensions is equal to ${\sqrt {n}}$.
An n-dimensional hypercube is more commonly referred to as an n-cube or sometimes as an n-dimensional cube. The term measure polytope (originally from Elte, 1912) is also used, notably in the work of H. S. M. Coxeter who also labels the hypercubes the γn polytopes.
The hypercube is the special case of a hyperrectangle (also called an n-orthotope).
A unit hypercube is a hypercube whose side has length one unit. Often, the hypercube whose corners (or vertices) are the 2$^n$ points in R$^n$ with each coordinate equal to 0 or 1 is called the unit hypercube.

## Construction
### By the number of dimensions

A hypercube can be defined by increasing the numbers of dimensions of a shape:
    0 – A point is a hypercube of dimension zero.
    1 – If one moves this point one unit length, it will sweep out a line segment, which is a unit hypercube of dimension one.
    2 – If one moves this line segment its length in a perpendicular direction from itself; it sweeps out a 2-dimensional square.
    3 – If one moves the square one unit length in the direction perpendicular to the plane it lies on, it will generate a 3-dimensional cube.
    4 – If one moves the cube one unit length into the fourth dimension, it generates a 4-dimensional unit hypercube (a unit tesseract).
This can be generalized to any number of dimensions. This process of sweeping out volumes can be formalized mathematically as a Minkowski sum: the d-dimensional hypercube is the Minkowski sum of d mutually perpendicular unit-length line segments, and is therefore an example of a zonotope.
The 1-skeleton of a hypercube is a hypercube graph.

### Vertex coordinates

A unit hypercube of dimension $n$ is the convex hull of all the $2^{n}$ points whose $n$ Cartesian coordinates are each equal to either $0$ or $1$. These points are its vertices. The hypercube with these coordinates is also the cartesian product $[0,1]^{n}$ of $n$ copies of the unit interval $[0,1]$. Another unit hypercube, centered at the origin of the ambient space, can be obtained from this one by a translation. It is the convex hull of the $2^{n}$ points whose vectors of Cartesian coordinates are
    $\left(\pm {\frac {1}{2}},\pm {\frac {1}{2}},\cdots ,\pm {\frac {1}{2}}\right)\!\!.$
Here the symbol $\pm$ means that each coordinate is either equal to $1/2$ or to $-1/2$. This unit hypercube is also the cartesian product $[-1/2,1/2]^{n}$. Any unit hypercube has an edge length of $1$ and an $n$-dimensional volume of $1$.
The $n$-dimensional hypercube obtained as the convex hull of the points with coordinates $(\pm 1,\pm 1,\cdots ,\pm 1)$ or, equivalently as the Cartesian product $[-1,1]^{n}$ is also often considered due to the simpler form of its vertex coordinates. Its edge length is $2$, and its $n$-dimensional volume is $2^{n}$.

## Faces

Every hypercube admits, as its faces, hypercubes of a lower dimension contained in its boundary. A hypercube of dimension $n$ admits $2n$ facets, or faces of dimension $n-1$: a ($1$-dimensional) line segment has $2$ endpoints; a ($2$-dimensional) square has $4$ sides or edges; a $3$-dimensional cube has $6$ square faces; a ($4$-dimensional) tesseract has $8$ three-dimensional cubes as its facets. The number of vertices of a hypercube of dimension $n$ is $2^{n}$ (a usual, $3$-dimensional cube has $2^{3}=8$ vertices, for instance).
The number of the $m$-dimensional hypercubes (just referred to as $m$-cubes from here on) contained in the boundary of an $n$-cube is
    $E_{m,n}=2^{n-m}{n \choose m}$, where ${n \choose m}={\frac {n!}{m!\,(n-m)!}}$ and $n!$ denotes the factorial of $n$.
For example, the boundary of a $4$-cube ($n=4$) contains $8$ cubes ($3$-cubes), $24$ squares ($2$-cubes), $32$ line segments ($1$-cubes) and $16$ vertices ($0$-cubes). This identity can be proven by a simple combinatorial argument: for each of the $2^{n}$ vertices of the hypercube, there are ${\tbinom {n}{m}}$ ways to choose a collection of $m$ edges incident to that vertex. Each of these collections defines one of the $m$-dimensional faces incident to the considered vertex. Doing this for all the vertices of the hypercube, each of the $m$-dimensional faces of the hypercube is counted $2^{m}$ times since it has that many vertices, and we need to divide $2^{n}{\tbinom {n}{m}}$ by this number.
The number of facets of the hypercube can be used to compute the $(n-1)$-dimensional volume of its boundary: that volume is $2n$ times the volume of a $(n-1)$-dimensional hypercube; that is, $2ns^{n-1}$ where $s$ is the length of the edges of the hypercube.
These numbers can also be generated by the linear recurrence relation.
    $E_{m,n}=2E_{m,n-1}+E_{m-1,n-1}\!$,  with $E_{0,0}=1$, and $E_{m,n}=0$ when $n<m$, $n<0$, or $m<0$.
For example, extending a square via its 4 vertices adds one extra line segment (edge) per vertex. Adding the opposite square to form a cube provides $E_{1,3}=12$ line segments.
The extended f-vector for an n-cube can also be computed by expanding $(2x+1)^{n}$ (concisely, (2,1)$^n$), and reading off the coefficients of the resulting polynomial. For example, the elements of a tesseract is (2,1)$^4$ = (4,4,1)$^2$ = (16,32,24,8,1).
Number $E_{m,n}$ of $m$-dimensional faces of a $n$-dimensional hypercube (sequence A038207 in the OEIS) :
| | | | m | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| n | n-cube | Names | Schläfli Coxeter | Vertex 0-face | Edge 1-face | Face 2-face | Cell 3-face | 4-face | 5-face | 6-face | 7-face | 8-face | 9-face | 10-face |
| 0 | 0-cube | Point Monon | ( ) | 1 | | | | | | | | | | |
| 1 | 1-cube | Line segment Dion | | 2 | 1 | | | | | | | | | |
| 2 | 2-cube | Square Tetragon | {4} | 4 | 4 | 1 | | | | | | | | |
| 3 | 3-cube | Cube Hexahedron | {4,3} | 8 | 12 | 6 | 1 | | | | | | | |
| 4 | 4-cube | Tesseract Octachoron | {4,3,3} | 16 | 32 | 24 | 8 | 1 | | | | | | |
| 5 | 5-cube | Penteract Deca-5-tope | {4,3,3,3} | 32 | 80 | 80 | 40 | 10 | 1 | | | | | |
| 6 | 6-cube | Hexeract Dodeca-6-tope | {4,3,3,3,3} | 64 | 192 | 240 | 160 | 60 | 12 | 1 | | | | |
| 7 | 7-cube | Hepteract Tetradeca-7-tope | {4,3,3,3,3,3} | 128 | 448 | 672 | 560 | 280 | 84 | 14 | 1 | | | |
| 8 | 8-cube | Octeract Hexadeca-8-tope | {4,3,3,3,3,3,3} | 256 | 1024 | 1792 | 1792 | 1120 | 448 | 112 | 16 | 1 | | |
| 9 | 9-cube | Enneract Octadeca-9-tope | {4,3,3,3,3,3,3,3} | 512 | 2304 | 4608 | 5376 | 4032 | 2016 | 672 | 144 | 18 | 1 | |
| 10 | 10-cube | Dekeract Icosa-10-tope | {4,3,3,3,3,3,3,3,3} | 1024 | 5120 | 11520 | 15360 | 13440 | 8064 | 3360 | 960 | 180 | 20 | 1 |

### Graphs

An n-cube can be projected inside a regular 2n-gonal polygon by a skew orthogonal projection, shown here from the line segment to the 16-cube.
Petrie polygon Orthographic projections :
| Line segment | Square | Cube | Tesseract |
| 5-cube | 6-cube | 7-cube | 8-cube |
| 9-cube | 10-cube | 11-cube | 12-cube |
| 13-cube | 14-cube | 15-cube | |

## Related families of polytopes

The hypercubes are one of the few families of regular polytopes that are represented in any number of dimensions.
The hypercube (offset) family is one of three regular polytope families, labeled by Coxeter as γ$_n$. The other two are the hypercube dual family, the cross-polytopes, labeled as β$_{n,}$ and the simplices, labeled as α$_n$. A fourth family, the infinite tessellations of hypercubes, is labeled as δ$_n$.
Another related family of semiregular and uniform polytopes is the demihypercubes, which are constructed from hypercubes with alternate vertices deleted and simplex facets added in the gaps, labeled as hγ$_n$.
n-cubes can be combined with their duals (the cross-polytopes) to form compound polytopes:
* In two dimensions, we obtain the octagrammic star figure {8/2},
* In three dimensions we obtain the compound of cube and octahedron,
* In four dimensions we obtain the compound of tesseract and 16-cell.

## Relation to (n−1)-simplices

The graph of the n-hypercube's edges is isomorphic to the Hasse diagram of the (n−1)-simplex's face lattice. This can be seen by orienting the n-hypercube so that two opposite vertices lie vertically, corresponding to the (n−1)-simplex itself and the null polytope, respectively. Each vertex connected to the top vertex then uniquely maps to one of the (n−1)-simplex's facets (n−2 faces), and each vertex connected to those vertices maps to one of the simplex's n−3 faces, and so forth, and the vertices connected to the bottom vertex map to the simplex's vertices.
This relation may be used to generate the face lattice of an (n−1)-simplex efficiently, since face lattice enumeration algorithms applicable to general polytopes are more computationally expensive.

## Generalized hypercubes

Regular complex polytopes can be defined in complex Hilbert space called generalized hypercubes, γ$^p$ $_n$ = $_p${4}$_2${3}...$_2${3}$_2$, or ... Real solutions exist with p = 2, i.e. γ$^2$ $_n$ = γ$_n$ = $_2${4}$_2${3}...$_2${3}$_2$ = {4,3,..,3}. For p > 2, they exist in $\mathbb {C} ^{n}$. The facets are generalized (n−1)-cube and the vertex figure are regular simplexes.
The regular polygon perimeter seen in these orthogonal projections is called a Petrie polygon. The generalized squares (n = 2) are shown with edges outlined as red and blue alternating color p-edges, while the higher n-cubes are drawn with black outlined p-edges.
The number of m-face elements in a p-generalized n-cube are: $p^{n-m}{n \choose m}$. This is p$^n$ vertices and pn facets.
Generalized hypercubes :
| | p=2 | | p=3 | p=4 | p=5 | p=6 | p=7 | p=8 |
| $\mathbb {R} ^{2}$ | γ$^2$ $_2$ = {4} = 4 vertices | $\mathbb {C} ^{2}$ | γ$^3$ $_2$ = 9 vertices | γ$^4$ $_2$ = 16 vertices | γ$^5$ $_2$ = 25 vertices | γ$^6$ $_2$ = 36 vertices | γ$^7$ $_2$ = 49 vertices | γ$^8$ $_2$ = 64 vertices |
| $\mathbb {R} ^{3}$ | γ$^2$ $_3$ = {4,3} = 8 vertices | $\mathbb {C} ^{3}$ | γ$^3$ $_3$ = 27 vertices | γ$^4$ $_3$ = 64 vertices | γ$^5$ $_3$ = 125 vertices | γ$^6$ $_3$ = 216 vertices | γ$^7$ $_3$ = 343 vertices | γ$^8$ $_3$ = 512 vertices |
| $\mathbb {R} ^{4}$ | γ$^2$ $_4$ = {4,3,3} = 16 vertices | $\mathbb {C} ^{4}$ | γ$^3$ $_4$ = 81 vertices | γ$^4$ $_4$ = 256 vertices | γ$^5$ $_4$ = 625 vertices | γ$^6$ $_4$ = 1296 vertices | γ$^7$ $_4$ = 2401 vertices | γ$^8$ $_4$ = 4096 vertices |
| $\mathbb {R} ^{5}$ | γ$^2$ $_5$ = {4,3,3,3} = 32 vertices | $\mathbb {C} ^{5}$ | γ$^3$ $_5$ = 243 vertices | γ$^4$ $_5$ = 1024 vertices | γ$^5$ $_5$ = 3125 vertices | γ$^6$ $_5$ = 7776 vertices | γ$^7$ $_5$ = 16,807 vertices | γ$^8$ $_5$ = 32,768 vertices |
| $\mathbb {R} ^{6}$ | γ$^2$ $_6$ = {4,3,3,3,3} = 64 vertices | $\mathbb {C} ^{6}$ | γ$^3$ $_6$ = 729 vertices | γ$^4$ $_6$ = 4096 vertices | γ$^5$ $_6$ = 15,625 vertices | γ$^6$ $_6$ = 46,656 vertices | γ$^7$ $_6$ = 117,649 vertices | γ$^8$ $_6$ = 262,144 vertices |
| $\mathbb {R} ^{7}$ | γ$^2$ $_7$ = {4,3,3,3,3,3} = 128 vertices | $\mathbb {C} ^{7}$ | γ$^3$ $_7$ = 2187 vertices | γ$^4$ $_7$ = 16,384 vertices | γ$^5$ $_7$ = 78,125 vertices | γ$^6$ $_7$ = 279,936 vertices | γ$^7$ $_7$ = 823,543 vertices | γ$^8$ $_7$ = 2,097,152 vertices |
| $\mathbb {R} ^{8}$ | γ$^2$ $_8$ = {4,3,3,3,3,3,3} = 256 vertices | $\mathbb {C} ^{8}$ | γ$^3$ $_8$ = 6561 vertices | γ$^4$ $_8$ = 65,536 vertices | γ$^5$ $_8$ = 390,625 vertices | γ$^6$ $_8$ = 1,679,616 vertices | γ$^7$ $_8$ = 5,764,801 vertices | γ$^8$ $_8$ = 16,777,216 vertices |

## Relation to exponentiation

Any positive integer raised to another positive integer power will yield a third integer, with this third integer being a specific type of figurate number corresponding to an n-cube with a number of dimensions corresponding to the exponential. For example, the exponent 2 will yield a square number or "perfect square", which can be arranged into a square shape with a side length corresponding to that of the base. Similarly, the exponent 3 will yield a perfect cube, an integer which can be arranged into a cube shape with a side length of the base. As a result, the act of raising a number to 2 or 3 is more commonly referred to as "squaring" and "cubing", respectively. However, the names of higher-order hypercubes do not appear to be in common use for higher powers.