The URL-shortening service, bit.ly, is heavily used on Twitter to help members stay within the 140-character limit for each tweet (post). According to a brief story by Ben Parr in Mashable, bit.ly took over first place in this market from TinyURL last August. If you are wondering how this could possibly be a “market” or why anyone would care, see the longer piece by Michael Arrington in TechCrunch from almost exactly a year ago.
Over that same year, I went from follower of a few people to occasional poster. I certainly noticed the bit.ly and TinyURL re-directs, but didn’t give them much thought. I do remember thinking, however, that the sum total of URLs that could be generated with a string of six characters, chosen from the 26 lower- and 26 upper-case letters plus the 10 digits, must be a pretty big number, but that was it.
Most of these shortened URLs look like this — http://bit.ly/9hfrXY — with a seemingly-random 6-character string at the end generated by some hash function or other algorithmic recipe. But early last month, in a tweet by “zen habits” (Leo Babauta), this URL caught my eye: http://bit.ly/byTT2t. It was the first one I could recall with duplicates of any of the six characters. The two upper-case “T”s meant that any of the potential 62 (=26+26+10, see above) characters could be repeated. And, if repeated once, why not more than once, which allowed not only “byTT2t,” but “byTTTt” and “bTyT2T” and on and on. This would mean, in turn, a far bigger universe of unique URLs for bit.ly to assign. But just how big?…
The answer is one of the simplest counting expressions for combinations: the number of ways you can choose R objects (allowing the possibility of repetition) from a total population of N objects is N^R (N raised to the power R).
It is easy to see this empirically. Try it with the population (1,2), that is, the first two digits of the whole numbers, so N=2. And take R=2. Then the only possible arrangements where the order of choice matters are these: (1,1), (1,2), (2,1), and (2,2). And indeed N^R = 2^2 = 4. If the population is the first three digits, (1,2,3), N=3. If you keep R=2, you can check very quickly that there are only nine possible arrangements, and indeed N^R = 3^2 = 9. QED, or close enough.
In the bit.ly example, N = 62 and R = 6, so 62^6 = 56,800,235,584, which is the answer to the “how big” question a few paragraphs up.
For a global perspective, according to the U.S. Census Bureau World POPClock Projection, that is roughly eight URLs for each person on the planet. Not many, if they were all active Twitter and bit.ly users. But just at a guess, most of those six-plus billion have never been online at all, let alone on Twitter. Surely, then, 56 billion re-directs should last the rest of us for a very long time, right? Hold that comforting thought for Part II….