Question

Suppose f(n) = O(s(n)), and g(n) = O(r(n)). All four functions are positive-valued and monotonically increasing....

Suppose f(n) = O(s(n)), and g(n) = O(r(n)). All four functions are positive-valued and monotonically increasing. Prove (using the formal definitions of asymptotic notations) or disprove (by counterexample) each of the following claims:

(a) f(n) − g(n) = O(s(n) − r(n))

(b) if s(n) = O(g(n)), then f(n) = O(r(n))

(c) if r(n) = O(s(n)), then g(n) = O(f(n))

(d) if s(n) + g(n) = O(f(n)), then f(n) = Θ(s(n))

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Required defintion -

a(n) = O(b(n)) if there exists a positive integer n0 and a positive constant c, such that a(n)≤c.b(n) ∀ n≥n0

=> for f(n) = O(s(n)), f(n) <= c1.s(n) , n >= n10 - eqn 1

and for g(n) = O(r(n)), g(n) <= c2.r(n) , n >= n20   - eqn 1

Also, to setlle on common n0 value, take n0 = max(n10, n20) and for c, c = max(c1, c2)

(a) f(n) − g(n) = O(s(n) − r(n))

Subtracting eqn 2 from eqn 1,

f(n) - g(n) <= c(s(n) - r(n)), n >= n0

=> this can be written as - f(n) − g(n) = O(s(n) − r(n))

Hence proved.

(b) if s(n) = O(g(n)), then f(n) = O(r(n))

s(n) = O(g(n))

=> s(n) <= c3.g(n) , n >= n0

From eqn 1 and 2,

f(n) <= c1.s(n) <= c1.c3.g(n) <= c1.c3.c2.r(n)

=> f(n) <= c1.c3.c2.r(n)

=> f(n) <= c.r(n) for c = c1.c3.c2

=> f(n) = O(r(n))

Hence proved.

(c) if r(n) = O(s(n)), then g(n) = O(f(n))

r(n) = O(s(n))

=> r(n) <= c3.s(n) , n >= n0

g(n) <= c2.r(n) <= c2.c3.s(n)

The function f(n) does not fit in the equation => Disprove the statement.

Example -

Let f(n) = 1

s(n) =

g(n) = n

r(n) =

Thus, all the conditions fit, that is, f(n) = O(s(n)), g(n) = O(r(n)) and r(n) = O(s(n))

But g(n) O(f(n)), instead f(n) = O(g(n))

=> g(n) = O(f(n)) is not always true.

(d) if s(n) + g(n) = O(f(n)), then f(n) = Θ(s(n))

s(n) + g(n) = O(f(n))

=> s(n) + g(n) <= c3.f(n)

And we know that, f(n) <= c1.s(n)

Adding the function g(n), we only increase (or remain constant) the growth of the function s(n).

=> s(n) + g(n) = O(f(n)) may not be true.

But if f(n) = Θ(s(n)), s(n) <= c4.f(n)

Then this can be true.

Hence proved.

Add a comment
Know the answer?
Add Answer to:
Suppose f(n) = O(s(n)), and g(n) = O(r(n)). All four functions are positive-valued and monotonically increasing....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT