# Given a 12x12 binary image (only black and white pixels) what is its dimensionality? And how can I define dimensionality of a data space?

Suppose I have a grid 12x12 of pixels that can be only black or white. I can't understand if the dimensionality is 2 or 3. I mean... Is dimension given by 12x12 or 12x12x2 ?

There is some ambiguity in dimensionality you ask for. The vector space that your input lies in is $$12\times12 = 144$$ dimensional. So, if you're going to apply some kind of dimensionality reduction algorithm, e.g. PCA, this is the dimension. But, we sometimes tend to refer to dimension as the shape of the tensor, which is $$2$$ in this case. Some libraries might read the image into $$12\times12\times3$$ tensors, in which the third entry indicates RGB decomposition, even if the image is black and white. In this case, the tensor dimension is $$3$$.

• Yes, I want to apply a dimensionality reduction but also in this case I don't understand why the dimensionality is 12x12 and not 12x12x2 (no rgb, just black or white). – Ric Jan 15 '19 at 10:44
• Where does that 2 come from? Is it the number of possible choices for a given pixel? – gunes Jan 15 '19 at 10:45
• Yes, supposing that we are talking about rgb pixels the dimensionality could be 12x12x3... or not? – Ric Jan 15 '19 at 10:47
• Definitely not. {0,1} is your domain, it has nothing to do with dimensionality. In RGB, your domain would be binary numbers with 24-bits, i.e. $2^{24}$ possible values. For dimensionality, you'll consider how many variables you have, not their values. In this case, you have $144$, i.e. $x_{1,1},x_{1,2},...x_{12,11},x_{12,12}$ – gunes Jan 15 '19 at 10:50