Exploring Binary and Hexadecimal Numbers: Examples and Explanation

In summary: To convert a number in decimal to any other base, all you have to do is take the decimal number and continualy divide the number by the base keeping track of the remainderExample:8 (Base 10) to (Base 2)8/2 = 4 R 04/2 = 2 R 02/2 = 1 R 01/2 = 0 R 1Starting from the last remainder work your way up:1000 (base 2) = 8 (base 10)200 (base 10) to (base 16)
  • #1
courtrigrad
1,236
2
Hello all

I need help understanding binary and hexadecimal numbers. What exactly are they? Could you give me some examples?

Thanks
 
Computer science news on Phys.org
  • #2
I'm sure your familiar with the decimal(base 10) system: 0,1,2,3,4,5,6,7,8,9
Binary(base 2) is: 0,1
Hexadecimal (base 16) is : 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F

To convert a number in decimal to any other base, all you have to do is take the decimal number and continualy divide the number by the base keeping track of the remainder

Example:

8 (Base 10) to (Base 2)

8/2 = 4 R 0
4/2 = 2 R 0
2/2 = 1 R 0
1/2 = 0 R 1

Starting from the last remainder work your way up:

1000 (base 2) = 8 (base 10)

200 (base 10) to (base 16)

200/16 = 12 R 8
12 / 16 = 0 R 12 = C

C8 (base 16) = 200 (base 10)
 
  • #3
in base 10, 123 = 1x102+2x101+3x100=100+20+3=123 (base 10)

("hexadecimal")
in base 16, 123 = 1x162+2x161+3x160= 256+32+3= 291 (base 10)

("binary")
in base 2, 10010 = 1x24+0x23+0x22+1x21+0x20=16+0+0+2+0= 18 (base 10)
 
  • #4
Fairly detailed response

dduardo said:
I'm sure your familiar with the decimal(base 10) system: 0,1,2,3,4,5,6,7,8,9
Binary(base 2) is: 0,1
Hexadecimal (base 16) is : 0,1,2,3,4,5,6,7,8,9, A, B, C, D, E, F

we use a base 10 system like he said which is 0-9 or ten digit. you may not realize it but numbers are created by the rules of base ten.
our numbers say 352 are made up of combinations of base ten


3------5---------2
10^ 2 --10^1-----10^0

for biger numbers u would just continue the pattern
number
143,251


1---------4---------3---------2---------5-------1
10^5------10^4-------10^3-------10^2------10^1---10^0


we know we need to add another digit when we get higher than 9 which is the same when its in other bases except the digit you can go up to is different
in binary like he said you can only use 0 or 1

so you would count 0,1,2,3,4,5,6,7,8,9,10 in base ten and
Base 2 Base 10 equivilent Hex
(binary)
0 1 1
01 2 2
10 3 3
11 4 4
100 5 5
101 6 6
110 7 7
111 8 8
1000 9 9
1001 10 A
1010 11 B
1011 12 C
1100 13 D
1101 14 E
1110 15 F
1111 16 10
1001 17 11





It goes the same way
lets say we have 352 in base 10
what is that in binary

well let's do what we did for base 10 except with base 2


2^9--2^8----2^7----2^6----2^5---2^4---2^3----2^2-----2^1----2^0
512--256----128-----64------32----16-----8-------4-------2------1


now we take 352 and substract the first number under it that it can go into
so 512 is to big-- so we move to 256 and we can take 1 256 out of 352 (in binary it will always be one or 0 but it changes for differnent bases-- you will always at max be able to take the base number of times out of the orgiinal number) so

lets do it
352-256=96 (and you put a one on top of the 2^8 to represent you can take the 256 out)

0 ---1
2^9--2^8---- 2^7---- 2^6--- 2^5-- 2^4-- 2^3-- 2^2---2^1-----2^0
512----256--- 128---- 64----32-----16----8-----4-------2-------1

So now your left with 96
you can't take 128 out of 96 so you put a 0 there
continue in this fashion until you get the following

352-256=96
128 to big so 0 in 2^7
96-64=32 so one on top of 2^6
32-32=0 so one on top of 2^5
therefore since your are out the rest are zeros


0----1-------0------1 -------1-----0 ----- 0-------- 0--------0------0
2^9-- 2^8--2^7----2^6-----2^5--- 2^4--- 2^3----2^2-----2^1----- 2^0
512---256---128 -----64------32 ----- 16--- 8-------4--------2------1

so the binary representation of 352 is
0101100000
u don't need the leading 0 so
101100000

you can use this method to test the following numbers

13 = 1101
234 = 11101010
456 = 111001000
2547 = 100111110011



Now let's do the same thing for hex
take 352 again
we set it up the same way
we say 4096 is too big so we move down to 256 and see 256 can be taken out once so we put a one there
352-256=96
Now how many times can 16 go into 96:
the answer is 6 so we put a 6 there
96- 6(16)=0

0-------1-------6-------0
16^3----16^2---16^1----16^0
4096-----256-----16-------1

so the hex representation of 352 base 10 is 160

now let's try a harder one
take
9453

65536 is obviously too big so we move on to 4096
how many times can 4096 go into 9453
the answer is 2 so u put a 2 in on top of it

9453-2(4096)=1261

so we continue
how many times can 256 go into 1261
the answer is 4
so 1261-4(256) = 237

--0--------2--------4
16^4-----16^3----16^2---16^1----16^0
65536-----4096----256------16-----1


Now is where it gets tricky
how many times does 16 go into 237
the answer is 14--- but you can't put 14 in there because it needs to be a single digit-- that's when you remember that unlike base 2 which only has 2 digits or base 10 which has 10 digits (0-9) base 16 has 16 digits
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
just remember you treat the letter as you would the base 10 number -- just continue the sequence
so A is 10
B is 11
C is 12
D is 13
E is 14
F is 15

so instead of us saying 16 goes into 237 14 times we would say it goes into it E times


---0-------2--------4------E
16^4-----16^3----16^2---16^1---16^0
65536----4096------256----16 ------ 1

then we continue in the same fashion

so 237-E(16) or 237-14(16)= 13
so how many times does 1 go into 13
13 times
but remember what we just learned
we can't put 13 so we put D instead
10-A
11-B
12-C
13-D


----0------2--------4------E-------D
16^4----16^3----16^2---16^1---16^0
65536----4096-----256-----16------1


so the hex representation of 9453 is 24ED

here are some more for practice

173 - AD
8923 - 22DB
21723 - 54DB
66123 - 024B

ok that should do it for now i need to finish my homework
anyway here are some final tips
when you go from higher base to lower base
aka say from base 10 to 2
the number will always increase
when you go from lower base to higher the number will always decrease

note hopefully it will all line up
it did when i made it
 
Last edited:
  • #5
Is there anyway I can easily convert Hex into base 10, base 10 to Hex, or using any base converting it to another base, similar to dduardo's method?
 
Last edited:
  • #6
just follow what i did
it is the easyist way possible

unless you want a little trick

first convert into binary
say

you take 57 into binary which is 0111001
then separate into groups of 4 starting from the back
0111 1001
then you convert these small numbers into hex
so
0111=3
1001=9
and u get 39
 
  • #7
Hey thanks for all your help guys
 
  • #8
your welcome
 
  • #9
any other questions on base conversions?
 

Related to Exploring Binary and Hexadecimal Numbers: Examples and Explanation

1. What are binary and hexadecimal numbers?

Binary and hexadecimal numbers are alternative number systems used in computing and digital systems. They are composed of only two (binary) or sixteen (hexadecimal) digits, which represent the values of 0 and 1 (binary) or 0-9 and A-F (hexadecimal).

2. Why are binary and hexadecimal numbers important?

Binary and hexadecimal numbers are important because they are the basis of all digital systems and computing. They allow us to represent and manipulate data in a more efficient and compact way compared to the decimal system.

3. How do you convert from binary to hexadecimal (and vice versa)?

To convert from binary to hexadecimal, the binary number can be split into groups of four digits, starting from the right. Each group can then be converted into its corresponding hexadecimal digit. To convert from hexadecimal to binary, each hexadecimal digit can be converted into its corresponding four binary digits.

4. What are some examples of binary and hexadecimal numbers?

An example of a binary number is 10101101, which is equivalent to the decimal number 173. An example of a hexadecimal number is 3F2, which is equivalent to the decimal number 1010.

5. How are binary and hexadecimal numbers used in everyday life?

Binary and hexadecimal numbers are used in everyday life in various technologies such as computers, mobile phones, and digital cameras. They are also used in programming and coding, cryptography, and data storage and transmission.

Similar threads

Replies
4
Views
985
  • Computing and Technology
Replies
4
Views
818
  • Programming and Computer Science
Replies
3
Views
970
Replies
10
Views
945
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Linear and Abstract Algebra
Replies
2
Views
518
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Programming and Computer Science
2
Replies
57
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
10K
Back
Top