Project Nayuki


Pixel is a unit of length and area

When measuring the size of a two-dimensional digital picture, the unit pixel is used in a weird overloaded way. Sometimes, it is used as a unit of linear length – for example, each frame of an animation is 1920 pixels wide and 1080 pixels tall. Other times, it is used as a unit of area – e.g. that camera sensor has 12 megapixels (or 12 000 000 pixels).

Viewed mathematically through the lens of dimensional analysis, these conflicting definitions lead to illogical nonsense. Given that the formula for the area of a rectangle is area = width × height, if for example we have width = 1920 pixel and height = 1080 pixel, then we get area = 2 073 600 pixel2. That’s right, multiplying two linear dimensions – where each has the unit pixel – produces an area with the unit square pixel. This is analogous to how metres and square metres behave.

On the other hand, if we trust the colloquial definitions of how pixels are used in practice, then an image that is 10 pixels wide and 10 pixels tall has an area of 100 pixels, so 10 pixel × 10 pixel = 100 pixel, thus 100 pixel2 = 100 pixel, then pixel2 = pixel, and finally pixel = 1. That means the pixel is a dimensionless unit that is just another name for 1, kind of like how the radian is length divided by length so it also equals one, and the steradian is area divided by area which also equals one.

I don’t think there is a clean way to resolve this particular tension between pure mathematics and colloquialisms. One imperfect approach is to define a pixel to be a square whose physical size depends on the exact device or standard under consideration, and then give the name pixel-side to the linear unit that defines both the width and height of the pixel. Under this approach, we can also call the pixel-side as a square-root-pixel or √pixel (this is not unheard of as engineering uses √Hz (square root hertz) in places). We will have to ignore less common cases such as non-square pixels (this was used in images/videos a lot in the early decades of computing).

The other awkward approach is to insist that the pixel is a unit of length, and then we need to refer to all instances of area as square pixels – for example, a television monitor might have 8 million square pixels. Following metric rules, prefixes can only be applied to units and not to the result of computations – e.g. 1 million square metres is not 1 mega-square-metre, but is 1 square kilometre. So everything that was previously quantified in megapixels would now need to be written out as a big number (e.g. 8 million square pixels) or more awkwardly switch to square kilopixels, which squares both the prefix and the unit simultaneously.

Overall, this isn’t a particularly serious discussion because the pixel isn’t a metric unit and it rarely participates in compound units and calculations more complicated than something like “pixels per metre” or “gigapixels per second”. But it does highlight that the common terminology is imperfect and breaks the regularity that scientists come to expect when working with physical units in calculations. (Outside of computing, an example of tension in the definitions of units is that the pound is conflated as both a unit of mass and force. Meanwhile, the metric system mandates a clean separation between the kilogram and the newton.)

More info