TITLE: Reference request: Different definitions of Big O notation
QUESTION [5 upvotes]: This question might sound strange, but I would like to settle this problem once and for all.
For as long as I can remember, I was introduced to the Big O notation by this definition:
Def. 1: Let $f, g$ be some real (or complex) functions defined on a set $A$. Then the notation “$f(x) = O(g(x))\text{ for } x \in A$” means that there exists a constant $C_{f,g} > 0$, depending only on $f$ and $g$, such that $|f(x)| \leq C_{f,g} |g(x)|$ for every $x \in A$.
Therefore, for me it makes perfect sense (and it is often useful) to write statements like:
$$
\frac1{1 - x} = 1 + x + O(x^2) \quad\text{ for } x \in [0, 1/2],\label{1}\tag{1}
$$
or
$$
\lfloor x \rfloor = x + O(1) \quad\text{ for } x \in \mathbb{R}.
\label{2} \tag{2}
$$
However, when talking to colleagues, it often turns out that they are used to a different definition of the Big O notation, that is:
Def. 2: Let $f, g$ be some real (or complex) functions defined on some topological space containing the point $x_0$. Then the notation “$f(x) = O(g(x))\text{ as } x \to x_0$” means that there exist a constant $C_{f,g} > 0$ and a neighborhood $U_{f,g}$ of $x_0$, depending only on $f$ and $g$, such that $|f(x)| \leq C_{f,g} |g(x)|$ for every $x \in U_{f,g}$.
Thus, if anything, they would rewrite \eqref{1} as:
$$\frac1{1 - x} = 1 + x + O(x^2) \quad\text{ for } x \to 0,$$
(which is a weaker statement) and they would say that \eqref{2} is wrong notation / meaningless.
Although I'm sure that other people than me use Def. 1 daily, I could not find a single book defining the Big O notation as in Def. 1 - but only books defining the Big O notation similarly to Def. 2.
What is a reference to a book defining the Big O notation as in Def. 1 ?
Thanks

REPLY [2 votes]: Def. 1 can be found on pag. 8 of D. Koukoulopoulos, The Distribution of Prime Numbers (Luckily, pag. 8 can be read on the Google Books preview: https://www.google.it/books/edition/The_Distribution_of_Prime_Numbers/me7CDwAAQBAJ?hl=it&gbpv=0).
Although Def. 1 and Def. 2 are equivalent on $\mathbb{N} \cup \{\infty\}$, I agree that Def. 1 is superior to Def. 2 in may ways, which include:

Def. 1 is easier (no topology required) and more general.

Def. 1 works in summations, while Def. 2 don't. For example, knowing that $1/(1-x) = 1 + x + O(x^2)$ for $x \in [0, 1/2]$, we can find that
$$\sum_{n = 1}^N \frac1{1 - x / n} = \sum_{n = 1}^N \left(1 + \frac{x}{n} + O\left(\frac{x^2}{n^2}\right)\right) = N + \left(\sum_{n=1}^N \frac1{n}\right) x + O\left(\sum_{n=1}^N \frac1{n^2} x^2\right)$$
$$ = N + \left(\sum_{n=1}^N \frac1{n}\right) x + O\left(x^2\right) \quad\text{ for } x \in [0, 1/2].$$
No way to do that using Def. 2.

Def. 1 can express boundness: $f(x) = O(1)$ for $x \in A$ is indeed equivalent to $f$ is bounded on $A$. On the other hand, $f(x) = O(1)$ for $x \to x_0$ only means that $f$ is bounded around $x_0$, and may have singularities somewhere else.