0% found this document useful (0 votes)
2K views13 pages

Floor and Ceiling Function

The floor function rounds down to the nearest integer, while the ceiling function rounds up. For example, floor(2.6) = 2 and ceiling(-2.1) = -2. There are several interesting properties of these functions, such as floor(-x) = ceiling(-x), which can be proven. The document also provides examples and definitions of the greatest common divisor function.

Uploaded by

Ronna Magto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views13 pages

Floor and Ceiling Function

The floor function rounds down to the nearest integer, while the ceiling function rounds up. For example, floor(2.6) = 2 and ceiling(-2.1) = -2. There are several interesting properties of these functions, such as floor(-x) = ceiling(-x), which can be proven. The document also provides examples and definitions of the greatest common divisor function.

Uploaded by

Ronna Magto
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Floor and Ceiling

Functions
Floor and Ceiling

The floor and ceiling functions have type R → Z, where


floor(x) is the closest integer less than or equal to x and
ceiling(x) is the closest integer greater than or equal to x.

e.g., floor(2.6) = 2, floor(–2.1) = –3, ceiling(2.6) = 3, and


ceiling(–2.1) = –2.

Notation: x = floor(x) and x = ceiling(x).


Floor and Ceiling
There are many interesting properties, all of which are easy
to prove.
Example. – x = – x.
Proof:
If x  Z, then – x = – x = – x. If x  Z, there is an n  Z
such that n < x < n + 1,
which gives x = n. Multiply the inequality by –1 to get – n >
– x > – (n + 1), which gives
– x = – n. So – x = – n = – x. QED.

Show that x + 1 = x + 1.


Proof: There is an integer n such that n < x ≤ n + 1. Add 1 to
get n + 1 < x + 1 ≤ n + 2.
So x + 1 = n + 2 and x = n + 1.
Therefore, x + 1 = x + 1. QED.
3
Greatest Common Divisor (gcd)

If x and y are integers, not both zero, then gcd(x, y) is the


largest integer that divides x and y.

For example, gcd(12, 15) = 3, gcd(–12, –8) = 4.

Properties of gcd
• gcd(a, b) = gcd(b, a) = gcd(a, –b).
• gcd(a, b) = gcd(b, a – bq) for any integer q.
• gcd(a, b) = ma + nb for some m, n  Z.
• If d | ab and gcd(d, a) = 1, then d | b.
Floor and Ceiling

X Floor function: the largest integer < X

2.7  = 2 − 2.7  = −3 2 = 2

X Ceiling function: the smallest integer > X

2.3  = 3 − 2.3  = −2 2 = 2


Facts about Floor and Ceiling
1. X − 1  X  X
2. X  X  X + 1
3. n/2 + n/2 = n if n is an integer
The floor and ceiling functions give us
the nearest integer up or down.
Applications:

If you need 11 pens, and they are sold in packages of 3, you need to

buy packages.

Floor and Ceiling
Functions
Floor and Ceiling
The floor and ceiling functions have type R Z, where 
floor(x) is the closest integer less than or equal t
3
Floor and Ceiling
There are many interesting properties, all of which are easy 
to prove. 
Example. – x= – x. 
Proof:
I
Greatest Common Divisor (gcd)
If x and y are integers, not both zero, then gcd(x, y) is the 
largest integer that divides x a
Floor and Ceiling

X

X
Floor function: the largest integer < X
Ceiling function: the smallest integer > X





2
2
Facts about Floor and Ceiling






integer
 
an
 
is
 n 
if
n
n/2
n/2
3.
1
X
X
X
2.
X
X
1
X
1.
=
+
+




−
The floor and ceiling functions give us  
the nearest integer up or down.

You might also like