简体   繁体   中英

Big O Proof by Induction With Summation

I've been ripping my hair out trying to solve this:

Σ(k=0,n)3k = O(3n)

I've been looking through various things online but I still can't seem to solve it. I know it involves the formal definition of Big O, where

|f(x)| <= C*|g(x)|, x>=k

Since they are the same, I am assuming C is some value I have to find through induction to prove the original statement, and that k=0.

Thanks for your help with this.

Σ(k=0,n)3k 
= 30 + 31 + ... + 3n
= (1 - 3n+1) / (1 - 3) ; sum of geometric series
= (3/2)*3n - k
<= c*3n ; for c >= 3/2 
= O(3n)

Induction is not needed here; that sum is a geometric series and has closed form solution

= 1(1-3^(n + 1))/(1-3) = (3^(n + 1) - 1)/2


= (3*3^n - 1)/2

Pick C = 3/2 and F = 3/2*3^n - 1/2, G = 3^n, and this satisfies the requirement for O(3^n), but really in practice, though it might be thought informal and sloppy, you don't really worry much about an exact constant since any constant will do for satisfying Big-O.

You can rewrite it as 3 n * ( 1 + 1/3 + 1/9 + ....1/3 n ).

There is an upper bound for that sum. Calculate the limit of that infinite series.

From there, it's easy to get a good C, eg: 2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM