-4
$\begingroup$

Let $A = \{ g(n) \mid \exists c,n_0 \, \forall n \ge n_0\colon g(n) \le cf(n) \}$, and $B = \{ g(n) \mid \exists c,n_0 \, \forall n \geq n_0 \colon g(n) < cf(n) \}$.

Prove $A = B$.

My solution:

  • Let $f(n)$ and $g(n)$ be functions from $\mathbb{N}$ to $\mathbb{N}$.
  • $g(n)\le cf(n)$ for all $n > n_0$.
  • $g(n) = O(f(n))$ means $\exists c, n_0 \forall n\colon n > n_0 \Rightarrow g(n) \le cf(n)$.
  • To prove A, choose values for $c$ and $n_0$ and prove that $n > n_0$ implies $g(n) \le cf(n)$.
  • Choose $n_0 = 1$.
  • Assuming $n>1$, find a $c$ such that $g(n)/f(n) \le cf(n)/f(n) = c$.
  • This shows that $n>1$ implies $g(n)\le cf(n)$.
  • $n>1$ implies $1<n$, $n<n^2$, $n^2<n^3$, and so on.

My problem: Given an equation I know how to get $c$ and $n_0$. But now given the definition, how can I prove that there exist $c$ and $n_0$ in that big O definition in order to get the result A=B?

$\endgroup$
  • 2
    $\begingroup$ We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. $\endgroup$ – D.W. Jul 6 '17 at 5:28
  • 2
    $\begingroup$ Note that you can use LaTeX here to typeset mathematics in a more readable way. See here for a short introduction. $\endgroup$ – D.W. Jul 6 '17 at 5:28
  • $\begingroup$ I'm now using point form i believe that now is easy to be read $\endgroup$ – User1234 Jul 6 '17 at 12:35
2
$\begingroup$

Clearly, $B \subseteq A$, since $\lt$ implies $\le$.

Assuming that $f(n)$, $g(n)$ and $c$ are always positive,

If $g(n) \le c f(n)$, then $g(n) \lt (c + 1) f(n)$.

So, if we can find a $c$ that satisfies $A$, we can find one that satisfies $B$.

It follows that $A \subseteq B$, hence that $A = B$.

$\endgroup$
  • $\begingroup$ Thanks and i appreciate your help. Your explanation is much simpler than what i think :) $\endgroup$ – User1234 Jul 6 '17 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.