_Prologue: The big $O$ notation is a classic example of the power and ambiguity of some notations as part of language loved by human mind. No matter how much confusion it have caused, it remains the choice of notation to convey the ideas that we can easily identify and agree to efficiently._ > I totally understand what big $O$ notation means. My issue is when we say $T(n)=O(f(n))$ , where $T(n)$ is running time of an algorithm on input of size $n$. Sorry, but you do not have an issue if you understand the meaning of big $O$ notation. > I understand semantics of it. But $T(n)$ and $O(f(n))$ are two different things. $T(n)$ is an exact number, But $O(f(n))$ is not a function that spits out a number, so technically we can't say $T(n)$ ***equals*** $O(f(n))$, if one asks you what's the ***value*** of $O(f(n))$, what would be your answer? There is no answer. **What is important is the semantics**. What is important is (how) people can agree easily on (one of) its precise interpretations that will describe asymptotic behavior or time or space complexity we are interested in. The default precise interpretation/definition of $T(n)=O(f(n))$ is, as translated from [Wikipedia](https://en.wikipedia.org/wiki/Big_O_notation#Formal_definition), > $T$ is a real or complex valued function and $f$ is a real valued function, both defined on some unbounded subset of the real positive numbers, such that $f(n)$ is strictly positive for all large enough values of $n$. For for all sufficiently large values of $n$, the absolute value of $T(n)$ is at most a positive constant multiple of $f(n)$. That is, there exists a positive real number $M$ and a real number $n_0$ such that > > ${\text{ for all }n\geq n_{0}, |T(n)|\leq \;Mf(n){\text{ for all }}n\geq n_{0}.}$ Please note this interpretation is considered **the definition**. All other interpretations and understandings, which may help you greatly in various ways, are secondary and corollary. Everyone (well, at least every answerer here) agrees to this interpretation/definition/semantics. As long as you can apply this interpretation, you are probably good most of time. Relax and be comfortable. You do not want to think too much, just as you do not think too much about some of the irregularity of English or French or most of natural languages. Just use the notation by that definition. > $T(n)$ is an exact number, But $O(f(n))$ is not a function that spits out a number, so technically we can't say $T(n)$ ***equals*** $O(f(n))$, if one asks you what's the ***value*** of $O(f(n))$, what would be your answer? There is no answer. Indeed, there could be no answer, since the question is ill-posed. $T(n)$ does not mean an exact number. It is meant to stand for a function whose name is $T$ and whose formal parameter is $n$ (which is sort of bounded to the $n$ in $f(n)$). It is just as correct and even more so if we write $T=O(f)$. If $T$ is the function that maps $n$ to $n^2$ and $f$ is the function that maps $n$ to $n^3$, it is also conventional to write $f(n)=O(n^3)$ or $n^2=O(n^3)$. Please also note that the definition does not say $O$ is a function or not. It does not say the left hand side is supposed to be equal to the right hand side at all! You are right to suspect that equal sign does not mean [equality in its ordinary sense](https://simple.wikipedia.org/wiki/Equality_(mathematics)), where you can switch both sides of the equality and it should be backed by an equivalent relation. (Another even more famous example of abuse of the equal sign is the usage of equal sign to mean assignment in most programming languages, instead of more cumbersome `:=` as in some languages.) If we are only concerned about that one equality (I am starting to abuse language as well. It **is not an equality**; however, it **is an equality** since there is an equal sign in the notation or it could be construed as some kind of equality), $T(n)=O(f(n))$, this answer is done. However, the question actually goes on. What does it mean by, for example, $f(n)=3n+O(\log n)$? This equality is not covered by the definition above. We would like to introduce another convention, **the placeholder convention**. Here is the full statement of placeholder convention as [stated in Wikipedia](https://en.wikipedia.org/wiki/Big_O_notation#Multiple_usages). > In more complicated usage, $O(\cdots)$ can appear in different places in an equation, even several times on each side. For example, the following are true for $n\to \infty$. > > $(n+1)^{2}=n^{2}+O(n)$ > $(n+O(n^{1/2}))(n+O(\log n))^{2}=n^{3}+O(n^{5/2})$ > $n^{O(1)}=O(e^{n})$ > > The meaning of such statements is as follows: for any functions which satisfy each $O(\cdots)$ on the left side, there are some functions satisfying each $O(\cdots)$ on the right side, such that substituting all these functions into the equation makes the two sides equal. For example, the third equation above means: "For any function $f(n) = O(1)$, there is some function $g(n) = O(e^n)$ such that $n^{f(n)} = g(n)$." You may want to check [here](https://cs.stackexchange.com/a/88546/91753) for another example of placeholder convention in action. You might have noticed by now that I have not used the set-theoretic explanation of the big $O$-notation. All I have done is just to show even without that set-theoretic explanation such as "$O(f(n))$ is a set of functions", we can still understand big $O$-notation fully and perfectly. If you find that set-theoretic explanation useful, please go ahead anyway. You can check the section in "asymptotic notation" of CLRS for a more detailed analysis and usage pattern for the family of notations for asymptotic behavior, such as big $\Theta$, $\Omega$, small $o$, small $\omega$, multivariable usage and more. The [Wikipedia entry](https://en.wikipedia.org/wiki/Big_O_notation) is also a pretty good reference. Lastly, there is some inherent ambiguity/controversy with big $O$ notation with multiple variables,[1](https://en.wikipedia.org/wiki/Big_O_notation#Multiple_variables) and [2](http://people.cis.ksu.edu/~rhowell/asymptotic.pdf). You might want to think twice when you are using those.