Number Bases. Ioan Despi. University of New England. August 4, 2013

Similar documents
MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

Conversions between Decimal and Binary

Numbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.

ENGIN 112 Intro to Electrical and Computer Engineering

12/31/2010. Digital Operations and Computations Course Notes. 01-Number Systems Text: Unit 1. Overview. What is a Digital System?

Week No. 06: Numbering Systems

3 The fundamentals: Algorithms, the integers, and matrices

Menu. Review of Number Systems EEL3701 EEL3701. Math. Review of number systems >Binary math >Signed number systems

Recurrence Relations

14:332:231 DIGITAL LOGIC DESIGN. Why Binary Number System?

NUMBERS AND CODES CHAPTER Numbers

We say that the base of the decimal number system is ten, represented by the symbol

EE260: Digital Design, Spring n Digital Computers. n Number Systems. n Representations. n Conversions. n Arithmetic Operations.

4 Number Theory and Cryptography

A group of figures, representing a number, is called a numeral. Numbers are divided into the following types.

Why digital? Overview. Number Systems. Binary to Decimal conversion

Mathematical Induction

Chapter 2 (Part 3): The Fundamentals: Algorithms, the Integers & Matrices. Integers & Algorithms (2.5)

CSE 241 Digital Systems Spring 2013

CHAPTER 2 NUMBER SYSTEMS

Binary addition example worked out

CSEN102 Introduction to Computer Science

ENGIN 112 Intro to Electrical and Computer Engineering

REVIEW Chapter 1 The Real Number System

L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen

EDULABZ INTERNATIONAL NUMBER SYSTEM

Counting in Different Number Systems

4. Number Theory (Part 2)

L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen

Chapter 5. Number Theory. 5.1 Base b representations

A number that can be written as, where p and q are integers and q Number.

CISC 1400 Discrete Structures

SECTION 2.3: LONG AND SYNTHETIC POLYNOMIAL DIVISION

ECE380 Digital Logic. Positional representation

Discrete Mathematics GCD, LCM, RSA Algorithm

Apply basic properties of real and complex numbers in constructing mathematical arguments (e.g., if a < b and c < 0, then ac > bc)

Math Review. for the Quantitative Reasoning measure of the GRE General Test

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

CP Algebra 2. Summer Packet. Name:

Chapter 1: Fundamentals of Algebra Lecture notes Math 1010

Four Important Number Systems

SEVENTH EDITION and EXPANDED SEVENTH EDITION

ALGEBRA 1. Interactive Notebook Chapter 2: Linear Equations

Decimal Addition: Remember to line up the decimals before adding. Bring the decimal straight down in your answer.

Section 3-4: Least Common Multiple and Greatest Common Factor

14:332:231 DIGITAL LOGIC DESIGN. 2 s-complement Representation

Number Theory: Representations of Integers

Chapter 1 CSCI

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

ELEMENTARY NUMBER THEORY AND METHODS OF PROOF

CSE 20: Discrete Mathematics

1 Numbers. exponential functions, such as x 7! a x ; where a; x 2 R; trigonometric functions, such as x 7! sin x; where x 2 R; ffiffi x ; where x 0:

You separate binary numbers into columns in a similar fashion. 2 5 = 32

Chapter 9 - Number Systems

Chapter 2 INTEGERS. There will be NO CALCULATORS used for this unit!

SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION

Hakim Weatherspoon CS 3410 Computer Science Cornell University

ABE Math Review Package

Math From Scratch Lesson 29: Decimal Representation

Quantitative Aptitude

MHF4U Unit 2 Polynomial Equation and Inequalities

Expressions, Equations and Inequalities Guided Notes

Prepared by Sa diyya Hendrickson. Package Summary

Cool Results on Primes

The Euclidean Algorithm

Digital Systems Overview. Unit 1 Numbering Systems. Why Digital Systems? Levels of Design Abstraction. Dissecting Decimal Numbers

COT 3100 Applications of Discrete Structures Dr. Michael P. Frank

Linear Equations & Inequalities Definitions

Number System conversions

Maths Book Part 1. By Abhishek Jain

Numbers and Arithmetic

THE LOGIC OF COMPOUND STATEMENTS

Sail into Summer with Math!

UNIT 4 NOTES: PROPERTIES & EXPRESSIONS

