# Asymptotic behavior of $n^2-n$

I recently became familiar with the Power of Wolfram.

As a part of the problem I'm working o, I need to find which of the following is closer to $$n^2-n$$

$$O(n \sqrt n)$$ or $$O(n \log n)$$ or $$O(n^2)$$.

Maybe this is a very basic question, but I need to learn about it, and my challenge is how I can calculate it by using Wolfram Online?

• O(f(x)) is an upper bound to the absolute value of f for large values of x. Therefore, as n Sqrt[n]< n^2-n and n log[n] < jn^2-n for large n, only O(n^2) is an upper bound to n^2-n – Daniel Huber Dec 19 '20 at 12:24
• Have you seen Series? – Michael E2 Dec 19 '20 at 14:05
• Your function is not equal to O(nLog[n]) or O[n Sqrt[n]], but n^2-n = O[^2]. Read e.g.: en.wikipedia.org/wiki/Big_O_notation – Daniel Huber Dec 19 '20 at 15:42

Asymptotic[n^2 - n, n -> ∞]
(*    n^2    *)


From the documentation:

Asymptotic[expr, x->x0] computes the leading term in an asymptotic expansion for expr. Use SeriesTermGoal to specify more terms.

• Wolfram|Alpha doesn't understand your query – Jessica Jung Dec 19 '20 at 17:27
• @JessicaJung this forum is about Mathematica and the Wolfram language, not about Wolfram|Alpha. – Roman Dec 19 '20 at 18:12
• @JessicaJung you can use the Wolfram Cloud to calculate this. It would satisfy, then, your question’s mention of using “Wolfram Online”, which can be best interpreted as being Wolfram Cloud or Mathematica Online, neither of which are Wolfram|Alpha. – CA Trevillian Dec 20 '20 at 15:33
• @JessicaJung here's a useful alternative to Wolfram|Alpha: sandbox.open.wolframcloud.com/app/view/… that will open a Mathematica notebook in the cloud. You can then paste Roman's code and press Shift-Enter to get the result provided. – b3m2a1 Dec 20 '20 at 20:42
• @b3m2a1 very nice I see it. but my problem is another things. for example how I can see for example compare arbitrary function like $n^2$ and $n^2 log n$ from $O$ notation? – Jessica Jung Dec 24 '20 at 5:08
\$Version


12.0.0

I have only AsymptoticEqual.

AsymptoticEqual[n^2 - n, n^2, n -> \[Infinity]]


(* True *)

The sign in front of the n does not matter for that truth. This built-in is new in 12.0.0 and newer.

• I honestly don't see what value this brings that Roman's answer didn't already provide – b3m2a1 Dec 20 '20 at 20:39
• @b3m2a1 AsymptoticEqual[n^2 - n, n*Log[n], n -> ∞] return False` is valuable. – cvgmt Dec 20 '20 at 23:46