Introduction to mathematics for computer science - learn by practice and share part two

base 16 pic mathematics
Base 16 - See a good example

Going back with my new tutorial on introduction to mathematics for computer science today!


Today you will learn:

          • what is binary number.
          •  convert beetween binary & decimal.

Let's start!


What is binary??


A binary system uses base 2. A binary system has only two digits: 0 and 1. Numbers in base 2 are called binary digits or simply bits for short. Binary numbers are based on powers of 2. Binary numbers have important applications in computer science and electronic engineering.

Note: The binary system is based upon powers of 2.

Now, I am going to show how to convert from binary to decimal.



⍰ Consider the binary number 1101012. As the base is 2 this means that powers of 2 essentially replace powers of 10:


So,                              1101012  =  1(25) + 1(24) + 0(23)+ 1(22)+ 0(21)+ 1(20)

                                                            =  1(32)+ 1(16)+ 0(8)+ 1(4)+ 0(2)+ 1(1)

                                                            =   32+16+4+1

                                                            = 5310


Now you can see 1101012 & 5310 is equivalent. 

Assignment: Now convert 11112 & 1010102 as a decimal number.

Now I am going to show how to convert decimal to binary:


We now look at some examples of converting numbers in base 10 to numbers in base 2, which is from decimal to binary. We make use of Table 1.0, which shows various powers of 2 when converting from decimal to binary. Table 1.0 may be extended as necessary.


Table 1.0: 
                            
 20 = 1 21= 2 22= 4 23= 8
 24= 16 25= 32 26= 64 27= 128
 28= 256 29= 512 210= 1024 

Now, I am going to show convert 8310 as a binary number.


⍰ Consider the decimal number 11010110 as a binary number.


We need to express 8310 as the sum of a set of numbers each of which is a power of 2.

 From Table 1.0 we see that 64 is the highest number in the table that does not exceed the given number of 83. 

                                   So, we write 83 =  64 + 19 


We now focus on the 19. 

Table 1.0, 16 is the highest number that does not exceed 19

                                  So we write 19 = 16 + 3 

                                  giving 83 = 64 + 16 + 3


We now focus on the 3 and again using Table 1.0 we may write :


                                83 = 64 + 16 + 2 + 1 

                                     = 26 + 24 + 21 + 20              

                                     = 1(26)+ 0(25)+ 1(24)+ 0(23)+ 0(22)+ 1(21)+ 1(20)

                                     = 10100112


Okay, I hope it's all okay for today! We have learned how to convert between binary and decimal.

If you like, consider sharing it.


Questions for you!


  1. Describe one way of converting decimal numbers to binary numbers.
  2. What number is the binary system based upon?
  3. How many different digits occur in the binary system?  

Comments

Popular posts from this blog

MIUI 12.6 Android 11 port for Poco M3 download - Well tested ROM

How Long to Keep Business Insurance Policies | Retain and Destroy Insurance Policies

RealMe GT NEO 2 Bootloader unlock method on windows 11 - Updated