HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

If $f(n)$ is $O(g(n))$ is it also $O(g(n-d))$?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
alsostackoverflowprogramming

Problem

When trying to prove that a recurrence $g(n)$ satisfies $g(n) = O(f(n))$, we sometimes are not able to find a valid $C$ to show the upper bound, so we try to prove it is $O(f(n-d))$ for some constant $d$ instead.

If we are able to prove that $g(n) = O(f(n-d)$, does this mean that it is also $O(f(n))$?
If so, does this go the other way too? That is, if $g(n)=O(f(n-d))$ for some $d$, then $g(n) = O(f(n))$ as well?

edit 1:
Here a valid $C$ means, $C$ such that $f(n) n0$ for some $n0$

Solution

The answer to your first question (whether $f(n) = O(g(n))$ implies $f(n) = O(g(n-d))$) depends on the function $g$: indeed, what you want holds iff $g(n) = O(g(n-d))$. This is a relation that holds for many functions, for example polynomials and exponentials, but not for the function $g(n) = 2^{2^n}$.

As for your second question, if $f$ is monotone (increasing) then $f(n-d) \leq f(n)$, and in particular $f(n-d) = O(f(n))$. The same holds if $f(n) = \Theta(h(n))$ for some monotone $h$. For example, if $f$ is a degree $a$ polynomial then $f = \Theta(n^a)$, and so $f(n-d) = O(f(n))$, since $n^a$ is monotone.

Context

StackExchange Computer Science Q#88707, answer score: 6

Revisions (0)

No revisions yet.