Numbers. Dr Hammadi Nait-Charif. Senior Lecturer Bournemouth University United Kingdom

Maths Scheme of Work. Class: Year 10. Term: autumn 1: 32 lessons (24 hours) Number of lessons

Fundamentals of Mathematics I

CSCI 255. S i g n e d N u m s / S h i f t i n g / A r i t h m e t i c O p s.

STEP Support Programme. Hints and Partial Solutions for Assignment 17

0,..., r 1 = digits in radix r number system, that is 0 d i r 1 where m i n 1

Part I, Number Systems. CS131 Mathematics for Computer Scientists II Note 1 INTEGERS

Notes on arithmetic. 1. Representation in base B

ARITHMETIC AND BASIC ALGEBRA

Long and Synthetic Division of Polynomials

Common Core State Standards for Mathematics Bid Category

Math 0310 Final Exam Review

Mathematics Pacing. Instruction: 9/7/17 10/31/17 Assessment: 11/1/17 11/8/17. # STUDENT LEARNING OBJECTIVES NJSLS Resources

Math 016 Lessons Wimayra LUY

REAL NUMBERS. Any positive integer a can be divided by another positive integer b in such a way that it leaves a remainder r that is smaller than b.

An Invitation to Mathematics Prof. Sankaran Vishwanath Institute of Mathematical Science, Chennai. Unit - I Polynomials Lecture 1B Long Division

Division Algorithm B1 Introduction to the Division Algorithm (Procedure) quotient remainder

K K.OA.2 1.OA.2 2.OA.1 3.OA.3 4.OA.3 5.NF.2 6.NS.1 7.NS.3 8.EE.8c

JUST THE MATHS UNIT NUMBER 1.4. ALGEBRA 4 (Logarithms) A.J.Hobson

Chapter 1. Pigeonhole Principle

PRE-ALGEBRA SUMMARY WHOLE NUMBERS

Number Systems. There are 10 kinds of people those that understand binary, those that don t, and those that expected this joke to be in base 2

Numbers. 2.1 Integers. P(n) = n(n 4 5n 2 + 4) = n(n 2 1)(n 2 4) = (n 2)(n 1)n(n + 1)(n + 2); 120 =

We say that a polynomial is in the standard form if it is written in the order of decreasing exponents of x. Operations on polynomials:

Radiological Control Technician Training Fundamental Academic Training Study Guide Phase I


Transcription:

Number Bases Ioan Despi despi@turing.une.edu.au University of New England August 4, 2013

Outline Ioan Despi AMTH140 2 of 21 1 Frequently Used Number Systems 2 Conversion to Numbers of Different Bases 3 Repeated Division Algorithm 4 Conversion of the decimal part of a number

Frequently Used Number Systems Ioan Despi AMTH140 3 of 21 The numbers used most frequently in our daily life are written in the standard decimal number system, e.g., 7086 = 7 10 3 + 0 10 2 + 8 10 1 + 6 10 0

Frequently Used Number Systems Ioan Despi AMTH140 3 of 21 The numbers used most frequently in our daily life are written in the standard decimal number system, e.g., 7086 = 7 10 3 + 0 10 2 + 8 10 1 + 6 10 0 The base number in the decimal system is 10, whose special role is obvious in the above example, implying there are exactly 10 digits required for the system.

Frequently Used Number Systems Ioan Despi AMTH140 3 of 21 The numbers used most frequently in our daily life are written in the standard decimal number system, e.g., 7086 = 7 10 3 + 0 10 2 + 8 10 1 + 6 10 0 The base number in the decimal system is 10, whose special role is obvious in the above example, implying there are exactly 10 digits required for the system. These 10 elementary digits are 0, 1, 2,..., 9

Frequently Used Number Systems Ioan Despi AMTH140 3 of 21 The numbers used most frequently in our daily life are written in the standard decimal number system, e.g., 7086 = 7 10 3 + 0 10 2 + 8 10 1 + 6 10 0 The base number in the decimal system is 10, whose special role is obvious in the above example, implying there are exactly 10 digits required for the system. These 10 elementary digits are 0, 1, 2,..., 9 In general, a nonnegative number in a base p number system is denoted by (a n a n 1... a 1 a 0 b 1 b 2... b N...) p, representing the value of a n p n + a n 1 p n 1 +... + a 1 p 1 + a 0 p 0 + b 1 p 1 + b 2 p 2 +... + b N p N +...

