r/AskComputerScience • u/SaltyAir6808 • Apr 04 '26
I need help
“Using the formal definition of Big-O notation, prove that the function f(n) = 3n^2 + 5n + 2
is 0 (n^2).
I’m so sorry to be posting like this but I’m a beginner as you can see and I’m really having a hard time at this i watched like 10 video explaining it my brain is fried. can anyone help me with it?
1
Upvotes
19
u/Jonny0Than Apr 04 '26
Do you know what the formal definition of Big-O is?
2
u/113862421 Apr 04 '26 edited Apr 04 '26
I’m in a Discrete Math course right now, and the way to prove it is to show that at some value (let’s call it “n”), and some arbitrary constant (let’s call it “c”), for any positive x >= n, c * n2 >= f(n)
That is to say that starting at some positive x value on the graph, every value after that is upper bounded by the c * n2 function.
Let’s say I choose c = 7. If I plug that in, then I have the argument that 7 * n2 >= 3n2 + 5n + 2
Starting at n = 2 and going forward, this argument would be true.
If I’m wrong, someone please let me know.
2
u/mxldevs Apr 04 '26
https://www.geeksforgeeks.org/dsa/analysis-algorithms-big-o-analysis/
Idk the answer but you can try a proof by contradiction, where you assume there exists some input that would make it so that it's not an upper bound
Or a proof by induction, where you show that for every non negative input, it's still bounded above.
-3
u/LoreBadTime Apr 04 '26 edited 1d ago
[This text has been randomized: cheese]
station motion art dawn image mountain ocean