41

In the taylor series for sin(x), we write:

$$ \sin{x} = x - \frac{x^3}{6} + \frac{x^5}{120} + O(x^7) $$

Meaning that $\sin{x} = x - \frac{x^3}{6} + \frac{x^5}{120}$ and terms of order $x^7$ and higher, so we say that those 'higher order terms' are equal to $O(x^7)$.

However, according to wikipedia, the definition of $f(x) = O(g(x))$ is that for all $x > x_o$ for some $x_o$, $\frac{|f(x)|}{|g(x)|} < M $ for some constant M. According to this definition, the terms after the $x^7$th term in the taylor expansion of $\sin{x}$ are /not/ $O(x^7)$, because as $x$ approaches infinity, the higher order terms should dominate the $O(x^7)$ term, not be bounded by it.

Am I missing something here?

Maksim
  • 546
  • 1
  • 5
  • 6
  • 24
    It's $O(x^7)$ as $x$ tends to $0$. The $O(f)$ notation is for all limits, not only $x \to +\infty$. For such approximations, naturally, the behaviour near $0$ is the interesting bit. (And, by the way, for real $x$, the error here is $O(x^5)$ as $x\to \pm\infty$.) – Daniel Fischer Sep 22 '13 at 21:52
  • 15
    There's no such thing as "$O(f)$", there's only "$O(f)$ as $x\to \infty$" or "$O(f)$ as $x\to a$". Admittedly, the additional specification is left out when it is (supposed to be) clear what is meant, but as observed this makes things ambiguous. – Hagen von Eitzen Sep 22 '13 at 22:27
  • 4
    $x^3/6$ should be $-x^3/6$. – Stefan Smith Sep 22 '13 at 22:43
  • It is worth noting that both of the definitions that @HagenvonEitzen refers to are described on the Wikipedia page. (Just scroll down a little!) – Joshua Perrett Jul 08 '23 at 20:00

3 Answers3

9

The Big Oh notation here is not the same as it is used, e.g., in the study of algorithms in computer science. It is actually about the behaviour of $f$ close to a point (zero in this case). We could define $f(x) = O\bigl(g(x)\bigr)$ if there exists $\varepsilon > 0$ and a constant $c > 0$ such that $|x| < \varepsilon$ implies $|f(x)| \leq c g(x)$.

As for why we use this notation: Sometimes, higher-order terms are not really relevant for describing the local behavior of functions. E.g., from $$\sin x = x- \frac{x^3}{6} + \frac{x^5}{120} + O(x^7)$$ it follows that

  1. $\sin (0) = 0$,
  2. $\sin' (0) = 1$,
  3. $\sin'' (0) = 0,$
  4. $\sin^{(3)} (0) = -1,$
  5. $\sin^{(4)} (0) = 0,$
  6. $\sin^{(5)} (0) = 1,$
  7. $\sin^{(6)}(0) = 0$.

Note, however, that it does not imply that $\sin^{(7)} (0)= -1$.

Another reason for using the Big Oh notation is that it basically encompasses Taylor's Theorem, but in a potentially more readable way: Whenever $f$ is $n$-times continuously differentiable at zero, we have $$f(x) = f(0) + f'(0) \cdot x + \frac{f''(0)}{2} \cdot x^2 + \cdots + \frac{f^{(n)}(0)}{n!} \cdot x^n + O(x^{{n+1}}).$$

Levi
  • 4,894
  • 1
    This is the "same as it is used, e.g., in the study of algorithms in computer science", just on a different neighborhood ($0$ instead of $\infty$). – Clement C. Nov 28 '22 at 20:33
  • I agree, I should have been more precise. – Levi Nov 28 '22 at 21:09
  • @Levi For using the big $O$ notation in Taylor's theorem, you need the existence of $f^{(n+1)}$ and also $f^{(n+1)} \neq 0$ in the neighbourhood of $0$. A trivial case: if $f(x)=ax+b$, then $f(x)$ is $O(x)$ and not $O(x^2)$. – A.G. Aug 21 '24 at 09:54
  • And a less trivial one: $f(x)=\sin(x) = x + O(x^3)$ near $0$ and not $O(x^2)$. (but it is little $o(x^2)$) – A.G. Aug 21 '24 at 10:01
9

The notion of Big O, here, is to give an approximation/upper bound in the neighborhood of the value. It means that if you have a numerical approximation in a small neighborhood of x then higher order terms rapidly go to zero with small perturbations. If I move $.001$ from $x$ then $.001$ to the seventh is next largest term in the series and is, indeed, very small.

The second two lines of the formal definition from wikipedia are what you want to think about in terms of a taylor series approximating a periodic function.

turnman
  • 17
  • $x^3/6$ should be $-x^3/6$. OP should know. I already added a comment below the question. – Stefan Smith Sep 22 '13 at 22:44
  • "If I move .001 from x then .001 to the seventh is next largest term in the series and is, indeed, very small." Well what if the derivative is enormous, making the contribution significant? – Antonios Sarikas Aug 15 '24 at 15:42
3

We can write where the big Oh takes place to be clearer: $$ \sin x = x + \underset{x \to 0}{\mathcal O} \left( x^3 \right)$$ or $$ \sqrt{1+ \frac{1}{n}} = 1 + \frac{1}{2n} + \underset{n \to +\infty}{\mathcal O} \left( \frac1{n^2} \right)$$

Héhéhé
  • 1,440
  • A cool idea! You even used the Calligraphic (Chancery) capital letter O instead of the Roman type one, which helps distinguish it as an operator separate from other circular shapes – cmarangu Aug 31 '23 at 21:59