big o - How is f(x) = 4x^2 - 5x + 3 is O(x^2) derived -


here steps used prove above

|f(x)| = |4x^2 – 5x + 3| <= |4x^2|+ |- 5x| + |3| <= 4x^2 + 5x + 3, x > 0 <= 4x^2 + 5x^2 + 3x^2, x > 1 <= 12x^2, x > 1  

hence conclude f(x) o(x^2)

i referred this not

can explain above proof step step?

  1. why absolute value of f(x) taken ?
  2. why , how term replaced x^2 term?

preparations

we start loosely stating definition of function or algorithm f being in o(g(n)):

if function f in o(g(n)), c · g(n) upper bound on f(n), some non-negative constant c such f(n) ≤ c · g(n) holds, for sufficiently large n (i.e. , n ≥ n0 constant n0).

hence, show f ∈ o(g(n)), need find set of (non-negative) constants (c, n0) fulfils

f(n) ≤ c · g(n), n ≥ n0,                                (+) 

we note, however, set is not unique; problem of finding constants (c, n0) such (+) holds degenerate. in fact, if such pair of constants exists, there exist infinite amount of different such pairs.


analysis

for common convention, we'll analyse example using variable name n rather x.

f(n) = 4n^2 - 5n + 3                                            (++) 

now, example, may assume, without loss of generality (since we're studying asymptotic complexity: function/algorithm behavior "large" n) n > n0 n0 > 0. correspond analysis you've shown in question analyzing absolute values of x. anyway, given assumption, following holds:

f(n) = 4n^2 - 5n + 3 < 4n^2 + 3, n > n0 

now let, again without loss of generality, n0 equal 2 (we choose value, lets choose 2 here). n0 = 2, naturally n^2 > 3 holds n > n0, means following holds:

f(n) = 4n^2 - 5n + 3 < 4n^2 + 3 < 4n^2 + n^2, n > n0 = 2 f(n) < 5n^2, n > n0 = 2 

now choose c = 5 , let g(n) = n^2:

f(n) < c · g(n), n > n0,                  c = 5, n0 = 2, g(n) = n^2 

hence, (+), we've shown f defined in (++) in o(g(n)) = o(n^2).


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -