Binary system explained (part 2)

Hi,
in the last post I wrote about converting from binary to decimal number. Today I will continue, if you want to read the basics about binary just check out the post. This is also linked to my post about counting to 1,023 on your fingers.


So lets say that we have number 137 and we want to convert it into binary.

You have seen in the previous post that there is some highest digit that has the value of 1 instead of 0 which means that it stores the information[1]. We need to find out this value.

Its easy, its the highest 2ª number smaller or equal to our original value (137).

Such a number is 128 which is 2^7 so it is going to be the 8th number since we use 2º too (and 2º is on the 1st place).
Now we subtract it having 137-128=9 (1xxxxxxx)

Now we repeat with 9. The number that is smaller or equal is 2³=8
9-8=1 and the next 1 that stores information is on the fourth position. (10001xxx)

1 is easy because 2º also equals to 1 and it is on the first place. So 137 looks like this in binary: 10001001.

Lets try 759:

759-512=247 (10th number is the first 1) =1xxxxxxxxx
247-128=119 (8th number is 1, stores the information) =101xxxxxxx119-64=55 (7th number is 1) =1011xxxxxx
55-32=23 (6th number is 1) =10111xxxxx
23-16=7 (5th number is 1) =101111xxxx
7-4=3 (3rd number is 1) =10111101xx
3-2 … 1-1 === 1011110111 (quite lucky with so many ones ;))

Hope this all makes sense, if it does not just write in the comments below.


Btw. thought you have infinitely many systems that you can use, binary is the simplest of them all. You can not store information in less symbols because with one symbol you would not be able to distinquish where one information ends and another begins. You need to use “space” or some number or something.

Dragallur

Advertisements

Binary system explained (part 1)

Hi,
in the last post I showed cool trick, how to use your fingers to calculate to 1,023. It was based on binary system but I did not explain it much there. Here I will go through the conversion from binary to decimal system, that we normally use, and back.


So all of these digits systems work with some number of symbols, 10 in decimal system for example. These digits means some number and when you run out of them you will just add another digit, for decimal system you have of course 0,1,2,3,4,5,6,7,8,9 and after 9 you have to start repeating previous symbols. Now if you think about it you could actually use this various ways, for example we write 10 but it could also be 00.

Binary system has 2 symbols only. 0 and 1. This means that you will have to use much more digits if you want to symbolise big number. Basically if you add one to number you display one higher symbol and you never skip any of them so there is given amount of numbers you can store in x number of digits. Because there are 10 symbols in decimal system you can display 100 different numbers (different combinations of these symbols) in two digits. From 0,1,2,3… to 97,98,99. This is 10² where the exponent is number of digits you have. For binary system the base will be two because you can store only two symbols in one digit. In two digits you can store 2² numbers.

This is good to know if we want to transfer from one system to the other, lets say that we have number in binary:

10011010

We want to change this number into decimal so that we understand it.
Every digit here stands for one of those exponents first digit (from the right) stands for 2º which is one and it either stores the number one or it does not. Since it is 0 and 0 is usually reffered to as empty, the first digit, again from the right, does not store any information[1].

2nd is for 2¹ and there is 1 which means that the information is there and we know that our final number (n) equals to the rest of the numbers plus 2.

We continue and there is no number on the next place but on the 3rd 2³ we have one which means that we remember this which equals 8. The next is 16 and the last one is even higher: 128. We now add all of them together to get 154 if I count right.

It is good to notice that with this system you can create any number you like because always this applies:

2ª=2^(a-1)+2^(a-2)+2^(a-3)..2^(1)+2^(0)+1

So
8=4+2+1+1

Because the post is quite long right now I will continue in the next post. I do not know when this will be because I am going on a trip this weekend and some days after but after I return there will definitely be new stuff 😉

Dragallur

[1]Same as zero in our system! If you have number: 00456 its just 456 of course that it is something different than 45600 where it moves the place where the numbers are but still it does not count to the final number!

How to! 7) Count to 1,023 on your fingers

Hi,
as promised, weekend post is here! Ok, so I learned this cool thing when I was on seminar in Hamburg. First I thought that someone is pointing middle finger at me for fun (you will see the reason soon) but it was actually counting method. Though you have only 10 fingers you can use them to produce all numbers from zero to 1,023 which is cool.


If you pay close attention and you know something about computers you know that the number 1,023 is very special. It is 1,024 but one smaller (1,024 is actually the special number).

The thing is that 2^10 is 1,024. And in computers you work in binary system with only 0 or 1  ….    on or off and you get the number of combinations that you can arrange binary system if you put 2 to the power of digits you have. On fingers you can not arrange 1,024, you will see why[1]:

Method

Turn you palms towards you. Since in Europe we write from left we will start with left thumb (palms still towards you). Now make fists.. that is number 0

Rise your thumb, that is 1. (1000000000)
Put only your index finger up, that is 2. (010000000)Put your thumb and index finger up, that is 3. (1100000000)  –> the number of digits shows the number of fingers you have.

So basically if you have number lets say 17. You want to transef it into binary. You will do this by subtracting the highest 2^x power which is equal or less to the number itself.

The 2^x numbers go like this: 1,2,4,8,16,32,64,128,256,512,1024…

In the case of 17 you will subtract 16 which is 5th number in the row. 5th finger on your palm is your left pinkie so you will put it up. Then you are left with 1 which you again subtract by the highest 2^x number which is equal or less and this time it is 1. 1 is first number and left thumb on your hands.

If you want 349 you have to subtract 256 (9th number – right index finger)
You are left with 93-64 (7th number – right ring finger)27-16 (5th number – left pinkie)
9-8 (4th number – left ring finger)
1-1 (1st number – left thumb)

Now train a little bit and impress your friends 😉 The key is to remember the first nine numbers and at what positions they are. Also you can show others just counting one by one. Just do not turn your hands towards them, numbers 4,5,128,640 and other could be dangerous 😀

Dragallur

[1]The reason why you can not count to 1,024 is of course that you are starting with 0 not 1 so your right thumb stands for 2^9 and not 2^10. You can produce another binary digit with your tongue 😉

How to! 5) Multiply two digit numbers in your head

Hi,
today I was sitting outside, chilling out and just as that I started to multiply numbers always adding one: 1*1=1 2*2=4 3*3=9 and so on. And I wondered, how far can this go without paper or calculator?


Well I finished with 100*100 without leaving single number and after a while I started to use this kind of fast and intuitive technique which in this post will be used only to multiply two same numbers smaller than 100.

Lets say you need to multiply 47*47.   (40+7)*(40+7)

Fourty will be called “base number”. The first thing you need to do is to multiply base numbers to get your base. This is simple because 40*40 is the same as 4*4 plus two zeros which means 1600.

Base is quite easy to remember so you do not need to concentrate on that much. Now we need to combine base numbers with, lets call them “pariah numbers”.

In our case pariah number is 7. You multiply it with base number to get 40*7=280 or simply 4*7=28 (+ zero from base number). Because we have two same brackets we need to multiply this twice and add it which is the same as multiplying your result by 2.

280*2=560

Now just add this “double number” to your base which should be quite easy:

1600+560=2160

Repeat this one few times and then add the product of two pariah numbers to get the result:

2160+(7*7)=2160+49=2209


Try this few times, and if you are sure in this simple case try any two digit numbers. It is quite nice way to warm up your brain 😉

Dragallur