-1

I have a function $f$ such that is the sum of big O terms, such as

$$f=\left[\sum_{i=1}^x \frac{1}{i}\right] +O\left(\frac{\ln^4 x}{x}\right)+O\left(\frac{\ln^4 x-1}{x-1}\right)+O\left(\frac{\ln^4 x-2}{x-2}\right)+\ldots$$

where $x$ is a positive integer. Am I correct in that I can simply write

$$f=\left[\sum_{i=1}^x \frac{1}{i}\right] + O\left(\frac{\ln^4 x}{x}\right)$$

because I just need to write the bigger value for the big O, in this case being $\frac{\ln^4 x}{x}$?

Any intuitive, even informal answer would be welcome.

SilvioM
  • 1,339
  • 4
  • 13
fox
  • 185
  • 6

2 Answers2

1

It is not correct because you don't have a constant number of terms in your sum. Indeed, your sum has $\ln^4 x$ terms (assuming it stops when the numerator is $0$).

Actually the smaller terms may have an impact. However we can bound it.

Let's start by rewriting the sum: $$\sum_{i=0}^{\ln^4 x -1} \frac{\ln^4 x-i}{x-i} = \sum_{i=1}^{\ln^4 x} \frac{i}{x-\ln^4 x + i} . $$

Now, we have: $$\sum_{i=1}^{\ln^4 x} \frac{i}{x-\ln^4 x + i} \leq \sum_{i=1}^{\ln^4 x} \frac{i}{x-\ln^4 x } = \frac{1}{x-\ln^4 x }\sum_{i=1}^{\ln^4 x} i = O\left( \frac{\ln^8 x}{x-\ln^4 x} \right) \ ,$$ where we used a smaller denominator in order to have the inequality and then we used the Gauss formula for the sum of the first $\ln^4 x$ integers and passed to the asymptotic notation in order to get rid of constants and lower-order terms.

Now, this term is actually $O(1)$, so this sum has no impact on the overall asymptotic value of: $$\sum_{i=1}^{x} \frac{1}{i} \geq 1 \ .$$

SilvioM
  • 1,339
  • 4
  • 13
1

You can’t add an infinite number of big-Os.

O(f(x)) is limited by f(x), multiplied by some constant c. If you have 100 Big-Os then they all have different constants, so you can just take the largest.

But with an infinite number of Big-Os, these constants could grow without any limit, so there is no single c that limits the infinite sum.

For a particular sum, if you have the actual terms, and not just big-O, then you may be able to prove some bound. For example if you can show that there is a constant c that works for all terms. But not if all you know is that each term is limited with some constant.

gnasher729
  • 32,238
  • 36
  • 56