Section 2.6 Representation of numbers. Decimal representation (base 10) Given a positive integer X, the decimal representation of X is a string of digits.

Slides:



Advertisements
Similar presentations
Chapter Three: Closure Properties for Regular Languages
Advertisements

Recursive Definitions and Structural Induction
DATA REPRESENTATION CONVERSION.
Copyright © Cengage Learning. All rights reserved. CHAPTER 5 SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION SEQUENCES, MATHEMATICAL INDUCTION, AND RECURSION.
Converting Numbers Between Bases. While the quotient is not zero…  Divide the decimal number by the new base.  Make the remainder the next digit to.
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Induction and recursion
Number System Conversions Lecture L2.2 Section 2.3.
 Binary Binary  Binary Number System Binary Number System  Binary to Decimal Binary to Decimal  Decimal to Binary Decimal to Binary  Octal and Hexadecimal.
Binary Numbers.
ADDING, SUBTRACTING, MULTIPLYING AND DIVIDING INTEGERS By : Katie Kurth and Kateylnn Everhart.
1 Mathematical Induction. 2 Mathematical Induction: Example  Show that any postage of ≥ 8¢ can be obtained using 3¢ and 5¢ stamps.  First check for.
Math in Our World Section 4.3 Base Number Systems.
Induction and recursion
Chapter 5 Section 1 Writing Fractions as Decimals Pgs
Numbering Systems CS208.
Number Systems Part 2 Numerical Overflow Right and Left Shifts Storage Methods Subtraction Ranges.
Chapter 3 Section 1 Number Representation Modern cryptographic methods, unlike the classical methods we just learned, are computer based. Representation.
Integer Conversion Between Decimal and Binary Bases Conversion of decimal to binary more complicated Task accomplished by –Repeated division of decimal.
Computer Arithmetic and the Arithmetic Unit Lesson 2 - Ioan Despi.
Number systems, Operations, and Codes
Number Base Conversions
Divisibility Rules and Finding Factors
Copyright © 2009 Pearson Education, Inc. Chapter 5 Section 1 - Slide 1 Chapter 1 Number Theory and the Real Number System.
UNIT 3 REVIEW TEST ON JANUARY 18th.  Equivalent fractions are fractions that have the same value or represent the same part of an object.  Fractions.
Number Systems & Operations
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Introduction To Number Systems Binary System M. AL-Towaileb1.
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 4 Number Representation and Calculation.
Mathematical Induction
Divisibility Rules. What Are Divisibility Rules? They are a quick way to tell if one number can be completely divided into another without a remainder.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
Converting Decimals to Fractions Goal: use place values to make fractions.
ECE DIGITAL LOGIC LECTURE 2: DIGITAL COMPUTER AND NUMBER SYSTEMS Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2016, 01/14/2016.
Section 2.3 Mathematical Induction. First Example Investigate the sum of the first n positive odd integers. 1= ____ 1 + 3= ____ = ____
CSC 110 – Intro to Computing Lecture 3: Converting between bases & Arithmetic in other bases.
1 Discrete Mathematical Mathematical Induction ( الاستقراء الرياضي )
Chapter 5 With Question/Answer Animations 1. Chapter Summary Mathematical Induction - Sec 5.1 Strong Induction and Well-Ordering - Sec 5.2 Lecture 18.
Number Systems & Binary How to count. How do we represent numbers? Early systems: – Actual count : ||||| = 5 – Roman numers : XI = 11 Hard to do math:
Mathematical Induction I Lecture 19 Section 4.2 Mon, Feb 14, 2005.
Mathematical Induction. The Principle of Mathematical Induction Let S n be a statement involving the positive integer n. If 1.S 1 is true, and 2.the truth.
Introduction To Number Systems
Direct Proof and Counterexample IV: Division into Cases and the Quotient-Remainder Theorem For each of the following values of n and d, find integers q.
Multiplication and Division of Powers
3 Chapter Numeration Systems and Whole Number Operations
Advanced Algorithms Analysis and Design
Convert Decimal to Binary
Induction and recursion
Number Systems & Binary
Direct Proof and Counterexample V: Floor and Ceiling
Introduction to IT By: Muhammed s. anwar.
CHAPTER 3 - Percent Section 3.1
Modular Arithmetic and Change of Base
Induction and recursion
Chapter 2: Number Systems
Mathematical Induction I
3 Chapter Whole Numbers and Their Operations
Advanced Analysis of Algorithms
Copyright © Cengage Learning. All rights reserved.
Mathematical Induction
Algebra 1 Section 2.6.
Information Representation
Copyright © Cengage Learning. All rights reserved.
Converting Numbers Between Bases
§4.2, Number Bases in Positional Systems
Math 9 Honors Section 1.1 Fractions and Decimals
Presentation transcript:

Section 2.6 Representation of numbers

Decimal representation (base 10) Given a positive integer X, the decimal representation of X is a string of digits from {0,1,2,3,4,5,6,7,8,9} that looks like where Ex: (2037) ten = 2× × × ×10 0

Prove: Multiplying a decimal number by 10 shifts the digits one place to the left and places a “0” on the end.

Base two representation Given a positive integer X, the binary representation of X is a string of digits from {0,1} that looks like where Ex: (10111) two = 1× × × × ×2 0

Let x=(10101) two What decimal number represents x? What is the binary representation for 2x?

Multiplying Binary Numbers by 2 Note that the binary numeral for 2x is formed by shifting the x bits to the left and placing a “0”on the right. For 2x+1 we place a “1” on the right after doing the shift.

The binary representation for 14 is What is the binary representation for 29? By the division theorem, 29=2*14+1, so…

Every natural number has a binary representation. Proof by Induction: Let P(n) be the statement “n has a binary representation”. Check that P(n) is true for the base case. Note that P(0) and P(1) holds. Now suppose that P(2), P(3), …., P(m-1) have been check for some m >1.

Prove that P(m) holds. By the division theorem, there are integers q and r such that (1) m=2q+r and (2) r is from the set {0,1}. Since q<m, P(q) has been checked, so we know q has a binary representation:. So, Now, m=2q+r So the binary representation for m is

The proof tells us how to write a number in base 2: Input a natural number n While n>0, do the following:  Divide n by 2 and get a quotient q and remainder r.  Write r as the next (right-to-left) digit.  Replace the value of n and q, and repeat.

Write the base 10 number 65 in base 2. Begin with n=35. 35/2 = 17 with remainder 1, so write 1, and let n=17. 17/2=8 with remainder 1, so write 1, and let n=8. 8/2=4 with remainder 0, so write 0, and let n=4. 4/2=2 with remainder 0, so write 0,and let n=2. 2/2=1 with remainder 0, so write 0,and let n=1 ½=0 with remainder 1, so write 1, and let n=0. Since n=0, quit. The numeral is then

Examples of other “place value systems” (2037) ten = 2× × × ×10 0 (231) eight = 2× × ×8 0 (403) five = 4× × ×5 0

Practice (5401) six = (_____________) ten

Converting to other bases Example. (2037) ten = (____________) eight 2037 ÷ 8Quo 254Rem ÷ 8Quo 31Rem 6 31 ÷ 8Quo 3Rem 7 3 ÷ 8Quo 0Rem 3 Answer. (2037) ten = (3765) eight

Practice (1203) ten = (_____________) five

Practice (1203) ten = (_____________) two

Claim. For all n  0, 10 n – 1 is divisible by 3. Before beginning the proof, let’s define a n = 10 n – 1. From this closed formula, it is easy to see that the following recursive description is the same thing: “a 0 = 0, a n = 10*a n ” We will prove that “a n is divisible by 3” for all n  0.

Proving these properties Claim. For all n  0, 10 n – 1 is divisible by 3. Proof by induction. Consider the statement P(n) that states, “a n is divisible by 3.” It is easy to check the base case. P(0) says, “0 is divisible by 3,” which is true. Now let m be the first number for which P(m) has not yet been checked. In particular, P(m – 1) has been checked, so we know that “a m-1 is divisible by 3.” This means that a m-1 = 3K for some integer K. From this it follows that a m = 10(a m-1 ) + 9 = 10(3K) + 9 = 3 (10K + 3) Since 10K + 3 is an integer, we can conclude that a m is divisible by 3.

Proving properties Claim. If S be the sum of the (base ten) digits in n, then n – S is divisible by 3. Proof. We can represent n = c k 10 k + … + c c , and this means that S = c k + … + c 1 + c 0, from which it follows that n – S = c k (10 k – 1) + … + c 1 (10 1 – 1) + (c 0 – 1)10 0, Each of 10 k – 1, …, 10 1 – 1, and 10 0 – 1 is divisible by 3, so n – S is divisible by 3.