Understanding logarithms
From inverse function to power and the change-of-base formula
The logarithm is the inverse operation of exponentiation. While the power bʸ = x calculates the value x from base b and exponent y, log_b(x) = y determines the exponent y when base b and result x are known. This makes the logarithm indispensable wherever quantities are thought of on scales spanning powers of ten – from decibels in acoustics to the Richter scale for earthquakes.
The common logarithm (log₁₀, also written lg) is the logarithm to base 10. It states how many times 10 must be multiplied by itself to obtain x: log₁₀(1000) = 3, because 10³ = 1000. In chemistry it is used for the pH value: pH = −log₁₀([H₃O⁺]). The natural logarithm (ln) to base e ≈ 2.71828 is the antiderivative of 1/x and is fundamental to calculus, probability theory and thermodynamics.
The change-of-base formula allows the calculation of logarithms with any base: log_b(x) = ln(x) / ln(b). This means that any calculator capable of computing ln can also calculate logarithms to any base. Our calculator uses exactly this formula. For log₂(8): ln(8) / ln(2) = 2.0794 / 0.6931 = 3. Correct, since 2³ = 8.
In the field of computer science and algorithms, log₂ is especially important: binary search in a sorted array of n elements requires at most log₂(n) comparisons. With n = 1,024 elements, only 10 comparisons are needed (log₂(1024) = 10). This explains the enormous efficiency of binary search trees, heaps and similar data structures. The logarithm is thus the mathematical foundation for understanding algorithmic complexity.