# Omitting Bases in Logs in Big O

For asymptotic complexity, base of logarithms does not matter, but why ?

First we must look at the definition of Big O. A function f(n) is said to belong to O(g(n)) if and only if f(n) ≤ C*g(n) whenever n >k , where both k and C are constants.

f(n) ≤ C*g(n) whenever n > k

In order to show this our f(n) = log base a of n and our g(n) = log base b of n. This would give us the following equation.

We can choose values for C and k that would make the above equation true. I will choose C = log base a of b and k = 0. Now our equation will look like the following.

Notice the right hand side of the equation (log base a of b times log base b of n). We can rewrite this equation thanks to the properties of logarithms.

Notice that the right hand side of the equation (log base a of b times log base b of n) is exactly equal to log base a of n which is the value on the left hand side of the equation. So now we get the following equation.

The above equation is always true no matter what the values a, b or n are. Of course a and b must be greater than 1, and n must be greater than 0, so this is why the base doesn’t matter when dealing with Big O asymptotic.

If you would like to learn more about Algorithm Analysis , you can take my online course here. I also have a course on Udemy.com called Recurrence Relation Made Easy where I help students to understand how to solve recurrence relations and asymptotic terms such as Big-O, Big Omega, and Theta. You can check out my YouTube channel of videos where I solve recurrence relations and perform algorithm analysis on code that anyone can check out for free !

Thanks for reading this article I hope its helpful to you all ! Keep up the learning, and if you would like more computer science, programming and algorithm analysis videos please visit and subscribe to my YouTube channels (randerson112358 & compsci112358 )

# Check Out the following for content / videos on Computer Science, Algorithm Analysis, Programming and Logic:

compsci112358:

Video Tutorials on Recurrence Relation:

Video Tutorial on Algorithm Analysis:
https://www.udemy.com/algorithm-analysis/

# Udemy Videos on Algortithm Analysis:

Resources:

https://stackoverflow.com/questions/20709267/big-o-notation-log-base-2-or-log-base-10

https://www.quora.com/Why-we-do-not-consider-base-of-log-in-time-complexity

https://math.stackexchange.com/questions/37377/omitting-bases-in-logs-big-o

https://stackoverflow.com/questions/1569702/is-big-ologn-log-base-e

http://www.cs.cornell.edu/courses/cs211/2005sp/Lectures/L14-BigO/L14-15-Complexity.4up.pdf

Written by