Binary numbers techniques

Binary numbers is an special numbers which is made up of only two digits 0 & 1 .
How to convert decimal numbers in binary no
I have two approach to do it .

  1. Left to right method
  2. Right to left method

I know both techniques very well, and I always use left to right method only in mind .
But I tell you both techniques.

How they work?
**
Left to right method
**
I show you this method with an example
Binary number of 25
To find this - First think which is the nearest power of 2 here .
It can done easily in mind.
I got it nearest power of 2 here is 16 - (2^4)
We don’t take 32 (2^5) because it is greater than 25.
Now we go in decreasing order of 2 power in mind.
Our aim is to make 25 with adding of 2 power.
16 > 8 > 4 > 2 > 1
1 1 0 0 1
16 + 8 + 1 = 25
The digits which we choose for adding to make 25 numbered 1 and that we don’t take is numbered 0
Note : first we take 16 and after this take 8
Now it becomes 24 . Now we do not take 4 & 2
because when adding it becomes greater than 25.
Another example -
Binary number of 156
128>64>32>16>8>4>2>1
1 0 0 1 1 1 0 0
First we chose 128. (1)
Then we don’t take 64 & 32 because after adding this no. became bigger than 156. (00)
Then we take 16 so our no. became 144 (1)
And then we choose 8 , now it is 144+8 =152 (1)
And last we take 4 , so finally we get 152+4 = 156(1)
And now our no. is complete so for 2 & 1 (00)

Example -
Binary number of 4576
4096 2048 1024 512 256 128 64 32 16 8 4 2 1
= 1000111100000
**
Right to left method
**
In this method, we are halving the number until 1 is not come (Remainder is not considered except 1)
We take 1 for odd numbers and 0 for even numbers.
Example
65
First we half the number.
1 < 2 < 4 < 8 < 16 < 32 < 65
Now we write this in binary form
1000001
I hope it will help you.
If you don’t know what is binary , decimal system and want to learn number system you can visit
below the link.

https://en.m.wikipedia.org/Wiki/Numeral_system

:kissing_heart::kissing_heart::kissing_heart::kissing_heart::kissing_heart:

Alternatively, first do dec2hex and then hex2bin. The latter you can read straight off with a little bit of practice, the former is multiples of 16.

Makes most sense in the range 0 … 255 but that’s usually what it is anyway.

@bjoern.gumboldt
Can you give me , some example that you can say. and method of working.

100_{10} = {\color{red}{6}}{\color{green}{4}}_{16} = 0110\ 0100_{2} \\
\frac{100}{16} = {\color{red}{6}}\frac{{\color{green}{4}}}{16} \\
  1. Take the \color{red}whole\ number part of the mixed fraction for your your left-hand-side (lhs) and the \color{green}numerator for your right hand side (rhs).
  2. Individually convert from hexadecimal
    a) Write lhs as binary {\color{red}{6}}_{16} = 0110_{2}
    b) Write rhs as binary {\color{green}{4}}_{16} = 0100_{2}

Another example:

200_{10} = {\color{red}{C}}{\color{green}{8}}_{16} = 1100\ 1000_{2} \\
\frac{200}{16} = {\color{red}{C}}\frac{{\color{green}{8}}}{16} \\

…you can think of C as 12 if you prefer base10 notation. This works without much effort up to 16^2-1:

255_{10} = {\color{red}{F}}{\color{green}{F}}_{16} = 1111\ 1111_{2} \\
\frac{255}{16} = {\color{red}{F}}\frac{{\color{green}{F}}}{16} \\

Things you need to know for this method:

  • A - F in binary
  • 16 times table
1 Like

@bjoern.gumboldt
Can you tell me how can you typing colourful words.

Thanks for explaining binary.
Your method, working for how many numbers?

No idea what you mean… it’s a simple base conversion; it works for all the numbers.

16=2^{\color{red}{4}}

Thus converting from base _{16} \to base _{2} gives you \color{red}4 digits in binary for each digit in hexadecimal.

FEC84210_{16}=1111\,1110\,1100\,1000\,0100\,0010\,0001\,0000_2
1 Like

Just type \color{red} (or any other color) inside Latex commands.
For example:

10^{\color{red}2}

can be made like this:
$10^{\color{red}2}$

2 Likes

For beginners I use the following technique:

If the number is odd write a 1 and subtract 1. If even, write 0.
Now half.
Repeat and write the new numbers to the left.

Example of 100, like above:

100 is even: 0
50 is even: 00
25 odd: 100
12: 0100
6: 00100
3: 100100
1: 1100100

Done. However, should you repeat:
0: 01100100

I think it was already stated above, but going from binary to hexadecimal is just splitting the number in parts of 4 = 0110 0100 and converting each part into hex: 64.

100_{10} = 0110\ 0100_{2} = 64_{16}

That is then the reverse of what I was saying earlier. I think for people comfortable in base 2, 8, and 16 (or at least for me) the 96 as a multiple of 16 would be very obvious when it comes to 100. So that’s 6 with a remainder of 4. Now just write first 6 and then 4 as binary; and done.

Agreed, that’s a very easy technique… especially for younger students that are not yet familiar working in different bases. Obviously, it involves more steps… but taking half and half over and over is really hard not to understand.

1 Like

Yes, that’s what I thought.

Absolutely!
If you know that 96 is 6 * 16 - which most people with an interest in mental calculation probably do - then it indeed becomes a lot easier.

100 decimal = 96 + 4 = 64 hex.

And yes, then 64 hex is easy to translate to binary.

For people who don’t know me. My father was a director at IBM’s.
I was born in 1967 and made toddler drawings on programming punch cards, like these:

He would bring boxes full of these things!

Also he would tell us about the binary and hexadecimal system and its use.
I remember doing hexadecimal long division while in a restaurant when I was young.

It helps mental calculation a lot when you can do these conversions easily, so I heavily advise to do these.

For a while just take each decimal number and convert to hexadecimal.
167 decimal = 160 + 7 = 10 * 16 +7 = A7 Hex.

Easy peasy!

3 Likes

Of course another way to convert dec2bin is via octal… taking your example 167:

2 x 64 = 128 leaves you with 39
4 x 8 = 32 leaves you with 7
7 x 1 = 7

For people who wonder where these multipliers come from: 8² = 64; 8¹ = 8; 8⁰ = 1

247₈ = 010 100 111₂ = A7₁₆ = 1010 0111₂

Pro: 0 - 7 to bin is the same from oct as it is from hex
Con: 64 (i.e., 8²) happens 4x earlier than 256 (i.e., 16²)

Lol… that’s awesome!

This is awesome

I was asked to explain how this works.

If number is odd the last digit is 1 in binary.
If a number is even the last digit is 0 in binary.

Subtracting one in case of is odd and dividing by two removes the last digit.

If I repeat this I discover the most right digit at each step and subsequently remove it.

So one by one I discover digit by digit.

Can I use the same system for octal and other bases? Sure!

Let’s take the above example of 167 (decimal).
The nearest number divisible by 8 is 160.
So subtract 160 from 167 to get 7.
That is the most right number.

Continue with 160.
Divide this by 8 to get 20.
Nearest multiple of 8 below 20 is 16.
Subtract 16 from 20 to get 4.
Result now is 47.

Continue with 16
Divide this by 8 to get 2.
Nearest multiple of 8 below 2 does not exist so we are done.

Result is 247.

2 Likes

This works fantastically!

And what I just explained is the reverse of what you do.

Well, I guess it’s time to drive this point home then for future readers of this post: if you want to convert to base _2, you can use 2^x as an intermediary base; where x will be the number of bits when converting from base _{2^x} \to base _2.

So one last time 167 but this time in base _{32}; and since 2^5=32 we know that bits will be in groups of 5.

\frac{167}{32} = {\color{red}{5}}\frac{{\color{green}{7}}}{32} \\

{\color{red}5_{32}}=00101_2 ;\ {\color{green}7_{32}}=00111_2

∴ 167_{10}={\color{red}5}{\color{green}7}_{32}=00101\ 00111_2

1 Like

Ok, let’s do something that is never used: base 11.

If we use A through F for the extra symbols in hex, we need only ‘A’ for base 11.

So 10 decimal is ‘A’ base 11.

Let’s convert 167_{10} again.

Here is how I do this.

My mind goes:

100_{11} = 11_{10} \,\,^2 = 121_{10}
In plain English; 100 in base 11 is 11 squared, is 121.

167 - 121 = 46 left to be done (decimal).

Closest factor of 11 in 46 is 44.
Of course 44 = 11 * 4, so add 40_{11} to 100_{11} to get 140_{11} .

Last step 46 - 44 = 2 and 2 < 11 so just add 2 to 140_{11} to get:
142_{11}.

3 Likes

How about 2i as the base?

167_{10}=102030303_{2i}

…or we could pretend that the 1010 0111 we’ve been getting was quater-imaginary instead of binary and convert it to decimal:

1010 0111_{2i}={\color{gray}{-128i+32i-4+2i+1}}=-94i-3

1 Like