PIC 10A

(Sec. 3a-3d)

C++ Programming and Problem Solving

Instructor: Ivo Dinov, Asst. Prof.
Neurology, Mathematics, Statistics

    http://www.math.ucla.edu/~dinov/10a.3.01s/


HOMEWORK 6

Additional description of the binary numbering system


Any binary number, say 10011 is composed of 0's and 1's. The main question is how to assign a correspondence between such binary words (numbers) and the numbers we are quite familiar with, the 10-base numbers?!? Well, one way to do this, and this is an established rule, is to go ahead and list in order all binary numbers of length 3, say:

000
001
010
011
100
101
110
111

Then a meaningful conversion to 10-base would be:

000 --> 0 == 4*0 + 2*0 + 1*0
001 --> 1 == 4*0 + 2*0 + 1*1
010 --> 2 == 4*0 + 2*1 + 1*0
011 --> 3 == 4*0 + 2*1 + 1*1
100 --> 4 == 4*1 + 2*0 + 1*0
101 --> 5 == 4*1 + 2*0 + 1*1
110 --> 6 == 4*1 + 2*1 + 1*0
111 --> 7 == 4*1 + 2*1 + 1*1

Similarly, we extend this correspondence to an arbitrary binary number. The only remaining question is: Why the (underlined) factors 1, 2, 4, 8, 16, ..., of which we only showed the first 3? And the answer is simple, this is because there are 2 choices for a binary number of length 1; 4 choices for a binary number of length 2; 8 choices for a binary number of length 3; etc. I hope this makes sense,


\Ivo D. Dinov, Ph.D., Department of Neurology and Program in Computing, UCLA School of Medicine/