Jump to content

Pocket Guide to Binary Code


Dark

Recommended Posts

[align=center]Your friend comes up to you one day and shows you a clever riddle:

 

10 - 1 = 1

 

This is obviously impossible, or is it? In the standard number system consisting of 0 through 9, this is a math error. If you add 1 to both sides of the equation, you receive '10 = 2', which is obviously incorrect. However, this riddle works with the binary system, which consists of 1's and 0's. Translated, this equation would be '2 - 1 = 1', which is hardly a riddle within itself.

 

Binary Code

 

Binary code has many uses, and is fairly easy to learn. Computer programming is the main reason to learn binary code, albeit the fact hex code sometimes outclasses it. Many calculators, online websites and iPhone apps can translate standard numbers into binary, but doing it yourself gives you satisfaction, and shows you can actually do something other than wasting your whole day on an internet forum.

 

As stated before, binary code uses 1's and 0's. But how can you convert 1's and 0's into numbers? Use this example:

 

... T U V W X Y Z

 

The '...' indicates that the sequence continues on forever. In this example, we will only be using 7 digits in binary, which means we can translate any number from 0 to 127, a total of 128 numbers.

 

The first thing you need to know is the pattern involved with place values of binary. In this example, 'Z' means 2^0, or 1. Z can either be 1 or 0 in binary. This means your final number will either be odd (1) or even (0). This is hard to understand at first, so let's look at a quick example.

 

11 into binary:

 

Binary uses powers of 2 as it's digits. Here is a quick table for the previous example:

 

Z = 2^0

Y = 2^1

X = 2^2

W = 2^3

V = 2^4

U = 2^5

T = 2^6

 

7 digits can convert any number from 0 to 127 into binary. 11 falls within this range.

 

First, let's look at T. T means how many 2^6 are in 11, or how many 64's are in 11. That would be 0.

 

0XXXXXX

 

Now, U. U means how many 2^5 are in 11, or how many 32's are in 11. That would be 0.

 

00XXXXX

 

Now, V. V means how many 2^4 are in 11, or how many 16's are in 11. That would also be 0.

 

000XXXX

 

Now let's go to W. W means how many 2^3 are in 11, or how many 8's are in 11. That would be 1.

 

0001XXX

 

Above is what we have so far. Since we have taken 8 out of 11, we must subtract it. So, 11 - 8 equals 3. The next 3 binary digits will be working on 3.

 

X. X means how many 2^2 are in 3, or how many 4's are in 3. That would be 0.

 

00010XX

 

Moving on to Y. Y means how many 2^1 are in 3, or how many 2's are in 3. That is 1.

 

000101X

 

Again, subtract the 2 from the 3. The last digit has to equal 1.

 

Finally, Z. Z means how many 2^0 are in 1, or how many 1's are in 1. Again, that is 1.

 

0001011

 

Take off the first three 0's, and you have your conversion:

 

11 = 1011

 

Let's do one more example for the first side of binary.

 

39 into binary:

 

39 also falls between 0 and 127, so we can use our 7 digit scale.

 

How many 64's in 39? 0.

How many 32's in 39? 1.

 

39 - 32 = 7

 

How many 16's in 7? 0.

How many 8's in 7? 0.

How many 4's in 7? 1.

 

7 - 4 = 3

 

How many 2's in 3? 1.

 

3 - 2 = 1

 

How many 1's in 1? 1.

 

0100111

 

Take off the first 0 and you have your conversion:

 

39 = 100111

 

Great! Now you know how to convert standard numbers into binary. But what about converting binary numbers into standard form? Lucky for you, it's a bit easier...

 

101100 into standard:

 

Let's take the binary code 101100, for an example. As we know, the right-most digit is how many 1's are in the equation, because 2^0 = 1.

 

So...

 

2^0 = 1 * 0 = 0

2^1 = 2 * 0 = 0

 

The 0's were pulled from the 2 right-most digits of the binary number. You correspond the right-most digit with the amount of 2^0's, the next left digit with 2^1's, and you continue with powers of 2.

 

2^2 = 4 * 1 = 4

2^3 = 8 * 1 = 8

2^4 = 16 * 0 = 0

2^5 = 32 * 1 = 32

 

Let's put together all of our information neatly.

 

2^0 = 1 * 0 = 0

2^1 = 2 * 0 = 0

2^2 = 4 * 1 = 4

2^3 = 8 * 1 = 8

2^4 = 16 * 0 = 0

2^5 = 32 * 1 = 32

 

Add every number in the right-most column of our data.

 

0 + 0 + 4 + 8 + 0 + 32 = 44

 

Therefore:

 

101100 = 44

 

Let's do one more example.

 

11011001 into standard:

 

2^0 = 1 * 1 = 1

2^1 = 2 * 0 = 0

2^2 = 4 * 0 = 0

2^3 = 8 * 1 = 8

2^4 = 16 * 1 = 16

2^5 = 32 * 0 = 0

2^6 = 64 * 1 = 64

2^7 = 128 * 1 = 128

 

Add the right-most column:

 

1 + 0 + 0 + 8 + 16 + 0 + 64 + 128 = 217

 

Therefore:

 

11011001 = 217

 

Tips and Tricks

 

When converting binary into standard, always start from the right and move to the left, so it's easier to calculate the high powers of 2. If you start from the left, it could take awhile to figure out what 2^7 is, when if you start from the right, you would know that since 2^6 is 64, and 64 * 2 is 128, 2^7 is 128.

 

Ending Statement

 

I hope this tutorial has taught you a bit about binary code, and you can apply this newfound knowledge in different aspects of life. Oh, and it also works when you want to know something another person does not.

 

Your friend is showing the class another riddle:

 

