If you’ve been using computers for a while or have seen the Matrix movies, you have probably seen, or at least heard of something called “binary”, which consists of a variety of 0s and 1s, arranged in seemingly random patterns.
However, did you ever stop to think what those 0s and 1s mean and how they are arranged?
In order to understand what the binary number system is all about, it is a good idea to have an understanding of the number system that we use all the time in everyday life – the decimal, or base 10, number system.
In the decimal number system, we can represent things, such as the number of people in a room, the time, how many apps you have on your phone, as well as a whole array of other things. All of the quantities that were just mentioned are probably written using the numbers 0-9. Including 0, there are 10 numbers in the decimal number system, which is why it is called “base 10”.
These numbers can be arranged in any order to form other, larger or smaller numbers, depending on which “place”, or position, a particular number is in. For example, if you have the number 123, there are three places, the one’s place, ten’s place, and hundred’s place.
If we wanted to, we could represent 123 by raising 10 to the power of the position a particular number is in, starting at 0 and going from right to left and then multiplying that figure by whatever number is in the position.
For our “123” example, we can represent 123 as:
3*100 + 2*101 + 1*102
When these numbers are added and then combined, we will arrive at the original number of 123.
(3*1) + (2*10) + (1*100)
= 3 + 20 + 100
The same is true of the binary, or base 2, number system. However, unlike the decimal number system, there are only 2 numbers which are used in the binary number system, which, as you probably guessed, are 0 and 1.
In binary, rather than having each “place” or position raise in value by powers of 10, they raise in value by powers of 2.
If we have, for example, the number 1010, in binary, which, in order to prevent readers, as well as people converting from one base to another, from getting confused, we can represent by putting the value in parenthesis and adding a “2” subscript, simply to represent the fact that the number is in base 2 and not base 10 or decimal, or even some other base, we can figure out what it is equal to in decimal notation, by performing the same process as we did earlier.
(1010)2 = (x)10
(1010)2 = 0 * 20 + 1 * 21 + 0 * 22 + 1 * 23
= (0*1) + (1*2) + (0 * 4) + (1 * 8 )
= 0 + 2 + 0 + 8
= (10) 10
So, 1010 in binary is equal to 10 in decimal, or base 10, notation. Because of the fact that this conversion happens to only involve the numbers 0 and 1, the parenthesis help to prevent confusion between which base is which, as 10 in decimal can be converted to 2 in binary.
Now that we’ve learned a bit about the binary number system, what does this have to do with computers or technology?
Well, at the most basic level, computers do not understand letters, numbers, symbols, or even pictures as the symbols or colors that users see when typing or viewing them. Computers see these things as strings of 0s and 1s, which, to the processor or CPU, means “on” or “off”.
Also at the basic level, programming languages, such as C, C++, or Java, which are intended to make things easier for programmers, rather than having to input large strings of 0s and 1s, are complied into a language which the computer can understand, which is sometimes referred to as “machine code”.
Eventually, this code is read by the computer’s processor, or CPU, as a binary file, and the computer then follows the instructions in a language that it, rather than users or programmers, can understand.
So, the next time you see a movie or come across something that involves binary, hopefully now, you’ll be able to understand a little more about how things are converted to binary, as well as what binary notation is actually used for, in terms of computers and technology.
If you’d like to learn more about compilers and what they do and are used for, as well as other topics, you should check out CodeHelp.co.uk, which is where I got some of the information regarding compilers and what they do, included in this post.
Also, if you have a computer related question that you are curious about, or perhaps just a tech support question, please feel free to send me an e-mail, using the “Contact” page! You can also follow TechnicalCafe on Twitter (@TechnicalCafe), as well as me (@Jamiemcg), if you’re interested in what I’m up on on a day-to-day basis.