37

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?

Paramanand Singh
  • 79,254
  • 12
  • 118
  • 274
Maksim
  • 506
  • 1
  • 4
  • 6
  • 19
    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
  • 13
    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

3 Answers3

8

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
  • 6
user96131
  • 89
  • 1
4

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$ such that for $|x| < \varepsilon$ we have $f(x) \leq c g(x)$ for some constant $c$.

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}}).$$

rawbacon
  • 4,431
  • 11
  • 28
1

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,031
  • 5
  • 14