Is ceil(n/k) equal to floor((n-1)/k) + 1 for positive integer values of n and k?

  • Thread starter r0bHadz
  • Start date
  • Tags
    Proof
In summary: I don't know if I'm just bad at this or if its just not my thing.In summary, the student is trying to learn how to do a proof and has difficulty with it.
  • #1
r0bHadz
194
17

Homework Statement


Alright guys this took me an hour because I am really, really... i don't want to say it. I'm about to pop a gasket if my argument is not logical.

I couldn't find any info on the latex primer on floor and ceil symbols so i apologize in advance

show that if n and k are positive integers, then ceil(n/k) = floor((n-1)/k) + 1

Homework Equations

The Attempt at a Solution


let n/k = x - ε where x is a positive int and 0≤ε<1

ceil(n/k) = ceil(x-ε) = x

from n/k = x - ε, n = k(x-ε) => n-1 = k(x-ε) - 1 => (n-1)/k = (x-ε) - (1/k)

floor((n-1)/k) + 1 = floor( (x)+( -ε - (1/k))) +1

I want to evaluate floor( (x)+( -ε - (1/k)))

since k can only be an int, k=1, it becomes clear that -ε will be zero, as there will be no ε in n/k = x - ε

so floor(x-1) + 1 = x-1 + 1 = x, which = ceil(x-ε). For k = 1, ceil(n/k) = floor((n-1)/k) + 1

floor(n/k) = floor (x-ε) = x-1

floor((n-1) / k) = floor (x-ε-(1/k)) = y

x-1 ≥ y for all values of positive ints n and k, so I don't think I even had to use the case where k=1..

but since its a floor function, y has to be x-1, because besides k=1 where it will be exactly x-1, -∈-(1/k) will always produce a number 0<-∈-(1/k)<1, and due to the floor property, it will always be x-1.

So
ceil(n/k) = floor((n-1)/k) + 1

I hope this makes sense my home dogs
 
Physics news on Phys.org
  • #2
so your claim is

##\lceil{\frac{n}{k}}\rceil = \lfloor{\frac{n-1}{k}}\rfloor +1##

you just completed a proof involving modular arithmetic... wouldn't it be good to practice using modular arithmetic here? My general motto is don't start from scratch and this problem seems taylor made for modular arithmetic.
- - - -
you can write any positive integer ##n## as
##n = r\cdot k + c##
where ## r## is a non-negative integer
and ##c := n\%k##

you know how the 'wraparound' with modular arithmetic works -- and since we are talking subtracting 1 from n before dividing by k, it would seem to motivate two cases

one where ## c \geq 1## and one where ##c= 0##. The first should be very easy to prove, and I'm confident you can do the second one...

- - - -
r0bHadz said:
Alright guys this took me an hour because I am really, really... i don't want to say it. I'm about to pop a gasket if my argument is not logical.

Don't blow a gasket!

I get the impression that at least some of what you are doing in Rosen's book is self study... if you detest the book, there are several other gentler books to learn proofs from, say in the New Math Library... also MIT Open Courseware has a nice discrete math /intro proofs course online called "Math for CS"...

it can be frustrating to learn proofs or learn a new kind of math... but some of it comes down to how 'good' the book is and especially how good a fit it is for you.
 
  • #3
I appreciate it. For some reason I just found the proof easier without the mod operator. I went to my teacher and she checked it and said it was fine. However, there are multiple ways to do this proof. It seems induction is viable as well.

The only reason I'm doing every question in Rosen's book is so I can get a complete understanding/ get an A in the course. My school has 2 discrete math courses, I'm taking the second one right now. It's all proof based so its very difficult but whatever. I just want to make sure I'm understanding everything.

I appreciate the help my brotha
 
  • Like
Likes StoneTemplePython

1. What is the meaning of ceil(n/k) and floor((n-1)/k)?

Ceil(n/k) and floor((n-1)/k) are mathematical functions used to round a number to the nearest integer. Ceil(n/k) rounds up to the nearest integer, while floor((n-1)/k) rounds down to the nearest integer.

2. Are n and k the only variables in this equation?

Yes, in this equation, n and k are the only variables. They represent positive integer values that can be substituted into the equation to determine if the statement is true.

3. Can this equation be applied to negative integer values of n and k?

No, this equation is only valid for positive integer values of n and k. Applying negative integer values may result in a different outcome.

4. What is the significance of adding 1 in the equation?

Adding 1 in the equation ensures that the result is always equal to or greater than the actual value of ceil(n/k). This is because ceil(n/k) rounds up, while floor((n-1)/k) rounds down, so adding 1 compensates for the difference between the two functions.

5. How is this equation useful in scientific research?

This equation is useful in many areas of scientific research, such as computer science, statistics, and number theory. It can be used to determine the number of iterations or steps required for a loop or algorithm to reach a certain value. It can also be used in mathematical proofs and calculations involving positive integers.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
6
Views
698
  • Precalculus Mathematics Homework Help
Replies
4
Views
793
  • Precalculus Mathematics Homework Help
Replies
10
Views
2K
  • Precalculus Mathematics Homework Help
Replies
4
Views
747
  • Precalculus Mathematics Homework Help
Replies
1
Views
816
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
  • Precalculus Mathematics Homework Help
Replies
6
Views
418
  • Precalculus Mathematics Homework Help
Replies
11
Views
3K
  • Precalculus Mathematics Homework Help
Replies
9
Views
1K
Back
Top