We're asked to provide a $ n+4![\sqrt{n}] =O(n) $ with having a good argumentation and a logical build up for it but it's not said how a good argumentation would look like, so I know that $2n+4\sqrt{n}$ always bigger for n=1 but i wouldn't know how to argue about it and how to logically build it since i just thought about it and it happened to be true. Can someone help out with this example so i would know how to do it?
-
you should try to think about it, if( n-> big number) what happens to the contributions of \sqrt[n] part in comparison to n – Gijs Den Hollander Dec 05 '17 at 14:22
-
Hint: sqrt(n) < n when n is large enough, so you can find an upper bound for your function which contains only n and not sqrt(n). – interjay Dec 05 '17 at 14:51
-
May be relevant: https://stackoverflow.com/q/487258/2759108 – SharpKnight Dec 05 '17 at 14:56
2 Answers
You should look at the following site https://en.wikipedia.org/wiki/Big_O_notation
For the O big notation we would say that if a function is the following: X^3+X^2+100X = O(x^3)
. This is with idea that if X-> some very big number, the X^3
term will become the dominant factor in the equation.
You can use the same logic to your equation. Which term will become dominant in your equation. If this is not clear you should try to plot both terms and see how they scale. This could be more clarifying.

- 620
- 4
- 17
A proof is a convincing, logical argument. When in doubt, a good way to write a convincing, logical argument is to use an accepted template for your argument. Then, others can simply check that you have used the template correctly and, if so, the validity of your argument follows.
A useful template for showing asymptotic bounds is mathematical induction. To use this, you show that what you are trying to prove is true for specific simple cases, called base cases, then you assume it is true in all cases up to a certain size (the induction hypothesis) and you finish the proof by showing the hypothesis implies the claim is true for cases of the very next size. If done correctly, you will have shown the claim (parameterized by a natural number n) is true for a fixed n and for all larger n. This is what is exactly what is required for proving asymptotic bounds.
In your case: we want to show that n + 4 * sqrt(n) = O(n)
. Recall that the (one?) formal definition of big-Oh is the following:
A function
f
is bound from above by a functiong
, writtenf(n) = O(g(n))
, if there exist constantsc > 0
andn0 > 0
such that for alln > n0
,f(n) <= c * g(n)
.
Consider the case n = 0
. We have n + 4 * sqrt(n) = 0 + 4 * 0 = 0 <= 0 = c * 0 = c * n
for any constant c
. If we now assume the claim is true for all n
up to and including k
, can we show it is true for n = k + 1
? This would require (k + 1) + 4 * sqrt(k + 1) <= c * (k + 1)
. There are now two cases:
k + 1
is not a perfect square. Since we are doing analysis of algorithms it is implied that we are using integer math, sosqrt(k + 1) = sqrt(k)
in this case. Therefore,(k + 1) + 4 * sqrt(k + 1) = (k + 4 * sqrt(k)) + 1 <= (c * k) + 1 <= c * (k + 1)
by the induction hypothesis provided thatc > 1
.k + 1
is a perfect square. Since we are doing analysis of algorithms it is implied that we are using integer math, sosqrt(k + 1) = sqrt(k) + 1
in this case. Therefore,(k + 1) + 4 * sqrt(k + 1) = (k + 4 * sqrt(k)) + 5 <= (c * k) + 5 <= c * (k + 1)
by the induction hypothesis provided thatc >= 5
.
Because these two cases cover all possibilities and in each case the claim is true for n = k + 1
when we choose c >= 5
, we see that n + 4 * sqrt(n) <= 5 * n
for all n >= 0 = n0
. This concludes the proof that n + 4 * sqrt(n) = O(n)
.

- 27,682
- 3
- 38
- 73