Determine Big O of a function (Discrete math)

  • Thread starter Miike012
  • Start date
  • #1
Miike012
1,011
0
Question:
Determine whether the function log(n2+1) is O(logn).

Definition in paint document if needed.

Solution:

n2 + 1 < 2n2 whenever n>1

log(n2 + 1) < log( 2n2 ) = log(2) + 2log(n).

Now, log(n)>log(2) whenever n>2. Therefore

log(2) + 2log(n)<3log(n).

log(n2 + 1) ≤ 3log(n) whenever n>2.
∴Because there exists constants C and k such that log(n2 + 1)≤Clog(n) whenever n>k we can conclude log(n2 + 1) is O(logn).


Is this correct? The book says that log(n2 + 1) is not O(logn).
 

Attachments

  • DD.jpg
    DD.jpg
    8.1 KB · Views: 909

Answers and Replies

  • #2
Office_Shredder
Staff Emeritus
Science Advisor
Gold Member
2021 Award
5,236
1,182
I think the book is wrong and you are right.
 
  • #3
Dick
Science Advisor
Homework Helper
26,263
620
Question:
Determine whether the function log(n2+1) is O(logn).

Definition in paint document if needed.

Solution:

n2 + 1 < 2n2 whenever n>1

log(n2 + 1) < log( 2n2 ) = log(2) + 2log(n).

Now, log(n)>log(2) whenever n>2. Therefore

log(2) + 2log(n)<3log(n).

log(n2 + 1) ≤ 3log(n) whenever n>2.
∴Because there exists constants C and k such that log(n2 + 1)≤Clog(n) whenever n>k we can conclude log(n2 + 1) is O(logn).


Is this correct? The book says that log(n2 + 1) is not O(logn).

I think you are right and your book is mistaken.
 

Suggested for: Determine Big O of a function (Discrete math)

  • Last Post
Replies
3
Views
367
  • Last Post
Replies
7
Views
156
Replies
10
Views
524
Replies
1
Views
138
Replies
2
Views
344
Replies
3
Views
109
  • Last Post
Replies
10
Views
105
Replies
7
Views
232
  • Last Post
Replies
7
Views
298
Replies
18
Views
147
Top