# Count number of hyperlines / hyperplanes / hypercubes from start set/coordinate axes in ND space

Sorry for the title but I'm not sure what the correct description would be.

I come from the following problem having a discrete matrix describing a line segment in 2D corresponding to the coordinate axis: $$A = \begin{bmatrix}0 & 0 & 0 \\ 1 & 1 & 1 \\ 0 & 0 & 0 \end{bmatrix}, B = \begin{bmatrix}0 & 1 & 0 \\ 0 & 1 & 0 \\ 0 & 1 & 0 \end{bmatrix}$$ The convolution of the two is simply the square: $$C = \begin{bmatrix}1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{bmatrix}$$ The total count of lines and planes would be 3.

For 3D space we have three lines corresponding to the three coordinate axis and the matrix is then 3x3x3. We then have also 3 orthogonal planes that are the results of the convolution of the lines and finally the full 3D cube. So in total we have 7 (3 starting lines, 3 planes and 1 cube).

How does this transfer to 4D space? In 4D space we have 4 coordinate vectors or lines. The convolution of these results in 6 planes, I thought given by the binomial coefficient $\left( \begin{matrix} NoLines \\ 2 \end{matrix} \right)$ Now I thought I could compute the next step as $\left( \begin{matrix} NoPrevElements \\ 2 \end{matrix} \right)$ so for 6 lines:
$$\left( \begin{matrix} 6 \\ 2 \end{matrix} \right) = 15$$ But when I check the convolutions of the planes I get 13 unique cubes and not 15. (Plus of course in the end one full ND-hypercube).

I would appreciate any ideas on the underlying relation of these elements for any dimensional space and how I could compute the number of unique matrices. Thanks for your time and help!

I made a mistake when comparing the results of the convolution. Basically the lines, planes and cubes can be described as bit strings of full lines of the matrix. With a line being a bit string with only one true, a plane with two, a cube with three and so forth. Hence the total count of elements would be for the dimension $D$: $$C = \begin{pmatrix} D \\ 1 \end{pmatrix} + \begin{pmatrix} D \\ 2 \end{pmatrix} + \begin{pmatrix} D \\ 3 \end{pmatrix} + ...+ \begin{pmatrix} D \\ D \end{pmatrix}$$
Or in other words: $$C = 2^D -1$$