 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 . 
