1 / 13

Number system (real and binary)

The real and complex number systems<br>Basic Concepts Behind the Binary Number System<br>uf0b7 Binary Addition<br>uf0b7 Binary Subtraction<br>uf0b7 Binary Multiplication<br>uf0b7 Binary Division<br>uf0b7 Conversion from Decimal to Binary

lksaha
Download Presentation

Number system (real and binary)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Number System The real and complex number systems Which number did we learn first? I think it must be 1. Suppose you have 1 pen. If you buy another pen, how many pens you have altogether now? It must be 1 + 1 = 2. If you buy one more pen, then you have 2 + 1 = 3. If you buy another pen of different colour, then altogether you have 3 +1 = 4 pen. Continuing in this way we find the number 1, 2, 3, 4, 5, 6, 7, 8, 9,10, ……… Now suppose you have 50 taka in your pocket and you bought some bananas for 50 taka. Now if I ask you how much money remains in your pocket? The answer must be ‘no taka’. This ‘no taka’ in mathematics is expressed as ‘0’ (zero) taka. Thus 0 is another number. So, we have 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, ……… These numbers are called natural numbers or non-negative integers. The numbers 1, 2, 3, 4, 5, 6, 7, 8, 9,10, ………are called positive integers. Again suppose you have 100 taka. To buy a product you need 101 taka. Then if you are asked how much money you are in shortage of 101? It must be 1. In mathematics this shortage of 1 is expressed as 100 – 101 = -1 and call minus 1. Thus all negative integers -1, -2, - 3, -4, -5, ….. arose in mathematics. Now we have the numbers ………..-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, ……… These numbers are called in integers. If an integer is a multiple of 2, then it is called an even integer. For example, 2, 4, 6, 8, -2, -4, -6, -8…... are even integers. All other integer such as 1, -1,3,-3, 5, -5….,are called odd integers. If an integer is only divisible by 1 and by the integer itself, then it is called a prime number. For instance, 1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47,….. etc. are prime integers. Many more necessary numbers can be created using these integers. A kind of number in the following format can be created. a , , are integers and  . 0 b a b b 1 a  , Examples If a = 1, b =2, then a number. 2 b 2 4 7 12 9 11 , all are numbers. These numbers are called rational , , , , , ,..... Similarly, 3 5 8 7 7 6 numbers. Such numbers are also called fractional numbers. If the numerator is less than the denominator of a rational number, then we call this number as a proper fractional number; otherwise we call it as an improper fractional number. Note that every integer is a rational number because it can be expressed as a ratio of this number and 1. For instance, 3 3 is a rational number. Similarly, -7 =  7 is a rational number. 1 1 Now question arises whether every number can be expressed as a ratio of two integers. Let us see it as follows: Example: Can 2 be expressed as a ratio of two integers? Note that 2 = 1.41421355624…., that is, places after decimal never ends. So, it cannot be expressed as a ratio of two integers and hence it is not a rational umber. Thus ,...... 7 , 6 , 5 , 3 are not rational numbers. These numbers are called irrational numbers. A number which cannot be expressed as a ratio of two integers is called an

  2. irrational number. A number either rational or irrational is called a real number. The collection of all real number is called a real number system. Using these real numbers another kind of numbers had been created. This numbers can be expressed as follows: a + ib, ; 1   i a, b are real numbers These numbers are called complex numbers. Here a is called the real part and ib is called the imaginary part. Example 4 + i5, -3 +i7, 12 –i4, -23 -i12 are complex numbers. The real and imaginary parts of complex numbers are shown in the following figure: a + ib, a, b real numbers Complex Number System The rational and irrational parts of real numbers are shown in the following figure: Real Number System The integers and fractional parts of rational numbers are shown in the following figure: a + ib , a- real number Real Number System a + ib , b- a real number Imaginary number System Irrational Number System

  3. Rational Number System The parts of integers, natural (non-negative integers) numbers and negative integers are shown in the following figure: Integer Number System Countable Number System: The numbers of a system which are countable, that is, can be counted one after another is called a countable system of numbers. Example: The natural number system is countable, since all the numbers in this system can be counted. The first number in this system is 0. If you are asked, what is the next natural number? The answer will be 1. What is the next one? One can easily tell it is 2. The next one is 3. Thus all the natural numbers are countable. Exercise: i) Is the integer number system countable? ii) Is the rational number system countable? Uncountable Number System: If numbers in a system are not countable, then this system is called uncountable. Example: The real number system is not countable. Let us start from the real number 1. What is the next real number? We do not know the next real number. If you say, the next real number is 2. It is not correct, since 3/2 is greater than 1 but less than 2. If you say, the next real number is 3/2, then it is not true because the average of 1 and 3/2 is greater than 1 but less than 3/2. Thus between two real numbers there exit infinite number of real numbers and they cannot be counted. Integer Number System Fractional Number System (Proper and Improper) Negative Integers Natural Number System Or Non-negative Integers

  4. Real Number Line: All real numbers can be represented by a line as follows: -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 The above horizontal line represents all the real number. It is called a real number line. The part of the above horizontal line on the right of 0 represents the positive real numbers while the left side of zero represents the negative real numbers. In the real number line any real number at any position is greater than a real number on its left side. Similarly, all the real numbers can be represented by a vertical line as follows: 5 4 3 2 1 0 -1 -2 - 3 -4 -5 The part of the vertical line above 0 represents the positive real numbers while the part below 0 represents the negative real numbers. In the vertical real number line any real number at any position is greater than a real number below it. Exercise

  5. The Binary System Table of Contents Basic Concepts Behind the Binary Number System Binary Addition Binary Subtraction Binary Multiplication Binary Division Conversion from Decimal to Binary Basic Concepts of the Binary System Let us start with writing numbers in the decimal system. In the decimal system we use the digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 for writing a decimal number. For example, let us write the number 13. What does it mean by 13? It means addition of 3 ‘1’ s and 1‘10’, that is 13 = 1*10 + 3*1. But we know from law of indices that 10 = 101 and 1 = 100. So, 13 can be written as 13 = 1*101 + 3*100 Thus writing of the number 13 is based on 10. Let us try to understand the writing of a number in decimal system by another example. Let us see the meaning of 579. It can be written as follows: 579 = 5*100 + 7*10 + 9*1 = 5*102 + 7*101 + 9*100 Let us try for another example, 34896 = 3*10000 + 4*1000 +8*100 + 9*10 + 6*1 = 3*104 +4*103 + 8*102 + 9*101 + 6*100. Note that we use 10 digits for writing a decimal number and so it is based on 10. Thus every decimal number is based on ‘10’. Similarly, a number can be written using the digits 0 and 1 only. As we use only 2 (two) digits, it will be based on ‘2’. Let us try with 11 = 1*21 + 1*20 = 3 in the decimal system. Similarly, 101011 = 1*25 +0*24 + 1*23 + 0*22 + 1*21 +1*20 = 32 + 0 + 8 + 0 + 2 +1 = 43 in the decimal system. 1 in the decimal number systems is written as 1 in the binary number system. Because 1= 1*100 = 1*20. Two in the decimal number systems is written as 10 in the binary number system, that is, 2 = 2*100 = 1*21 + 0*20. Some comparative numbers in the decimal and in the binary number systems are given in the table below.

  6. Decimal Number 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Binary Number 1 = 1*20 10 = 1*21 + 0*20 11= 1*21 + 1*20 100 = 1*22 + 0*21 + 0*20 101 = 1*22 + 0*21 + 1*20 110 = 1*22 + 1*21 + 0*20 111 = 1*22 + 1*21 + 1*20 1000 = 1*23 +0*22 + 0*21 + 0*20 1001 = 1*23 +0*22 + 0*21 + 1*20 1010 = 1*23 +0*22 + 1*21 + 0*20 1011 = 1*23 +0*22 + 1*21 + 1*20 1100 = 1*23 +1*22 + 0*21 + 0*20 1101 = 1*23 +1*22 + 0*21 + 1*20 1110 = 1*23 +1*22 + 1*21 + 0*20 1111 = 1*23 +1*22 + 1*21 + 1*20 10000 =1*24 +0*23 + 0*22 + 0*21 + 0*20 10001 =1*24 +0*23 + 0*22 + 0*21 + 1*20 10010 =1*24 +0*23 + 0*22 + 1*21 + 0*20 10011 =1*24 +0*23 + 0*22 + 1*21 + 1*20 10100 =1*24 +0*23 + 1*22 + 0*21 + 0*20 Exercises: Convert the following binary numbers into decimal numbers. i) 11101 ii) 110111 iii) 11111 iv) 1011011 v) 111111011 vi) 11101101 vii) 11101101 Convert the following decimal numbers into binary numbers i) 27 ii) 25 iii) 33 iv) 37 v) 49 vi) 64 vii) 75 Binary Addition Example 1 Add the binary numbers 01 and 11. Let us set the addition in the following format: 01 11 --------

  7. Like addition of decimal numbers, start from right side. Add 1 and 1 on the right hand side. 1+1 = 2. In binary system it is written as 10. Put 0 at the right hand position beneath the line as follows and carry 1. 01 11 -------- 0 Now add next two digits 0 and 1 in the second position from the right and 1 you carried as follows: 0 + 1 + 1 (carry) = 2, which can be written in binary format as 10. 01 = 0*21 + 1*20 = 1 11 = 1*21 + 1*20 = 3 ------- 100 = 1*22 + 0*21 + 0*20 = 4 (3 + 1) Example 2 Following this process of addition add the binary numbers 1101 and 1111. Let us set the addition in the following format: 1101 1111 --------------- Add 1 and 1 on the right hand side. 1+1 = 2. In binary system it is written as 10. Put 0 at the right hand position beneath the line as follows and carry 1. 1101 1111 --------------- 0 Now add next two digits 0 and 1 in the second position from the right and 1 you carried as follows: 0 + 1 + 1 (carry) = 2, which can be written in binary format as 10. Now put 0 in the second position from right beneath the line as follows and carry 1. 1101 1111 --------------- 00 Next add the digits 1, 1 with the carry 1, that is, 1 + 1 +1 = 3. In binary system it is written as 11. Put 1 at the third position from left beneath the line as follows and carry 1. Following this process of addition as in decimal system complete this addition as follows: 1101 = 1*23 +1*22 + 0*21 +1*20 = 13 1111 = 1*23 +1*22 + 1*21 +1*20 = 15 ---------- 11100 = 1*24 + 1*23 + 1*22 +0*21 + 0*20 = 28 (13 + 15) Example 3 Following this process of addition add the binary numbers 10101 and 1111. Let us set the addition in the following format: 10101 1111 ---------------

  8. Like addition of decimal numbers, start from right side. Add 1 and 1 on the right hand side. 1+1 = 2. In binary system it is written as 10. Put 0 at the right hand position beneath the line as follows and carry 1. 10101 1111 --------------- 0 Now add next two digits 0 and 1 in the second position from the right and 1 you carried as follows: 0 + 1 + 1 (carry) = 2, which can be written in binary format as 10. Now put 0 in the second position from right beneath the line as follows and carry 1. 10101 1111 --------------- 00 Next add the digits 1, 1 with the carry 1, that is, 1 + 1 +1 = 3. In binary system it is written as 11. Put 1 at the third position from left beneath the line as follows and carry 1. Following this process of addition as in decimal system complete this addition as follows: 10101 = 1*24 + 0*23 +1*22 + 0*21 +1*20 = 21 1111 = 1*23 +1*22 + 1*21 +1*20 = 15 ---------- 100100 = 1*25 + 0*24 + 0*23 +1*22 + 0*21 +0*20 = 36 (21 +15) Exercise Following this process of addition shown above complete the following addition: i) 111 + 100 ii) 10101 + 10001 iii) 11100 + 100000 iv) 110101 + 100100 v) 1110011 + 1000100 Binary Subtraction Example 1 Subtract 10 from 11. Set the subtraction as follows: 11 = 1*21 +1*20 = 3 (-) 01 = 0*21 +1*20 = 1 ------ 10 = 1*21 +0*20 = 2 (3 – 1) Example 2 Subtract 1001 from 1011. Set the subtraction as follows: 1011 = 1*23 +0*22 + 1*21 +1*20 = 11 (-) 1001 = 1*23 +0*22 + 0*21 +1*20 = 9 ------- 0010 = 0*23 +0*22 + 1*21 +0*20 = 2 (11 – 9) Example 3 Subtract 101 from 1000. Set this subtraction as follows: 1000 (-) 0101 ---------

  9. Note that each of the first and the third digits of the top number from right side is less than the corresponding digit of the bottom number. To explain the subtraction of this type let us see the subtraction of a decimal number of the same type. Consider the subtraction of 2789 from 3123, that is, 3123 – 2789. Let us set the subtraction as follows: 3123 2789 -------- 334 Note that in this subtraction when the upper digit is less than lower digit (for example, 3 < 9), then we add 10 (the base for decimal number) to the upper digit and then subtract the lower digit from sum of 10 and the upper digit. In case of subtraction of binary numbers, similarly we add 2 to the upper digit in the similar situation. Now let us do the subtraction of 1000 (-) 0101 ------- Since 0 < 1 in the first position from the right side, add 2 to 0, 2 + 0 = 2 and then subtract 1 from 2, that is, 2-1= 1. This is shown below. 1000 0101 -------- 1 (carry 1) Now we have to subtract 1 from 0, which is not possible and so add 2 to 0, 2 + 0 = 2. Now subtract carry 1 from 2, 2 -1 = 1. This subtraction is shown below: 1000 0101 -------- 11 (carry 1) Add carry 1 to the next lower left side digit, that is, 1 + 1 = 2. Again, 0 < 2, so add 2 to 0, that is, 2 + 0 = 2. Now subtract 2 from 2, that is 2 – 2 = 0. This subtraction is shown below. 1000 0101 -------- 011 (carry 1) Now 1 - 1 = 0, so the final subtraction is as follows: 1000 = 1*23 +0*22 + 0*21 +0*20 = 8 0101 = 0*23 +1*22 + 0*21 +1*20 = 5 -------- 0011 = 0*23 +0*22 + 1*21 +1*20 = 3 (8-5) Example 4 Subtract 10010 from 11100. Set this subtraction as follows: 11100 (-) 10010 --------- 0 Since 0 < 1 in the second position from the right side, add 2 to 0, 2 + 0 = 2 and then subtract 1 from 2, that is, 2-1= 1. This is shown below. : 11100

  10. (-) 10010 --------- 10 (carry 1) Now we have to subtract 1 (carry) from 1, that is, 1 – 1 = 0, which is shown below: 11100 (-) 10010 ----------- 010 The final subtraction is as follows: 11100 = 1*24 +1*23 + 1*22 + 0*21 +0*20 = 28 ( -) 10010 = 1*24 +0*23 + 0*22 + 1*21 +0*20 = 18 ---------- 01010 = 0*24 +1*23 + 0*22 + 1*21 +0*20 = 10 (28 – 18) Exercise: Complete the following subtraction i) 1011 – 1000 ii) 1101 – 1001 iii) 111111 -101010 iv) 100001 – 10111 v) 1111001 – 1000110 Binary Multiplication Example 1 Multiply 111 by 101 Let us set this multiplication as follows: 111 (*) 101 ------ Multiply 1*1(right side digits) = 1, which is written as 01. Put 1 as shown below and carry 0. This is shown below: 111 (*) 101 ----- 1 (carry 0) Then multiply the second digit at the top number by 1 as 1*1 = 1 and add carry 0 (carry) as 1 + 0 = 1, which can be written as 01. Put 1 as shown below and carry 0. 111 (*) 101 ----- 11 (carry 0) Again multiply the third digit of the top number by 1 as 1*1 =1 and carry 0 as 1+0 =1, which can be written as 01. So, put 1 at the left side as follows: 111 101 ----- 111 Now multiply the first digit 1 from the right of the top number by second digit 0 from the right of the bottom number as 1*0 = 0, which can be written as 00. Put 0 as shown below and carry 0. 111 101

  11. ----- 111 0x (carry 0) Next multiply second digit 1 from right of the top number by the second digit 0 of the bottom number as 1*0 = 0, which can be written as 00. Put 0 as shown below and carry 0. 111 101 ----- 111 00x (carry 0) Following this procedure complete the multiplication as follows: 111 101 ---------- 111 000x 111xx ---------- Now add the three binary numbers at the bottom as follows: 111= 1*22 +1*21 + 1*20 = 7 101= 1*22 +0*21 + 1*20 = 5 --------- 111 000x 111xx --------- 100011 = 1*25 +0*24 + 0*23 +0*22 + 1*21 +1*20 = 35 (7*5) Example 2 Multiply 11 by 01. 11 = 1*21 + 1*20 = 3 01 = 0*21 + 1*20 = 1 ------ 011 00x ------- 011 = 0*22 + 1*21 + 1*20 = 3 (3*1) Example 3 Multiply 10101 by 11001 = 1*24 + 1*23 + 0*22 + 0*21 +1*20 = 25 10101 = 1*24 + 0*23 + 1*22 + 0*21 +1*20 = 21 ---------- 011001 00000x 011001x 00000x 011001x ------------------ 1000001101 = 1*29 + 0*28 + 0*27 + 0*26 +0*25 + 0*24 + 1*23 + 1*22 + 0*21 +1*20 = 525 (25*21) Exercise Complete the following multiplications

  12. i) (111)*(101) ii) (1010)*(1001) iii) (111)*(11) iv) (1001)*(0111) v) (1011)*(101) Binary Division Let us start with an example of division of 111 by 10 as follows: Example 1 10 ) 111 (11 10 11 10 01 Note that 111 = 1*22 + 1*21 +1*20 = 7 11 = 1*21 +1*20 = 3 and 10 = 1*21 +0*20 = 2 111 (7) = 10*11 (2*3)+ 01(1) Example 2 111 ) 11111 (100 111 00011 Note that 11111 = 1*24 + 1*23 +1*22 + 1*21 +1*20 = 31 111 = 1*22 + 1*21 +1*20 = 7 100 = 1*22 + 0*21 +0*20 = 4 and 11 = 1*21 +1*20 = 3 11111 (31) = 111*100 (7*4) + 00011 (3) Example 3 1010) 110001 (100 1010 001001 Note that 110001 = 1*25 + 1*24 + 0*23 +0*22 + 0*21 +1*20 = 49 1010 = 1*23 + 0*22 + 1*21 +0*20 = 10 (in decimal system) 100 = 1*22 + 0*21 +0*20 = 4 and 1001 = 1*23 + 0*22 + 0*21 + +1*20 = 9 110001 (49) = 1010*100 (10*4) + 1001 (9) Exercise: i) Divide 1011 by 101 ii) Divide 10101 by 1011 iii) Divide 11101 by 1010 iv) Divide 11100110 by 1111 v) Divide 1110011 by 1111 Conversion of Decimal to Binary To convert a decimal number to a binary number follow the following algorithmic step. Step 1 Raise the power of 2 by 1 at each step starting from 1 until it is greater than or equal to the number. .Step 2 If 2n is greater than the number,choose n positions for placing the binary digits 0 or 1. Step 3 Otherwise choose (n+1) positions for placing the binary digits 0 or 1. Step 4 If 2n is equal to the given decimal number then put 1 in (n+1) position from right. Fill all other positions by 0 and stop. Step 5 Otherwise put 1 in the nth position from right and subtract 2n-1 from the given number and record the resultant value. Step 6 Again raise the integer power of 2, say 2m until it is greater than or equal to the resultant value. Step 7 If 2m is equal to the resultant value, put 1 in the (m+1)th position from right and fill all

  13. other positions by 0 and stop. Step 8 Otherwise put 1 in the mth position from right and subtract 2m-1 from the resultant value and again record the new resultant value. Along with the resultant value continue this process of filling up the selected positions until all positions are filled up by 0 or 1. Let us start with an example of converting a decimal to a binary number. Example 1 Convert 54 into the binary number. 26 = 64 > 54, so we choose 6 positions and put 1 in 6th position from right as follows: -- - - - - 1 Now 54 – 32 (26-1) = 22 Again 25 = 32 > 22. So, 1 in the 5th position as follows: - - - - - - 1 1 Note that 22 – 16 (25-1) = 6. 23 = 8 > 6. So, put 1 in the 3rd position as follows: - - - - - - 1 1 1 Again 6 – 4 (23-1) = 2 21 = 2. So 1 will be in (1+1)th position and remaining positions will be filled up by 0 as follows: - - - - - - 1 1 0 1 1 0 Exercise Convert the following decimal numbers into binomial numbers. i) 12 ii) 27 iii) 49 iv) 87 v) 97

More Related