Frequently Used Number Systems Ioan Despi AMTH140 4 of 21 We note that a 0,..., a n and b 1, b 2... are all just digits, coming from a set of p elementary digits for the number system.

Frequently Used Number Systems Ioan Despi AMTH140 4 of 21 We note that a 0,..., a n and b 1, b 2... are all just digits, coming from a set of p elementary digits for the number system. In other words,

Frequently Used Number Systems Ioan Despi AMTH140 4 of 21 We note that a 0,..., a n and b 1, b 2... are all just digits, coming from a set of p elementary digits for the number system. In other words, If base number is p, we use p elementary digits to represent all numbers in base p.

Frequently Used Number Systems Ioan Despi AMTH140 4 of 21 We note that a 0,..., a n and b 1, b 2... are all just digits, coming from a set of p elementary digits for the number system. In other words, If base number is p, we use p elementary digits to represent all numbers in base p. The elementary digits represent values from 0 to (p 1), respectively.

Frequently Used Number Systems Ioan Despi AMTH140 4 of 21 We note that a 0,..., a n and b 1, b 2... are all just digits, coming from a set of p elementary digits for the number system. In other words, If base number is p, we use p elementary digits to represent all numbers in base p. The elementary digits represent values from 0 to (p 1), respectively.

Frequently Used Number Systems Ioan Despi AMTH140 4 of 21 We note that a 0,..., a n and b 1, b 2... are all just digits, coming from a set of p elementary digits for the number system. In other words, If base number is p, we use p elementary digits to represent all numbers in base p. The elementary digits represent values from 0 to (p 1), respectively. Example 1. When base number p = 2, the system is called the binary number system. Two digits are needed, and these two digits are chosen to be 0 and 1, consistently representing the values of 0 and 1 respectively. For example, (1011.1) 2 = 1 2 3 + 0 2 2 + 1 2 + 1 + 1 1 2 = (11.5) 10, i.e., 1011.1 2 is equal to 11.5 in decimal. Note that the brackets can be dropped.

Examples Ioan Despi AMTH140 5 of 21 Example 2. When base p = 8, the system is called the octal number system. Naturally, we still conveniently use the existing first eight digits in the decimal system, i.e., 0, 1, 2,..., 7, to denote the corresponding values for the new number system. For example, 13.7 8 = 1 8 1 + 3 8 0 + 7 8 1 = 11.875, i.e., 13.7 8 represents the decimal number 11.875.

Examples Ioan Despi AMTH140 5 of 21 Example 2. When base p = 8, the system is called the octal number system. Naturally, we still conveniently use the existing first eight digits in the decimal system, i.e., 0, 1, 2,..., 7, to denote the corresponding values for the new number system. For example, 13.7 8 = 1 8 1 + 3 8 0 + 7 8 1 = 11.875, i.e., 13.7 8 represents the decimal number 11.875. Example 3. When p = 10, the system is our standard decimal number system. Thus, for instance, (36429) 10 is just 36429.

Examples Ioan Despi AMTH140 6 of 21 Example 4. When p = 16, the system is called the hexadecimal number system. 16 digits are needed in this system, representing values from 0 to 15. We shall still make use of the ten digits 0, 1,..., 9 from the decimal number system, and use A, B, C, D, E, F as symbols to make up for the rest of the digits. Hence the digits for the hexadecimal system are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F representing (in base 10) 0 to 15, respectively. For example, A7F 16 = A 16 2 + 7 16 1 + F 16 0 = 10 16 2 + 7 16 + 15 1 = 2687

Conversion to Numbers of Different Bases Ioan Despi AMTH140 7 of 21 Recall that for all integers a and b (a, b Z), we say that b divides a if and only if (iff) there exists an integer c ( c Z) such that a = bc. b a iff c Z, a = bc

Conversion to Numbers of Different Bases Ioan Despi AMTH140 7 of 21 Recall that for all integers a and b (a, b Z), we say that b divides a if and only if (iff) there exists an integer c ( c Z) such that a = bc. b a iff c Z, a = bc When b divides a, we call b a divisor of a.

Conversion to Numbers of Different Bases Ioan Despi AMTH140 7 of 21 Recall that for all integers a and b (a, b Z), we say that b divides a if and only if (iff) there exists an integer c ( c Z) such that a = bc. b a iff c Z, a = bc When b divides a, we call b a divisor of a. If b divides a (a = bc), then so does c so divisors always come in pairs.

Conversion to Numbers of Different Bases Ioan Despi AMTH140 7 of 21 Recall that for all integers a and b (a, b Z), we say that b divides a if and only if (iff) there exists an integer c ( c Z) such that a = bc. b a iff c Z, a = bc When b divides a, we call b a divisor of a. If b divides a (a = bc), then so does c so divisors always come in pairs. If a and b are positive integers, then if a divides b and b divides a, then a = b. (prove it!)

Conversion to Numbers of Different Bases Conversion of a number in one base system to another base system can be done from the definitions, e.g., (45) 6 = 4 6 1 + 5 6 0 = 29 (first converted to the decimal system) = 20 + 8 + 1 = 4 5 + 2 4 + 1 = 4 (4 + 1) + 2 4 + 1 = 1 4 2 + 3 4 1 + 1 4 0 = (131) 4 Ioan Despi AMTH140 8 of 21

Conversion to Numbers of Different Bases Conversion of a number in one base system to another base system can be done from the definitions, e.g., (45) 6 = 4 6 1 + 5 6 0 = 29 (first converted to the decimal system) = 20 + 8 + 1 = 4 5 + 2 4 + 1 = 4 (4 + 1) + 2 4 + 1 = 1 4 2 + 3 4 1 + 1 4 0 = (131) 4 What we were doing was find how many 4 s were hiding in 29 and it involved a form of repeated division. Ioan Despi AMTH140 8 of 21

Conversion to Numbers of Different Bases Conversion of a number in one base system to another base system can be done from the definitions, e.g., (45) 6 = 4 6 1 + 5 6 0 = 29 (first converted to the decimal system) = 20 + 8 + 1 = 4 5 + 2 4 + 1 = 4 (4 + 1) + 2 4 + 1 = 1 4 2 + 3 4 1 + 1 4 0 = (131) 4 What we were doing was find how many 4 s were hiding in 29 and it involved a form of repeated division. However, the procedure in the above example doesn t seem systematic and may be cumbersome to perform in general to say the least. Ioan Despi AMTH140 8 of 21

Conversion to Numbers of Different Bases Conversion of a number in one base system to another base system can be done from the definitions, e.g., (45) 6 = 4 6 1 + 5 6 0 = 29 (first converted to the decimal system) = 20 + 8 + 1 = 4 5 + 2 4 + 1 = 4 (4 + 1) + 2 4 + 1 = 1 4 2 + 3 4 1 + 1 4 0 = (131) 4 What we were doing was find how many 4 s were hiding in 29 and it involved a form of repeated division. However, the procedure in the above example doesn t seem systematic and may be cumbersome to perform in general to say the least. Hence we shall introduce below an algorithm, involving repeated division, to convert numbers from one base system to another. Ioan Despi AMTH140 8 of 21

Conversion to Numbers of Different Bases Ioan Despi AMTH140 9 of 21 Theorem (Remainder Theorem) For any integers p and q with p > 0, there exist integers s and r such that q = sp + r, 0 r < p (1)

Conversion to Numbers of Different Bases Ioan Despi AMTH140 9 of 21 Theorem (Remainder Theorem) For any integers p and q with p > 0, there exist integers s and r such that q = sp + r, 0 r < p (1) Proof. Let s start by proving that if s and r exist, then they are unique. So we know that q = sp + r, and 0 r < p for some s and r in Z. Then q p = s + r p and 0 r p < 1 Therefore, the definition of flooring implies that s = q p. Thus, if (1) holds, then s is uniquely determined as the floor of q/p. And from (1) it follows that r = q sp is also unique.

Conversion to Numbers of Different Bases Proof. Now we prove the existence of s and r satyisfying (1). We set q q s := and r := q sp := q p p p Obviously, s and r, so defined, are integers and they satisfy equation (1). It only remains to show that r satisfies the inequalities in (1). We know that q q q p p < 1 + p Multiplying both inequalities by p > 0, we get q q p q < p + p p p then by multiplying the first inequality by 1 we get q 0 q p := r, so 0 r p and from the second one we get q r := q p < p, so r < p p Ioan Despi AMTH140 10 of 21

