I always write $\mathcal{O}(n)$ (\mathcal{O}(n)). But I frequently see $O(n)$ (O(n)), probably because it's shorter and more convenient to type.

To me, $\mathcal{O}$ makes more sense because it's a set, and sets are frequently written with calligraphic notation (especially sets of sets, such as sets of functions, such as $\mathcal{O}$).

What is the "right" usage? Is there one?

(Of course, in my $\sf\LaTeX$ documents, I define a \newcommand\bigO{\mathcal{O}} for semantic markup, but that's beside the point here.)

  • 3
    $\begingroup$ Both are very common. There is no "right". $\endgroup$ Sep 12, 2014 at 19:26
  • 1
    $\begingroup$ As long as it doesn't lead to confusion you can use any one of them. $\endgroup$
    – Hakim
    Sep 12, 2014 at 19:32
  • 4
    $\begingroup$ Do you write little-o in the mathcal font as well? $\endgroup$
    – Did
    Sep 12, 2014 at 20:02
  • 1
    $\begingroup$ Also, it is often used less formally and then not considere a set, in notation like $x\sin x=O(x^2)$ for example, which really makes no sense at all as an equation – though it makes perfect sense if you understand the intent. It has to be read left to right, I guess, thus violating the symmetry of the “$=$” sign. So a possible rough guide could be: Use $O$ when you're informal, $\mathcal{O}$ if you want to be pedantic, and $\mathfrak{O}$ if you want to confuse the heck out of everybody. $\endgroup$ Sep 12, 2014 at 20:42
  • $\begingroup$ Why does $\mathfrak{O}$ look so much like $\mathfrak{D}$? $\endgroup$
    – wchargin
    Sep 12, 2014 at 21:24


You must log in to answer this question.

Browse other questions tagged .