Big-Oh algebra with logarithms that I don't get?

In summary, Big-Oh notation with logarithms is used to describe the growth rate of a function or algorithm. To determine the Big-Oh complexity of a function with logarithms, you can use the rules of logarithms and simplify the expression until you are left with the dominant term. This can be used for any function with a logarithm in its expression, but it is often used for complex algorithms or functions with large input sizes. Comparing the efficiency of two functions with logarithms can be done by comparing their Big-Oh complexities, where the one with the lower complexity is considered more efficient. The base of the logarithm is taken into account in Big-Oh notation, but it does not affect the overall complexity as it only results
  • #1
Nishiura_high
7
0
My textbook says O(3log2 n) can be written as O(nlog2 3). Why is that?

Thank you.
 
Physics news on Phys.org
  • #2
Welcome to PF, Nishiura_high! :smile:

Nishiura_high said:
My textbook says O(3log2 n) can be written as O(nlog2 3). Why is that?

Thank you.

One of the log rules is that ##\log a^b = b \log a##.

So:
$$\log_2(3^{\log_2 n}) = \log_2 n \cdot \log_2 3$$
and also:
$$\log_2(n^{\log_2 3}) = \log_2 3 \cdot \log_2 n$$
 

1. What is the purpose of using Big-Oh notation with logarithms?

Big-Oh notation with logarithms is used to describe the growth rate of a function or algorithm. It helps us understand how the performance of a function or algorithm changes as the input size increases.

2. How do I determine the Big-Oh complexity of a function with logarithms?

To determine the Big-Oh complexity of a function with logarithms, you can use the rules of logarithms and simplify the expression until you are left with the dominant term. The dominant term will be the one with the largest exponent, and that will be the Big-Oh complexity of the function.

3. Can I use Big-Oh notation with logarithms for all functions?

Yes, Big-Oh notation with logarithms can be used for any function that has a logarithm in its expression. However, it is often used for functions with large input sizes or complex algorithms.

4. How do I compare the efficiency of two functions with logarithms using Big-Oh notation?

The function with a lower Big-Oh complexity is considered more efficient. So, to compare the efficiency of two functions with logarithms, you can simply compare their Big-Oh complexities. The one with the lower complexity will be more efficient.

5. Does Big-Oh notation with logarithms take into account the base of the logarithm?

Yes, the base of the logarithm is taken into account when using Big-Oh notation. However, the base of the logarithm does not affect the overall complexity of the function, as it only results in a constant factor. Therefore, it is usually ignored in Big-Oh notation.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
8
Views
761
  • Special and General Relativity
Replies
11
Views
1K
  • Precalculus Mathematics Homework Help
Replies
12
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
Replies
1
Views
978
  • STEM Academic Advising
Replies
16
Views
497
  • Calculus and Beyond Homework Help
Replies
2
Views
576
  • Precalculus Mathematics Homework Help
Replies
1
Views
889
  • Precalculus Mathematics Homework Help
Replies
10
Views
609
  • Other Physics Topics
Replies
3
Views
3K
Back
Top