101 - 10 = 11

 

Your classmates are dumbfounded, but with a quick mental binary math, you realize that it is simply '5 - 2 = 3'.[/align]

Link to comment
Share on other sites

Guest JoshIcy
01010100 01101000 01101001 01110011 00100000 01100111 01110101 01101001 01100100 01100101 00100000 01110111 01100001 01110011 00100000 01101011 01101001 01101110 01100100 01100001 00100000 01110101 01110011 01100101 01100110 01110101 01101100 00100000 01100010 01110101 01110100 00100000 01001001 00100000 01100110 01101111 01110101 01101110 01100100 00100000 01101001 01110100 00100000 01100011 01101111 01101110 01100110 01110101 01110011 01101001 01101110 01100111 00101110 00100000 01010011 01101111 00100000 01001001 00100111 01101101 00100000 01110101 01110011 01101001 01101110 01100111 00100000 01100001 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01010100 01110010 01100001 01101110 01110011 01101100 01100001 01110100 01101111 01110010 00100000 01101001 01101110 01110011 01110100 01100101 01100001 01100100 00101110

Link to comment
Share on other sites

After I read this' date=' I went into my handy dandy text book and found a simplified version of this typed on a single table taking up about 1/3 of the page Dx

 

Still handy though! I liked reading it =']

 

Ehh, I tried to make my own version which was easier to understand.

 

01010100 01101000 01101001 01110011 00100000 01100111 01110101 01101001 01100100 01100101 00100000 01110111 01100001 01110011 00100000 01101011 01101001 01101110 01100100 01100001 00100000 01110101 01110011 01100101 01100110 01110101 01101100 00100000 01100010 01110101 01110100 00100000 01001001 00100000 01100110 01101111 01110101 01101110 01100100 00100000 01101001 01110100 00100000 01100011 01101111 01101110 01100110 01110101 01110011 01101001 01101110 01100111 00101110 00100000 01010011 01101111 00100000 01001001 00100111 01101101 00100000 01110101 01110011 01101001 01101110 01100111 00100000 01100001 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01010100 01110010 01100001 01101110 01110011 01101100 01100001 01110100 01101111 01110010 00100000 01101001 01101110 01110011 01110100 01100101 01100001 01100100 00101110

 

Are those strings of 8, or are they all meant to be in one binary sequence?

 

And did you want me to convert all of them?

Link to comment
Share on other sites

01010100 01101000 01101001 01110011 00100000 01100111 01110101 01101001 01100100 01100101 00100000 01110111 01100001 01110011 00100000 01101011 01101001 01101110 01100100 01100001 00100000 01110101 01110011 01100101 01100110 01110101 01101100 00100000 01100010 01110101 01110100 00100000 01001001 00100000 01100110 01101111 01110101 01101110 01100100 00100000 01101001 01110100 00100000 01100011 01101111 01101110 01100110 01110101 01110011 01101001 01101110 01100111 00101110 00100000 01010011 01101111 00100000 01001001 00100111 01101101 00100000 01110101 01110011 01101001 01101110 01100111 00100000 01100001 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01010100 01110010 01100001 01101110 01110011 01101100 01100001 01110100 01101111 01110010 00100000 01101001 01101110 01110011 01110100 01100101 01100001 01100100 00101110

 

What the hell did you just say? Sounds useful if I wasn't so lazy towards math...

Link to comment
Share on other sites

Pretty useful but...

0011000000110001001100010011000000110000001100010011000000110000001100000011000100110000001100000011000000110001001100010011000100110000001100010011000100110001001100000011000100110001001100010011000000110000001100010011000100110000001100010011000100110001001100000011000100110000001100010011000100110000001100010011000000110000001100010011000000110000001100010011000000110000001100000011000000110001001100000011000000110001001100000011000000110001001100000011000100110000001100000011000100110001001100010011000000110000001100010011000000110000001100000011000000110001001100010011000000110001001100010011000000110001001100000011000100110001001100000011000100110000001100000011000100110000001100010011000000110000001100010011000100110000001100010011000000110000001100000011000000110001001100010011000000110000001100000011000100110001001100000011000000110001001100010011000000110000001100010011000000110000001100010011000000110001001100000011000100110000001100010011000000110001001100010011000000110000001100010011000100110001001100000011000100110000001100000011000100110001001100010011000000110000001100010011000100110000001100010011000000110001001100000011000000110001001100000011000100110000001100000011000000110001001100000011000100110001001100000011000000110001001100010011000100110000001100010011000000110001001100010011000000110001001100000011000000110001001100010011000000110001001100010011000100110000001100000011000100110000001100010011000000110000001100010011000000110000001100000011000100110001001100000011000000110001001100010011000000110001001100000011000000110001001100000011000000110001001100000011000100110000001100000011000000110001001100000011000000110000001100000011000100110001001100000011000000110000001100010011000000110001001100000011000000110000001100010011000000110001

:3 Enjoy your malformed binary >=D

Link to comment
Share on other sites

There are 10 types of people in this world: those who understand binary' date=' and those who don't.

[/quote']

 

That was on a shirt at the MIT museum in Boston. :/

 

My head hurts =(

 

I can't really make it any easier. :[

 

:O

 

*Applauds*

 

No standing ovation? What is this, the 12th century?

Link to comment
Share on other sites

Thank you so much!

Now i finally understand those god dang extra credit problems...

 

Your welcome. I was bored' date=' so I decided to help the world (or at least part of YCM) by teaching them something on an intranetz forum.

 

i stopped after t u v w x y zmy brain was fried. how is that huge thing fitting into your poscket

 

Uhh... damnit.

 

You could use small print and small paper. :D

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...