Proving that, if a function f is O(g), the ceiling of f is also O(g).

1000 Views Asked by At

I'm having a bit of trouble with this problem:

$$\forall (f, g) \in F, f \in O(g) \implies \lceil{f}\rceil \in O(g)$$

Where F is the family of functions from $\mathbb{N}$ to $\mathbb{R}^+$.

I know that $f(n) \leq \lceil{f(n)}\rceil \leq f(n)+1$, since the next int that fits is always less than 1 unit away.

I'm kind of stuck on how to show $f(n) + 1 \leq cg(n)$, using the definition: $$\exists c > 0, \exists n_0, \forall n, n \geq n_0 \implies f(n)+1 \leq cg(n)$$

Any guidance would be greatly appreciated. Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

The statement you want to prove is wrong. Let $g(n) = f(n) = \frac 1{n}$. Then $\lceil f\rceil(n) = 1$ for all $n$. Obviously $f \in O(g)$, but there is no $c$ such that $1 \le \frac cn$ for almost all $n$, as this is equivalent to $n \le c$. So $\lceil f\rceil \not\in O(g)$.