debugModerate
Error in the use of asymptotic notation
Viewed 0 times
errortheasymptoticnotationuse
Problem
I'm trying to understand what is wrong with the following proof of the following recurrence
$$
T(n) = 2\,T\!\left(\left\lfloor\frac{n}{2}\right\rfloor\right)+n
$$
$$
T(n) \leq 2\left(c\left\lfloor\frac{n}{2}\right\rfloor\right)+n \leq cn+n = n(c+1) =O(n)
$$
The documentation says it's wrong because of the inductive hypothesis that
$$
T(n) \leq cn
$$
What Am I missing?
$$
T(n) = 2\,T\!\left(\left\lfloor\frac{n}{2}\right\rfloor\right)+n
$$
$$
T(n) \leq 2\left(c\left\lfloor\frac{n}{2}\right\rfloor\right)+n \leq cn+n = n(c+1) =O(n)
$$
The documentation says it's wrong because of the inductive hypothesis that
$$
T(n) \leq cn
$$
What Am I missing?
Solution
Let's say the final goal is to prove $T(n) = \mathcal{O}(n)$. You start with the induction hypothesis:
$T(i) \leq ci$ for all $i < n$.
And to complete the proof, you have to show that $T(n) \leq cn$ as well.
However, what you're able to deduce is $T(n) \leq (c+1)n$, which is not helpful to complete the proof; you need one constant $c$ for (almost) all $n$. Therefore, we cannot conclude anything and $T(n) = \mathcal{O}(n)$ isn't proved.
Notice that you are confused between the result and the proof process. And one more point, $T(n)$ is actually $\Theta(n \log n)$ in this case so you may consider an appropriate induction hypothesis to be able to prove it.
$T(i) \leq ci$ for all $i < n$.
And to complete the proof, you have to show that $T(n) \leq cn$ as well.
However, what you're able to deduce is $T(n) \leq (c+1)n$, which is not helpful to complete the proof; you need one constant $c$ for (almost) all $n$. Therefore, we cannot conclude anything and $T(n) = \mathcal{O}(n)$ isn't proved.
Notice that you are confused between the result and the proof process. And one more point, $T(n)$ is actually $\Theta(n \log n)$ in this case so you may consider an appropriate induction hypothesis to be able to prove it.
Context
StackExchange Computer Science Q#772, answer score: 12
Revisions (0)
No revisions yet.