Now let's take a look at exactly why this works.
Let's represent a random number by a few variables. How about a 4 digit number, WXYZ.
The sum of the digits of this number will be (W + X + Y + Z).
Now, another way to represent this number is 1000W + 100X + 10Y + Z. When you take this, and subtract (W + X + Y + Z), you get 999W + 99X + 9Y.
It's fairly obvious that this number is divisible by 9. And, as you may remember from elementary school, the way to figure out if a given number is divisible by 9 is to check if the sum of the digits of the number add up to a multiple of nine. This is called the rule of nines.
And so, to get to nine, you just take that number and keep adding its digits each time getting a smaller multiple of 9, until you finally get to 9 itself. Fun!
Of course, it also works for larger numbers. You just end up with something along the lines of 999999999A + 99999999B + 9999999C + ... 99H + 9J for bigger numbers, which is of course still a multiple of 9, and thus can be reduced to 9 by continuing to add the digits together.
I was just reminded by dafydd that it doesn't work for 1 digit numbers! 8 - 8 = 0. Zero is NOT a multiple of 9. :)
Update: Ok, apparently that's wrong. 0 is a multiple of *all* integers. Doesn't really matter all that much.
But there's a quicker way to do it!
Mortice says re How to turn any number into a 9: Take a number, x. Add (9-x) to that number. Hooray!