Had a question about the following:
$$\log (n+1) \in O(\log n)$$
Can the left side be simplified any further or do I need to just go ahead and find a c and n that hold?
Had a question about the following:
$$\log (n+1) \in O(\log n)$$
Can the left side be simplified any further or do I need to just go ahead and find a c and n that hold?
Simplifying the left-hand side is a good strategy. You aren't going to find a simpler expression that's equal to $\log(n+1)$, though. However, since you're only interested in proving that $\log(n+1)$ is “not too large”, it can be a good strategy to find an intermediate step that's larger than $\log(n+1)$ but still not too large. That is, try to find a function $f$ such that $\log(n+1) \le f(n)$ (for sufficiently large $n$), and $f(n) \in O(\log n)$.
(Easy exercise: prove that this is true — if you've found a such a function $f$ then $\log(n+1) \in O(\log n)$.)
So you can try to fill in the statement $\log(n+1) \le \ldots$ with something simpler on the right-hand side. “Simpler” meaning that in the end it'll be simpler to prove that this is in $O(\log n)$. So keep the definition of $O$ in mind: you'll need to prove that $f(n) \le C \log n$ for some $C \gt 0$.
This suggests trying to find $f$ of the form $C \log(n)$.
Hint:
$x + 1 \le x + x$
Hint #2:
You can say that again.
Of course this approach works for other functions and other bounds.
Exercise (open-ended): can you generalize this to $\Omega$? To $\Theta$? To $o$?
Simplify is only necessary if you can show the same with less steps. Here simplifying will not spare you something.
You can either find a $c$ and $n$ or you could use limit value.
$$ v = \lim_{n\to\infty}{\frac{\log(n+1)}{\log(n)}} $$
and if the limits exist ($v < \infty$) then $\log(n+1)\in O(\log(n))$.
You can simplify the expression as following:
$$\log(n+1)=\log(n)+\log \left(\frac{n+1}{n}\right)$$
It shouldn't be to hard to show that $\log \left(\frac{n+1}{n}\right)<\log(n)$ for $n\geq 2$.
But it doesn't necessarily help to make the process shorter.
However, to solve the problem, you need to rewrite something. This can be done with inequalities or with equalities. In this case, I'd personally prefer to start out with inequalities.
$n+1 ≤ n^2$ for $n ≥ 2$, therefore $\log(n+1) ≤ \log (n^2) = 2 \log n$ for $n ≥ 2$, which by definition means $\log(n+1) = O(\log n)$.
“Simplifying” is difficult. Let $f(n) = 2^{2^n}$, then $f(n+1) ≠ O(f(n))$. Same for $f(n) = n!$ Or more difficult to prove when $f(n) = \left|\sin(n)\right|$.