Additive Numbering Systems and Numbers of Different Bases MAT 142 RSCC Scott Surgent

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

Discrete mathematics is the study of techniques, ideas and modes of

Week No. 06: Numbering Systems

Trinity Web Site Design. Today we will learn about the technology of numbering systems.

Conversions between Decimal and Binary

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

MATH Dr. Halimah Alshehri Dr. Halimah Alshehri

CHAPTER 2 NUMBER SYSTEMS

THE LOGIC OF COMPOUND STATEMENTS

Four Important Number Systems

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

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

Software Testing Lecture 2

CSEN102 Introduction to Computer Science

Counting in Different Number Systems

of Digital Electronics

Beyond Whole Number Bases

Hakim Weatherspoon CS 3410 Computer Science Cornell University

ENGIN 112 Intro to Electrical and Computer Engineering

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

Numbers and Arithmetic

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

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

ECE380 Digital Logic. Positional representation

Chapter 1 CSCI

CH 54 PREPARING FOR THE QUADRATIC FORMULA

Chapter 1. Foundations of GMAT Math. Arithmetic

Chapter 1 Computer Arithmetic

Binary addition example worked out

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

Algorithms: Review from last time

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

Mat Week 8. Week 8. gcd() Mat Bases. Integers & Computers. Linear Combos. Week 8. Induction Proofs. Fall 2013

Quadratic Equations Part I

Student Responsibilities Week 8. Mat Section 3.6 Integers and Algorithms. Algorithm to Find gcd()

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

ECE260: Fundamentals of Computer Engineering

1 Computing System 2. 2 Data Representation Number Systems 22

Seven is less than 11. Four more than seventeen. Four is not equal to three.

0 / 1 Now, Binary value of the given number :-

Introduction. An Introduction to Algorithms and Data Structures

MATH 25 CLASS 12 NOTES, OCT Contents 1. Simultaneous linear congruences 1 2. Simultaneous linear congruences 2

Adding and Subtracting Terms

Making the grade: Part II

Fundamentals of Digital Design

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

The Most Important Thing for Your Child to Learn about Arithmetic. Roger Howe, Yale University

Mixed Review Write an equation for each problem. Then solve the equation. 1. The difference between 70 and a number is 2. A number minus 13 is 1.

NUMBERS It s the numbers that count

NUMBERS AND CODES CHAPTER Numbers

Fundamentals of Mathematics I

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

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

Physics 12 Rules for Significant Digits and Rounding

NP-Completeness I. Lecture Overview Introduction: Reduction and Expressiveness

Secondary Two Mathematics: An Integrated Approach Module 3 - Part One Imaginary Number, Exponents, and Radicals

Nicholas Ball. Getting to the Root of the Problem: An Introduction to Fibonacci s Method of Finding Square Roots of Integers

Mat104 Fall 2002, Improper Integrals From Old Exams

Sample Project: Simulation of Turing Machines by Machines with only Two Tape Symbols

Lecture 6: Introducing Complexity

Computer Number Systems

M. Smith. 6 September 2016 / GSAC

Expressions, Equations and Inequalities Guided Notes

ECE 372 Microcontroller Design

The Growth of Functions. A Practical Introduction with as Little Theory as possible

GRADE 7 MATH LEARNING GUIDE. Lesson 26: Solving Linear Equations and Inequalities in One Variable Using

1. Basics of Information

Mathematics I. Quarter 2 : ALGEBRAIC EXPRESSIONS AND FIRST-DEGREE EQUATIONS AND INEQUALITIES IN ONE VARIABLE

Chapter 2. Mathematical Reasoning. 2.1 Mathematical Models

6. ELLIPTIC CURVE CRYPTOGRAPHY (ECC)

Combinatorial Optimization

Discrete Mathematics U. Waterloo ECE 103, Spring 2010 Ashwin Nayak May 17, 2010 Recursion

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

History of Math For the Liberal Arts CHAPTER 2. Egyptian Mathematics. Lawrence Morales. Seattle Central Community College

Grade 7/8 Math Circles October 28/29, Series

Extending the Number System

Introduction to Logarithms What Is a Logarithm? W. L. Culbertson, Ph.D.

CS1800: Hex & Logic. Professor Kevin Gold

Outline. policies for the first part. with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014

1.2 Algebraic Expressions and Sets of Numbers

Structural Induction

Chapter 3. Introducing Groups

ENG2410 Digital Design Introduction to Digital Systems. Fall 2017 S. Areibi School of Engineering University of Guelph

Formal Definition of a Finite Automaton. August 26, 2013

Problem Points Score Total 100

CSCI3390-Assignment 2 Solutions

In this unit we will study exponents, mathematical operations on polynomials, and factoring.

Pattern Recognition Prof. P. S. Sastry Department of Electronics and Communication Engineering Indian Institute of Science, Bangalore

MITOCW ocw f99-lec16_300k

Where do pseudo-random generators come from?

Mathematics 102 Fall 1999 The formal rules of calculus The three basic rules The sum rule. The product rule. The composition rule.

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

Eureka Lessons for 6th Grade Unit FIVE ~ Equations & Inequalities

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute Of Technology, Madras

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

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

Advanced Counting Techniques. Chapter 8

Radix polynomial representation

Grade 5 Number Strings

Scientific Notation. Scientific Notation. Table of Contents. Purpose of Scientific Notation. Can you match these BIG objects to their weights?

Transcription:

Additive Numbering Systems and Numbers of Different Bases MAT 142 RSCC Scott Surgent Our modern numbering system uses ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. These are known as the Hindu-Arabic symbols. Because we have ten symbols, we count in a base-10 numbering system. Recall what happens to the number 10 when raised to integer powers: 10 0 = 1 10 0 10 2 = 100 10 3 = 1,000 10 4 = 10,000 10 5 = 100,000 10 6 = 1,000,000 Etc. When we write a number like 2,458, we are really saying 1,000 + 1,000 + 100 + 100 + 100 + 100 + 10 + 10 + 10 + 10 + 10 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 2 10 3 4 10 2 5 10 1 8 10 0 This is known as an additive numbering system, and also as a place-holder numbering system. With practice, we see a number like 2,458 as representing two batches of 1,000, four batches of 100, 5 batches of 10, and 8 batches of 1. Other bases: Base 2 (binary). Symbols used: 0 and 1. Powers of 2: 2 0 = 1 2 1 = 2 2 2 = 4 2 3 = 8 2 4 = 16 2 5 = 32 2 6 = 64, etc. A number written in binary would look like 1001101. Expanded, we have 1(2 6 ) + 0(2 5 ) + 0(2 4 ) + 1(2 3 ) + 1(2 2 ) + 0(2 1 ) + 1(2 0 ). The 0s simply drop out that portion of the number. What s left is 1(2 6 ) + 1(2 3 ) + 1(2 2 ) + 1(2 0 ) = 1(64) + 1(8) + 1(4) + 1(1) = 77. To write a base-10 number into binary, we need to think of how to write the base-10 number using portions of size 1, 2, 4, 8, 16, 32, 64, and so on, at most once. For example, the base-10 number 93 can be written as 64 + 16 + 8 + 4 + 1. Thus, 93 = 1(64) + 0(32) + 1(16) + 1(8) + 1(4) + 0(2) + 1(1) = 1011101. To add two binary numbers, we use the basic rules: 0 + 0 = 0, 1 + 0 = 1, 0 +, and 1 + 0 ( carry the one ). Note, this last one is not one plus one equals ten. It is 1 (base 2) + 1 (base 2 ) = 10 (base 2). The binary number 10 represents 2.

Example: Find 110011 + 100101 Solution: Add columns right to left, like you would normally. Whenever you encounter a 1 + 1, write a 0 below, and carry the extra 1 to the next column to the left. Thus, 110010010011000. Converted into base-10, we have 110011 = 51, 100101 = 37, and 51 + 37 = 88, which is 64 + 16 + 8, or 1011000. Computer circuit boards rely on this basic form of arithmetic to add and multiply binary values. It is very tedious for humans to perform this by hand, but a computer can handle trillions of these calculations in mere seconds. The most complicated computer programs in the world are ultimately just a huge sequence of 0s and 1s being added again whenever necessary, faster than you can shake a stick at. Binary numbers and their base-10 equivalents: 2 = 10 3 = 11 4 = 100 5 = 101 6 = 110 7 = 111 8 = 1000 9 = 1001 10 = 1010 1011 12 = 1100 13 = 1101 14 = 1110 15 = 1111 16 = 10000 17 = 10001 18 = 10010 19 = 10011 20 = 10100 20101 22 = 10110 23 = 10111 24 = 11000 25 = 11001 26 = 11010 27 = 11011 28 = 11100 29 = 11101 30 = 11110 31111 32 = 100000 33 = 100001 34 = 100010 35 = 100011 36 = 100100 37 = 100101 38 = 100110 39 = 100111 40 = 101000

Base 3 (trinary) Symbols used: 0, 1 and 2 Powers of 3: 3 0 = 1 3 1 = 3 3 2 = 9 3 3 = 27 3 4 = 81 3 5 = 243 3 6 = 729, etc. A trinary number looks like 2101102. It is 2101102 = 2(3 6 ) + 1(3 5 ) + 0(3 4 ) + 1(3 3 ) + 1(3 2 ) + 0(3 1 ) + 2(3 0 ) = 2(729) + 1(243) + 0(81) + 1(27) + 1(9) + 0(3) + 2(1) = 1458 + 243 + 27 + 9 + 2 = 1739 (base 10). To convert a base-10 number like 475 into base 3, we need to split 475 into portions of size 1, 3, 9, 27, 81, 243, 729, and so on, where we can use 0, 1 or 2 of each portion. Note that 729 is too big, but 243 is smaller than 475, so we have 475 1(243) = 232. Then, from 232 we can write using two portions of size 81, so we have left 232 2(81) = 70. From 70, we can take two portions of size 27, so we have left 70 2(27) = 16. From 16, we can take 1 portion of size 9, so we have left 16 1(9) = 7. From 7, we can take two portions of size 3, so we have left 7 2(3) = 1. Finally, 1 is one portion of size 1, or 1(1), so we are finished. So, we have 475 (base 10) = 1(243) + 2(81) + 2(27) + 1(9) + 2(3) + 1(1) = 122121 (base 3). There exist numbering schemes for base 4, 5 and so on. Some of the more common are base 8 (octal) and base 16 (hexadecimal), which are used commonly in computer languages. Powers of 2, such as 8 and 16, are desirable because they can be halved and doubled easily. Ironically, base-10 is not a convenient numbering system in computer programming. Trinary numbers and their base-10 equivalents: 2 = 2 3 = 10 4 = 11 5 = 12 6 = 20 7 = 21 8 = 22 9 = 100 10 = 101 102 12 = 110 13 = 111 14 = 112 15 = 120 16 = 121 17 = 122 18 = 200 19 = 201 20 = 202 21 = 210 22 = 211 23 = 212 24 = 220 25 = 221 26 = 222 27 = 1000 28 = 1001 29 = 1002 30 = 1010 3011 32 = 1012 33 = 1020 34 = 1021 35 = 1022 36 = 1100 37 = 1101 38 = 1102 39 = 1110 40 = 1111

Base 8 (Octal) Symbols used: 0, 1, 2, 3, 4, 5, 6, 7. Powers of 8: 8 0 = 1, 8 1 = 8, 8 2 = 64, 8 3 = 512, 8 4 = 4096, etc. Example: Write 4763 (base 8) into base 10. Solution: We have 4763 (base 8) = 4(8 3 ) + 7(8 2 ) + 6(8 1 ) + 3(8 0 ) = 4(512) + 7(64) + 6(8) + 3(1) = 2,547 (base 10) Example: Convert 12,877 (base 10) into Octal (base 8). Solution: Thus, The largest power of 8 that is less than 12,877 is 8 4 = 4096. Note that we can remove three portions of 4096, so we have 12,877 3(4096) = 589. From 589, we can remove one portion of 8 3 = 512, so we have 589 1(512) = 77. From 77, we can remove one portion of 8 2 = 64, so we have 77 1(64) = 13. From 13, we can remove one portion of size 8 1 = 8, so we have 13 1(8) = 5. We have 5 portions of size 8 0 = 1, or 5(1). 12,875 (base 10) = 3(8 4 ) + 1(8 3 ) + 1(8 2 ) + 1(8 1 ) + 5(8 0 ) = 31115 (base 8). Octal numbers and their base-10 equivalents: 2 = 2 3 = 3 4 = 4 5 = 5 6 = 6 7 = 7 8 = 10 9 = 11 10 = 12 13 12 = 14 13 = 15 14 = 16 15 = 17 16 = 20 17 = 21 18 = 22 19 = 23 20 = 24 21 = 25 22 = 26 23 = 27 24 = 30 25 = 31 26 = 32 27 = 33 28 = 34 29 = 35 30 = 36 31 = 37 32 = 40 33 = 41 34 = 42 35 = 43 36 = 44 37 = 45 38 = 46 39 = 47 40 = 50 62 = 76 63 = 77 64 = 100 65 = 101 66 = 102 Question: What octal number comes after 7777? Answer: 10000.

Base 16 (Hexadecimal) Symbols used: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Note that A represents ten, B eleven, C twelve, D thirteen, E fourteen and F fifteen. Powers of 16: 16 0 = 1 16 6 16 2 = 256 16 3 = 4096 16 4 = 65,536, etc Example: Write 501A (hexademical) into its base-10 equivalent. Solution: Break it apart as 501A = 5(16 3 ) + 0(16 2 ) + 1(16 1 ) + A(16 0 ) = 5(4096) + 1(16) + 10(1) = 20,506 (base 10) Example: Write 52,748 (base 10) into hexadecimal. Solution: We need to break this number into portions of 1, 16, 256, 4096, 65536, and so on, using each portion at most 15 times. 65,536 is too big, so we move down to 4096. Note that 12 portions of 4,096 is less than 52,748. Thus, we have 52,748 12(4,096) = 3,596. Note that 14 portions of 256 is less than 3,596. Thus, we have 3,596 14(256) = 12 Since 12 is less than 16, we have 12 portions of 16 0, or 12(1). The hexadecimal symbols for 12 is C and for 14 is E, so 52,748 (base 10) is equivalent to CEC (hexadecimal). Hexadecimal was used often (is probably still used often) when compiling computer programs into a more digestible format for computers to understand. For example, the old language BASIC would look like this: 10 FOR A = 1 TO 10 20 PRINT A, A*A 30 NEXT 40 END This program prints the first ten numbers and their squares. The language itself used codes, such as common English words like FOR, PRINT and NEXT to perform tasks. In building a language that has many levels of coding, it slows down the run-time of such a program. Thus, you would create a program in BASIC, then run it through a hex-compiler, which would convert the program into a long string of hexadecimal numbers. It allowed programs to run faster because the computer did not need to slow down each time it came to a code such as NEXT. Hexadecimal numbers and their base-10 equivalents 2 = 2 3 = 3 4 = 4 5 = 5 6 = 6 7 = 7 8 = 8 9 = 9 10 = A 11 = B 12 = C 13 = D 14 = E 15 = F 16 = 10 17 = 11 18 = 12 19 = 13 26 = 1A (16 + 10) 30 = 1E 3F 32 = 20 33 = 21 42 = 2A (2(16) + 10) 43 = 2B 44 = 2C 47 = 2F 48 = 30 254 = FE 255 = FF 256 = 100 257 = 101 266 = 10A (256 + 10)