In mathematics, the binary logarithm (log2 n) is the power to which the number 2 must be raised to obtain the value n. That is, for any real number x, x=log2n⟺2x=n. For example, the binary logarithm of 1 is 0, the binary logarithm of 2 is 1, the binary logarithm of 4 is 2, and the binary logarithm of 32 is 5. The binary logarithm is the logarithm to the base 2 and is the inverse function of the power of two function. There are several alternatives to the log2 notation for the binary logarithm; see the Notation section below. Historically, the first application of binary logarithms was in music theory, by Leonhard Euler: the binary logarithm of a frequency ratio of two musical tones gives the number of octaves by which the tones differ. Binary logarithms can be used to calculate the length of the representation of a number in the binary numeral system, or the number of bits needed to encode a message in information theory. In computer science, they count the number of steps needed for binary search and related algorithms. Other areas in which the binary logarithm is frequently used include combinatorics, bioinformatics, the design of sports tournaments, and photography. Binary logarithms are included in the standard C mathematical functions and other mathematical software packages.
History
The binary logarithm of a power of two is its position in the ordered sequence of powers of two, and the powers of two have been known since antiquity. They appear in Euclid's Elements, Props. IX.32 (on the factorization of powers of two) and IX.36 (half of the Euclid–Euler theorem, on the structure of even perfect numbers). The 8th century Jain mathematician Virasena defined the concept of ardhacheda to be the number of times a given number can be divided evenly by two. This coincides with the binary logarithm on the powers of two, but it is different for other integers, giving the 2-adic order rather than the logarithm. Michael Stifel's 1544 book Arithmetica Integra contains several tables that show the integers with their corresponding powers of two. Reversing the rows of these tables allow them to be interpreted as tables of binary logarithms, in the same sense that Virasena's ardhacheda, applied to a power of two, can be interpreted as a binary logarithm. The modern form of a binary logarithm, applying to any number (not just powers of two) was considered explicitly by Leonhard Euler in 1739. Euler established the application of binary logarithms to music theory, long before their applications in information theory and computer science became known. As part of his work in this area, Euler published a table of binary logarithms of the integers from 1 to 8, to seven decimal digits of accuracy.
Definition and properties The binary logarithm function may be defined as the inverse function to the power of two function, which is a strictly increasing function over the positive real numbers and therefore has a unique inverse. Alternatively, it may be defined as ln n / ln 2, where ln is the natural logarithm, defined in any of its standard ways. Using the complex logarithm in this definition allows the binary logarithm to be extended to the complex numbers. As with other logarithms, the binary logarithm obeys the following equations, which can be used to simplify formulas that combine binary logarithms with multiplication or exponentiation: log2xy=log2x+log2y log2xy=log2x−log2y log2xy=ylog2x. For more, see list of logarithmic identities.
Notation In mathematics, the binary logarithm of a number n is often written as log2 n. However, several other notations for this function have been used or proposed, especially in application areas. Some authors write the binary logarithm as lg n, the notation listed in The Chicago Manual of Style. Donald Knuth credits this notation to a suggestion of Edward Reingold, but its use in both information theory and computer science dates to before Reingold was active. The binary logarithm has also been written as log n with a prior statement that the default base for the logarithm is 2. Another notation that is often used for the same function (especially in the German scientific literature) is ld n, from Latin logarithmus dualis or logarithmus dyadis. The DIN 1302, ISO 31-11 and ISO 80000-2 standards recommend yet another notation, lb n. According to these standards, lg n should not be used for the binary logarithm, as it is instead reserved for the common logarithm log10 n.
Applications
Information theory The number of digits (bits) in the binary representation of a positive integer n is the integral part of 1 + log2 n, i.e. ⌊log2n⌋+1. In information theory, the definition of the amount of self-information and information entropy is often expressed with the binary logarithm, corresponding to making the bit the fundamental unit of information. With these units, the Shannon–Hartley theorem expresses the information capacity of a channel as the binary logarithm of its signal-to-noise ratio, plus one. However, the natural logarithm and the nat are also used in alternative notations for these definitions.
Combinatorics
Although the natural logarithm is more important than the binary logarithm in many areas of pure mathematics such as number theory and mathematical analysis, the binary logarithm has several applications in combinatorics:
… excerpt ends here. Continue reading the full article.





