PROBLEM

Given:

  • ๐‘”1(๐‘›) = ๐‘‚(๐‘“1(๐‘›))
  • ๐‘”2(๐‘›) = ๐‘‚(๐‘“2(๐‘›))

Show that:

  • ๐‘”1(๐‘›) +ย ๐‘”2(๐‘›) = ๐‘‚(๐‘š๐‘Ž๐‘ฅ(๐‘“1(๐‘›),๐‘“2(๐‘›)))
PROOF
  • ๐‘”1(๐‘›) โ‰ค ๐‘1ยท๐‘“1(๐‘›) for allย ๐‘›โ‰ฅ๐‘›1ย # by definition of Big O notation
  • ๐‘”2(๐‘›) โ‰ค ๐‘2ยท๐‘“2(๐‘›) for all ๐‘›โ‰ฅ๐‘›2ย # by definition of Big O notation

Let:

  • ๐‘›0 = ๐‘š๐‘Ž๐‘ฅ(๐‘›1, ๐‘›2)

Then, for all ๐‘›โ‰ฅ๐‘›0:

  • ๐‘”1(๐‘›) +ย ๐‘”2(๐‘›)ย โ‰ค ๐‘1ยท๐‘“1(๐‘›) +ย ๐‘2ยท๐‘“2(๐‘›)
  • ๐‘”1(๐‘›) +ย ๐‘”2(๐‘›)ย โ‰ค ๐‘1ยท๐‘š๐‘Ž๐‘ฅ(๐‘“1(๐‘›),๐‘“2(๐‘›)) + ๐‘2ยท๐‘š๐‘Ž๐‘ฅ(๐‘“1(๐‘›),๐‘“2(๐‘›))
  • ๐‘”1(๐‘›) +ย ๐‘”2(๐‘›) โ‰ค (๐‘1ย + ๐‘2)ยท๐‘š๐‘Ž๐‘ฅ(๐‘“1(๐‘›),๐‘“2(๐‘›))
  • ๐‘”1(๐‘›) +ย ๐‘”2(๐‘›) โ‰ค ๐‘ยท๐‘š๐‘Ž๐‘ฅ(๐‘“1(๐‘›),๐‘“2(๐‘›)) # ๐‘ = ๐‘1ย + ๐‘2
  • ๐‘”1(๐‘›) +ย ๐‘”2(๐‘›) =ย ๐‘‚(๐‘š๐‘Ž๐‘ฅ(๐‘“1(๐‘›),๐‘“2(๐‘›))) # by definition of Big O notation