What if you could count all pictures that a computer display could show

January 12, 2013 at 12:55 am (computers, interesting) (, , , )

I’ve been reading “what if” on the xkcd blog recently. Its a very entertaining discussion of postulating about mathematics and physics solutions to hypothetical problems.  And it made me think of something I’ve wondered about on and off, well, ever since I got involved in digital computing and that relates to the fact that a computer display is a large sequence of numbers and is basically finite.  Yet it appears to be able to display anything you can imagine (and an awful lot that you probably can’t).

Each specific display is basically a very, very, very large number – including the screen I can see right now, i.e. some background windows on the Internet, WordPress ‘edit’ window open, characters appearing and so on.  In fact every time a new character appears some digits in this very large number change.  What do I mean by this?  Well every display has a resolution.  Early PCs had small resolutions, just enough for text.  Then came things like VGA graphics providing a resolution of 480 by 640 pixels (picture elements) in the display.  That means a total of 307,200 individually referenceable items.

Now if that is a black and white display, then each of those pixels can have just one of two values – 0 (off) or 1 (on).  Like you drawing 480 dots in a line, then drawing 640 of these lines and each picture is made by colouring in black or leaving white each dot as required.  Low resolution colour graphics might have 4 bits per pixel, allowing for 16 colours to be represented – each pixel is now described not just by 0 or 1, but by a number between 0 and 15, representing a colour.  That means you’d need 307,200 times 4 bits storage to record the display on a screen, or approximately 1Mb (if I’ve got my maths correct).

Higher resolutions (such as the kind you might get on a non-smart, cheap PAYG phone these days) will need a larger number for each pixel until we get up to 24 bit colour, keeping VGA resolution, when you can have a red, green and blue value, each of between 0 and 255 for each of our 640 by 480 pixels.  Combined you get a lot of colours but at the cost of needing much more storage – in this case 640 x 480 x 24 bits, or something approaching 7Mb per “screen”.  I won’t go into more detail – as you might expect, there is a wikpedia article about the whole topic, so I refer interested readers there.

But getting back to the original point, taking the black and white 640 x 480 screen, that can be represented by a binary number containing 307,200 digits (2^307,200) or 2 times 2, 307,200 times.  So that means you take a number and double it 307,200 times.  That is the number of combinations of numbers that you’d need to count every combination that a 640×320 black and white display could possibly show.  And that really would include everything that could possibly be shown on that display.  So in the translation from an analogue photograph (for example) to a digital, 640×480 black and white image, the digitisation process takes something that has an infinite resolution down to one of a finite number of options – albeit still quite a large number of options.

Just adding in the 16 colours, we’d need a number that is 2 to the power of 1,228,800 – a binary number with over a million digits.  So, when you factor in for today’s typical resolutions, my current screen is 1024 x 1280 with “32 bit colour”.  That means a single screenshot from my computer is a number with 1024 x 1280 x 32 bits – or 2 to the power of 41,943,040.

So, how long would it take to cycle through the finite number of pictures that my computer monitor could potentially display?  Well my maths is too rusty to transfer a 40 million digit binary number over into decimal to divide by seconds, minutes, hours, days, years, centuries, millenia and so on.  But by way of some context, the Universe is something like 14bn years old (or there abouts).  That is 14,000,000,000 * 365 * 24 * 60 * 60 seconds or 43 followed by 16 zeros or so (in decimal).  In binary that would be a number of around 60 to 70 digits I think.  So we’d need to double the age of the universe over 40 million times if we were showing one screen a second, to cycle through the whole lot.

Such is the interesting power of contrasting infinite analogue resolution with finite digital resolution.  It is very large, it can display practically anything we can imagine, but actually it is still a finite number.  Just an unimaginarily large number.  But of course what is more interesting still, is that infinity is still a lot larger than that.

Kevin.

 

Advertisements

1 Comment

  1. Kevin said,

    This is great – another blog post on the same topic – http://www.realityprime.com/blog/2013/02/custom-software-will-produce-every-possible-digital-photograph/ – someone actually attempting to show all the pictures (kind of).

    And by referencing a 1993 usenet post, I have to concede he has claim to prior art 🙂

    Kevin

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: