Direct Proof – Floor and Ceiling - Hampden-Sydney...

21
Direct Proof – Floor and Ceiling Lecture 17 Section 4.5 Robb T. Koether Hampden-Sydney College Wed, Feb 13, 2013 Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 1 / 21

Transcript of Direct Proof – Floor and Ceiling - Hampden-Sydney...

Page 1: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Direct Proof – Floor and CeilingLecture 17Section 4.5

Robb T. Koether

Hampden-Sydney College

Wed, Feb 13, 2013

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 1 / 21

Page 2: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

1 The Floor and Ceiling Functions

2 Theorems

3 Applications

4 Assignment

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 2 / 21

Page 3: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

title

Definition (The Floor Function)Let x ∈ R. Define bxc to be the integer n such that

n ≤ x < n + 1.

Definition (The Ceiling Function)Let x ∈ R. Define dxe to be the integer n such that

n − 1 < x ≤ n.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 3 / 21

Page 4: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Examples

For example,b3.8c = 3d3.8e = 4b−3.8c = −4d−3.8e = −3

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 4 / 21

Page 5: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Rounding

Definition (The Round Function)Let x ∈ R. Define 〈x〉 = bx + 1/2c.

We see that 〈x〉 is the value of x , rounded to the nearest integer.If x is exactly halfway between two integers, then it is rounded upto the next largest integer.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 5 / 21

Page 6: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Theorem

TheoremFor all x ∈ R and all n ∈ Z, bx + nc = bxc+ n.

Proof.Let x ∈ R and let n ∈ Z.Let m = bxc ∈ Z.Then x = m + e for some e ∈ R with 0 ≤ e < 1.Then

bx + nc = b(m + e) + nc= b(m + n) + ec= m + n= bxc+ n.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 6 / 21

Page 7: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Conjectures

Is there a comparable statement involving dx + ne?Is it true that ∀x , y ∈ R, bx + yc = bxc+ byc?Is it true that ∀x ∈ R, b2xc = 2bxc?Is it true that ∀x ∈ R, bx2c = (bxc)2?Is it true that ∀x ∈ R, bx + 1/2c = dx − 1/2e?If they are not true for all x , y ∈ R, then are they true for somex , y ∈ R? Which ones?

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 7 / 21

Page 8: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Theorem

TheoremFor all real numbers x, bxc+ bx + 1

2c = b2xc.

Proof.Let x ∈ R.Let n = bxc and e = x − n.

Either 0 ≤ e < 12 or 1

2 ≤ e < 1.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 8 / 21

Page 9: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Proof

Proof.Case 1: Suppose 0 ≤ e < 1/2.

Then

bxc+ bx + 1/2c = n + bn + e + 1/2c= n + n= 2n= 2bxc.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 9 / 21

Page 10: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Proof

Proof.Case 2: Suppose 1/2 ≤ e < 1.

Then, on one hand,

bxc+ bx + 1/2c = n + bn + e + 1/2c= n + b(n + 1) + (e − 1/2)c= n + (n + 1)

= 2n + 1.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 10 / 21

Page 11: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Proof

Proof.Case 2 (cont’d): On the other hand,

b2xc = b2n + 2ec= b(2n + 1) + (2e − 1)c= 2n + 1.

Therefore bxc+ bx + 1/2c = b2xc.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 11 / 21

Page 12: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Proof

Proof.Therefore, for all x ∈ R, bxc+ bx + 1/2c = b2xc.

Write a similar statement using the ceiling function.Write a similar statement using the round function.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 12 / 21

Page 13: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Binary Search

In a binary search of a list of size n, we begin by comparing thevalue to the middle element.If it matches, we are done. If it fails to match, we continuesearching in the same manner in the lower half or the upper half.How many comparisons are required to find the value we arelooking for?

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 13 / 21

Page 14: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Binary Search

Suppose n = 225 and the elements are a[0] through a[224].We first compare to element a[112].Next, we compare to element a[65] or a[168], and so on.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 14 / 21

Page 15: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Binary Search

Initially we have 225 elements.We eliminate 1 and divide the rest in half: 112 in each half.We eliminate 1 more and divide the rest in half: either 55 or 56 inthe halves.We eliminate 1 more and divide: 27 or 28 in the halves.Again: 13 or 14.Again: 6 or 7.Again: 2 or 3.Again: 0 or 1.Done.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 15 / 21

Page 16: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Binary Search

Initially we have 225 elements.We eliminate 1 and divide the rest in half: 112 in each half.We eliminate 1 more and divide the rest in half: either 55 or 56 inthe halves.We eliminate 1 more and divide: 27 or 28 in the halves.Again: 13 or 14.Again: 6 or 7.Again: 2 or 3.Again: 0 or 1.Done.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 16 / 21

Page 17: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Binary Search

Consider the calculation:

b225÷ 2c = 112,

b112÷ 2c = 56,

b56÷ 2c = 28,

b28÷ 2c = 14,

b14÷ 2c = 7,

b7÷ 2c = 3,

b3÷ 2c = 1.

The number of iterations is dlog2 225e = 8.In general, the number is dlog2 ne.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 17 / 21

Page 18: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Puzzle

How many trailing zeros are there in the decimal representation of1000!?(1000! = 1000 · 999 · 998 · · · 2 · 1.)

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 18 / 21

Page 19: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Puzzle

A trailing zero is produced by, and only by, a factor of 10.A factor of 10 is produced by, and only by, a pair of prime factors 2and 5.How many pairs of factors 2 and 5 are there in 1000!?

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 19 / 21

Page 20: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Assignment

AssignmentRead Section 4.5, pages 191 - 196.Exercises 4, 8, 9, 10, 15, 16, 20, 21, 24, 25, page 197.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 20 / 21

Page 21: Direct Proof – Floor and Ceiling - Hampden-Sydney Collegepeople.hsc.edu/faculty-staff/robbk/Math262/Lectures/Spring 2013/Lecture 17 - Direct...Direct Proof – Floor and Ceiling

Collected Homework 4

Collected Homework 4Exercises 28, 58, page 161.Exercises 14, 28, page 168.Exercises 28, 29, page 177.Exercises 19, 41, page 189.

Robb T. Koether (Hampden-Sydney College) Direct Proof – Floor and Ceiling Wed, Feb 13, 2013 21 / 21