# What's the right way to write big-O?

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

• Both are very common. There is no "right". – Antonio Vargas Sep 12 '14 at 19:26
• As long as it doesn't lead to confusion you can use any one of them. – Hakim Sep 12 '14 at 19:32
• Do you write little-o in the mathcal font as well? – Did Sep 12 '14 at 20:02
• 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. – Harald Hanche-Olsen Sep 12 '14 at 20:42
• Why does $\mathfrak{O}$ look so much like $\mathfrak{D}$? – wchargin Sep 12 '14 at 21:24