Repeated Division Algorithm The Remainder Theorem is used in the repeated division algorithm to convert a decimal integer a N to a number of base p. It produces the digits r 0, r 1, r 2,... of the number a in base p. Ioan Despi AMTH140 11 of 21

Repeated Division Algorithm The Remainder Theorem is used in the repeated division algorithm to convert a decimal integer a N to a number of base p. It produces the digits r 0, r 1, r 2,... of the number a in base p. Ioan Despi AMTH140 11 of 21

Ioan Despi AMTH140 11 of 21 Repeated Division Algorithm The Remainder Theorem is used in the repeated division algorithm to convert a decimal integer a N to a number of base p. It produces the digits r 0, r 1, r 2,... of the number a in base p. Algorithm 3 Repeated Division by p (1) a = pq 0 + r 0, 0 r 0 < p, Remainder Theorem on a (2) q 0 = pq 1 + r 1, 0 r 1 < p, R.T. on q 0 (3) q 1 = pq 2 + r 2, 0 r 2 < p, R.T. on q 1.. (m + 1) q m 1 = pq m + r m, 0 r m < p, and q m = 0 Termination Condition is the representation in the base p number sys- Then a = (r m r m 1 r 1 r 0 ) p tem.

Ioan Despi AMTH140 12 of 21 Conversion of the decimal part of a number To convert a non-integer number b with 0 < b < 1 to a base p number system, the procedure is as follows Algorithm 4 Conversion of the decimal part of a number (1) bp = s 1 + t 1, s 1 = bp, s 1 is the integer part of bp (2) t 1 p = s 2 + t 2, s 2 = t 1 p, s 2 is the integer part of t 1 p (3) t 2 p = s 3 + t 3, s 3 = t 2 p, s 3 is the integer part of t 2 p.. (m) t m 1 p = s m + t m, s m = t m 1 p, procedure terminates at m if t m = 0.. otherwise continue forward is the representation in the base p number sys- Then b = (0.s 1 s 2 s m ) p tem.

Conversion Ioan Despi AMTH140 13 of 21 We note that while

Conversion We note that while the algorithm for converting an integer into a different base will always terminate in finite number of steps, Ioan Despi AMTH140 13 of 21

Conversion Ioan Despi AMTH140 13 of 21 We note that while the algorithm for converting an integer into a different base will always terminate in finite number of steps, the conversion of a non-integer may not terminate at all, although we usually can still stop in finite number of steps after observing a repeating pattern.

Conversion Ioan Despi AMTH140 13 of 21 We note that while the algorithm for converting an integer into a different base will always terminate in finite number of steps, the conversion of a non-integer may not terminate at all, although we usually can still stop in finite number of steps after observing a repeating pattern. The proofs of the above two algorithms are essentially no more than the re-interpretation of a = r m p m + r m 1 p m 1 + + r 1 p + r 0, b = s 1 p + s 2 p 2 + + s m p m +.

Examples Ioan Despi AMTH140 14 of 21 Example 5. Convert 45 to base 4. (1) 45 = 11 4 + 1 (2) 11 = 2 4 + 3 (3) 2 = 0 4 + 2 Hence 45 = (231) 4. stop now because it s become 0 That is, we first divide 45 by 4.

Examples Ioan Despi AMTH140 14 of 21 Example 5. Convert 45 to base 4. (1) 45 = 11 4 + 1 (2) 11 = 2 4 + 3 (3) 2 = 0 4 + 2 Hence 45 = (231) 4. stop now because it s become 0 That is, we first divide 45 by 4. The quotient 11 is then divided by 4, with the new quotient 2 being again divided by 4.

Examples Ioan Despi AMTH140 14 of 21 Example 5. Convert 45 to base 4. (1) 45 = 11 4 + 1 (2) 11 = 2 4 + 3 (3) 2 = 0 4 + 2 Hence 45 = (231) 4. stop now because it s become 0 That is, we first divide 45 by 4. The quotient 11 is then divided by 4, with the new quotient 2 being again divided by 4. This repeating process is then stopped because the latest quotient has reached 0.

Examples Ioan Despi AMTH140 14 of 21 Example 5. Convert 45 to base 4. (1) 45 = 11 4 + 1 (2) 11 = 2 4 + 3 (3) 2 = 0 4 + 2 Hence 45 = (231) 4. stop now because it s become 0 That is, we first divide 45 by 4. The quotient 11 is then divided by 4, with the new quotient 2 being again divided by 4. This repeating process is then stopped because the latest quotient has reached 0. The remainders obtained at these division steps, when listed in the reverse order, finally give the desired representation of 45 in base 4.

Examples Ioan Despi AMTH140 14 of 21 Example 5. Convert 45 to base 4. (1) 45 = 11 4 + 1 (2) 11 = 2 4 + 3 (3) 2 = 0 4 + 2 Hence 45 = (231) 4. stop now because it s become 0 That is, we first divide 45 by 4. The quotient 11 is then divided by 4, with the new quotient 2 being again divided by 4. This repeating process is then stopped because the latest quotient has reached 0. The remainders obtained at these division steps, when listed in the reverse order, finally give the desired representation of 45 in base 4. Probe: (231) 4 = 2 4 2 + 3 4 1 + 1 4 0 = 32 + 12 + 1 = 45.

Examples Ioan Despi AMTH140 15 of 21 Example 6. Convert 123 into binary. (1111011) 2 1 123 2 1 123 1 61 2 61 0 30 2 123 = 61 2 + 1 1 15 2 1 7 2 successive divisions 1 3 2 1 1 2 0 end when quotient becomes zero Hence 123=1111011 2. We illustrate here an alternative approach to number conversions.

Examples Ioan Despi AMTH140 15 of 21 Example 6. Convert 123 into binary. (1111011) 2 1 123 2 1 123 1 61 2 61 0 30 2 123 = 61 2 + 1 1 15 2 1 7 2 successive divisions 1 3 2 1 1 2 0 end when quotient becomes zero Hence 123=1111011 2. We illustrate here an alternative approach to number conversions. It uses exactly the same algorithm as before, and the only difference lies in the organisation or presentation of the derivation.

Examples Ioan Despi AMTH140 15 of 21 Example 6. Convert 123 into binary. (1111011) 2 1 123 2 1 123 1 61 2 61 0 30 2 123 = 61 2 + 1 1 15 2 1 7 2 successive divisions 1 3 2 1 1 2 0 end when quotient becomes zero Hence 123=1111011 2. We illustrate here an alternative approach to number conversions. It uses exactly the same algorithm as before, and the only difference lies in the organisation or presentation of the derivation. Obviously you don t have to bother with this approach if you don t like it: the approach adopted in the previous example is already neat enough.

Examples Ioan Despi AMTH140 16 of 21 Example 7. Convert 0.1 to base 2. (1) 0.1 2 = 0 + 0.2 (2) 0.2 2 = 0 + 0.4 (3) 0.4 2 = 0 + 0.8 Hence 0.1 = (0.000110011 ) 2 = (0.0 0011) 2. (4) 0.8 2 = 1 + 0.6 (5) 0.6 2 = 1 + 0.2 0.2 is repeating the outcome of step (1) integer part/portion

Blockwise Conversion Ioan Despi AMTH140 17 of 21 If p = q k and p, q and k are all positive integers, then the conversion of (a n... a 1 a 0 b 1 b 2...) p into base q can be done digitwise, with each digit a i or b j being mapped to a block of k consecutive digits in the base q number system.

Blockwise Conversion Ioan Despi AMTH140 17 of 21 If p = q k and p, q and k are all positive integers, then the conversion of (a n... a 1 a 0 b 1 b 2...) p into base q can be done digitwise, with each digit a i or b j being mapped to a block of k consecutive digits in the base q number system. This is called the blockwise conversion.

Examples Ioan Despi AMTH140 18 of 21 Example 8. Convert (7A.1) 16 into binary format. Solution. Since 16 = 2 4, 1 digit in hexademical will correspond to exactly 4 digits in binary. Since 7 16 = 0111 2, A = 1010 16 2, 1 16 = 0001 2, make sure they are all full 4-bit blocks we have (7A 1) 16 = (01111010.0001) 2.

Examples Ioan Despi AMTH140 19 of 21 Example 9. Convert the binary number (1111010.0001) 2 to base 8. Solution. Since 8 = 2 3 implies every 3 consecutive digits, going left or right starting from the fractional point, in binary will correspond to a single digit in base 8. By grouping consecutive digits into blocks of 3, appending proper 0 s if necessary, we have (1111010.0001) 2 = (001 111 010.000 100) 2 = (172.04) 8 because 001 2 = 1 8, 111 2 = 7 8, 010 2 = 2 8 and 100 2 = 4 8.

Examples Ioan Despi AMTH140 20 of 21 Basic direct operations such as additions and subtractions can be performed in any number systems in a similar way to what we would do in the standard decimal system. Example Find 343 5 + 114 5. i.e., 343 5 + 114 5 = 1012 5. 3 1 4 1 3 + 1 1 4 1 0 1 2 3 + 4 = 7 = (12) 5

Examples Ioan Despi AMTH140 20 of 21 Basic direct operations such as additions and subtractions can be performed in any number systems in a similar way to what we would do in the standard decimal system. Example Find 343 5 + 114 5. i.e., 343 5 + 114 5 = 1012 5. 3 1 4 1 3 + 1 1 4 1 0 1 2 3 + 4 = 7 = (12) 5 We note that the addition is performed digitwise from the rightmost digit towards the left.

Examples Ioan Despi AMTH140 20 of 21 Basic direct operations such as additions and subtractions can be performed in any number systems in a similar way to what we would do in the standard decimal system. Example Find 343 5 + 114 5. i.e., 343 5 + 114 5 = 1012 5. 3 1 4 1 3 + 1 1 4 1 0 1 2 3 + 4 = 7 = (12) 5 We note that the addition is performed digitwise from the rightmost digit towards the left. On the rightmost digit, 3 5 + 4 5 = 7 10 = (12) 5 gives the resulting digit 2 and the carry 1 to the next digit on the left.

Examples Ioan Despi AMTH140 20 of 21 Basic direct operations such as additions and subtractions can be performed in any number systems in a similar way to what we would do in the standard decimal system. Example Find 343 5 + 114 5. i.e., 343 5 + 114 5 = 1012 5. 3 1 4 1 3 + 1 1 4 1 0 1 2 3 + 4 = 7 = (12) 5 We note that the addition is performed digitwise from the rightmost digit towards the left. On the rightmost digit, 3 5 + 4 5 = 7 10 = (12) 5 gives the resulting digit 2 and the carry 1 to the next digit on the left. On the 2nd rightmost digit, we have thus 4 5 + 1 5+ (carry) 1 5 = 6 10 = (11) 5, resulting to digit 1 plus a new carry 1.

Examples Ioan Despi AMTH140 20 of 21 Basic direct operations such as additions and subtractions can be performed in any number systems in a similar way to what we would do in the standard decimal system. Example Find 343 5 + 114 5. i.e., 343 5 + 114 5 = 1012 5. 3 1 4 1 3 + 1 1 4 1 0 1 2 3 + 4 = 7 = (12) 5 We note that the addition is performed digitwise from the rightmost digit towards the left. On the rightmost digit, 3 5 + 4 5 = 7 10 = (12) 5 gives the resulting digit 2 and the carry 1 to the next digit on the left. On the 2nd rightmost digit, we have thus 4 5 + 1 5+ (carry) 1 5 = 6 10 = (11) 5, resulting to digit 1 plus a new carry 1. As the last step, we then have 3 5 + 1 5 + 1 5 = 5 10 = (10) 5.

Examples Ioan Despi AMTH140 20 of 21 Basic direct operations such as additions and subtractions can be performed in any number systems in a similar way to what we would do in the standard decimal system. Example Find 343 5 + 114 5. i.e., 343 5 + 114 5 = 1012 5. 3 1 4 1 3 + 1 1 4 1 0 1 2 3 + 4 = 7 = (12) 5 We note that the addition is performed digitwise from the rightmost digit towards the left. On the rightmost digit, 3 5 + 4 5 = 7 10 = (12) 5 gives the resulting digit 2 and the carry 1 to the next digit on the left. On the 2nd rightmost digit, we have thus 4 5 + 1 5+ (carry) 1 5 = 6 10 = (11) 5, resulting to digit 1 plus a new carry 1. As the last step, we then have 3 5 + 1 5 + 1 5 = 5 10 = (10) 5. This completes our addition.

Ioan Despi AMTH140 21 of 21 Example 11. Find 10011 2 101 2. Examples Hence 10011 2 101 2 = 1110 2. 1 0 0 1 1 1 0 1 1 1 1 0 The subtraction is also performed digitwise from the rightmost digit towards the left.

Ioan Despi AMTH140 21 of 21 Example 11. Find 10011 2 101 2. Examples Hence 10011 2 101 2 = 1110 2. 1 0 0 1 1 1 0 1 1 1 1 0 The subtraction is also performed digitwise from the rightmost digit towards the left. On the rightmost digit, 1 2 1 2 = 0 2 gives the resulting digit 0.

Ioan Despi AMTH140 21 of 21 Example 11. Find 10011 2 101 2. Examples Hence 10011 2 101 2 = 1110 2. 1 0 0 1 1 1 0 1 1 1 1 0 The subtraction is also performed digitwise from the rightmost digit towards the left. On the rightmost digit, 1 2 1 2 = 0 2 gives the resulting digit 0. On the 2nd rightmost digit, 1 2 0 2 = 1 2 gives the result 1.

Ioan Despi AMTH140 21 of 21 Example 11. Find 10011 2 101 2. Examples Hence 10011 2 101 2 = 1110 2. 1 0 0 1 1 1 0 1 1 1 1 0 The subtraction is also performed digitwise from the rightmost digit towards the left. On the rightmost digit, 1 2 1 2 = 0 2 gives the resulting digit 0. On the 2nd rightmost digit, 1 2 0 2 = 1 2 gives the result 1. On the 3rd rightmost digit, we borrow 1 from the digit on the left; actually we have to borrow 1 further on the left because the digit on the immediate left is 0 and therefore can t be borrowed.

Ioan Despi AMTH140 21 of 21 Example 11. Find 10011 2 101 2. Examples Hence 10011 2 101 2 = 1110 2. 1 0 0 1 1 1 0 1 1 1 1 0 The subtraction is also performed digitwise from the rightmost digit towards the left. On the rightmost digit, 1 2 1 2 = 0 2 gives the resulting digit 0. On the 2nd rightmost digit, 1 2 0 2 = 1 2 gives the result 1. On the 3rd rightmost digit, we borrow 1 from the digit on the left; actually we have to borrow 1 further on the left because the digit on the immediate left is 0 and therefore can t be borrowed. The subtraction on the 3rd rightmost digit thus becomes (10) 2 1 2 = 2 10 1 10 = 1 10 = 1 2.

Ioan Despi AMTH140 21 of 21 Example 11. Find 10011 2 101 2. Examples Hence 10011 2 101 2 = 1110 2. 1 0 0 1 1 1 0 1 1 1 1 0 The subtraction is also performed digitwise from the rightmost digit towards the left. On the rightmost digit, 1 2 1 2 = 0 2 gives the resulting digit 0. On the 2nd rightmost digit, 1 2 0 2 = 1 2 gives the result 1. On the 3rd rightmost digit, we borrow 1 from the digit on the left; actually we have to borrow 1 further on the left because the digit on the immediate left is 0 and therefore can t be borrowed. The subtraction on the 3rd rightmost digit thus becomes (10) 2 1 2 = 2 10 1 10 = 1 10 = 1 2. Finally, the 4th rightmost digit, after borrowed 1 from the left and being borrowed 1 from the right, is left with the remaining 1.

The subtraction is also performed digitwise from the rightmost digit towards the left. On the rightmost digit, 1 2 1 2 = 0 2 gives the resulting digit 0. On the 2nd rightmost digit, 1 2 0 2 = 1 2 gives the result 1. On the 3rd rightmost digit, we borrow 1 from the digit on the left; actually we have to borrow 1 further on the left because the digit on the immediate left is 0 and therefore can t be borrowed. The subtraction on the 3rd rightmost digit thus becomes (10) 2 1 2 = 2 10 1 10 = 1 10 = 1 2. Finally, the 4th rightmost digit, after borrowed 1 from the left and being borrowed 1 from the right, is left with the remaining 1. Ioan Despi This AMTH140 completes the subtraction. 21 of 21 Example 11. Find 10011 2 101 2. Examples Hence 10011 2 101 2 = 1110 2. 1 0 0 1 1 1 0 1 1 1 1 0