# If $\log xy=\log x+\log y$ then why multiplication is harder than addition?

Someone told me that the $\log$ function was introduced to make the calculation easier. If we have to calculate $xy$, we can calculate instead $\log x+\log y$ since $\log xy=\log x+\log y$. How this can make the calculation easier? Maybe from a mathematician point of view but what about a computer scientist's point of view?

If it makes the calcualtion easier then why people do not use it to simplify the complexity of the multiplication algorithms?

From my own thinking, this transformation makes the calculation more difficult. How can we calculate the $\log x$ and $\exp x$ functions in a computer?

• Calculation is made easier for humans as they could use log tables for reference. Similar ideas can be applied to programming. Create a log table as a common data structure (arrays or hash table) and index into it to calculate log values. However, having said that for computers, it's much easier to do multiplication. Apr 8 '14 at 16:36
• There are scenarios when you do not need the transformation. Instead you perform all of your calculations using logarithms. imho the advantage drawn from this has been much offset by the advent of high-performance fpus that have done away with the 1-2 magnitude performance penalty on fp operations. Apr 8 '14 at 16:47

If $\log xy = \log x + \log y$ then why is multiplication harder than addition?

That's not a fair comparison: you're not comparing like with like. If you, instead, phrase it as "If $xy = \exp(\log x + \log y)$ then why is multiplication harder than addition?" then the answer is obvious. Multiplication, done that way, is harder than addition because doing addition just involves doing addition, whereas multiplication involves doing addition, taking logs twice and exponentiating.

How can we calculate the $\log x$ and $\exp x$ functions in a computer?

The main methods are to either use something like a Taylor series or table look-up and interpolation. Taylor series express functions as sums, e.g., $\exp x = \sum_{i=0}^{\infty} x^i/i!$. Add up as many terms as you need to get the desired level of accuracy – note that this involves many additions and many multiplications. Table look-up and interpolation is essentially the same way that paper log tables work. To calculate, say, $\log 4.3$, you'd look up $\log 4$ and $\log 5$ and approximate $\log 4.3$ as being three-tenths of the way between them. (In reality, the table would have more decimal places.) This involves a few additions and multiplications, and a lot of memory.

Logarithms were used to make computation easier at a time when computers were not available. Even in the twentieth century, when mechanical machines became available to do arithmetics with much precision, they remained so expensive, and often cumbersome, that most people did not use them. The mechanical hand held calculator doing the four arithmetic operations did not appears before the end of the second world war (this machine, called the Curta, was actually designed in a concentration camp, which saved some lives). Since most calculations did not require too much precision, many people simply used slide rules, or tables of logarithms. The typical cartoon of a scientist or engineer whould show him with the slide rule in his front pocket.

I am old enough that I did not have hand calculators at school (computers still used more space than my classroom). What I had was a slide-rule, which is based on logarithms. It did not give a very high precision (at best something like $10^3$, i.e., 3 decimal digits), but it was invaluable to do problems in physics. Numbers were read directly on the slide rule, that essentially can add lengths.

For more précision, we would use tables stored in books. That gave 4 digits, plus one with interpolation (as I recall). We also has direct table for logarithms of trigonometric functions.

This was well organized, and the cost of computing logs and exponentials with the tables was nothing compared to the savings of not doing multiplications by hand. It was actually free, with direct reading of graduations, on the slide-rule.

This was not a mathematician viewpoint, but a physicist viewpoint, or that of any person having to do much calculation involving multiplications, such as astronomers, or people mapping the land (which probably took several centuries).

I did not check, but I would guess that numerical algorithmic design at the time must have been much influenced by the idea of minimizing translation to and from logarithms. I would guess we were told in class to be careful about that.

Considerable effort was also spend in building very precise tables. By hand, of course, at least until mechanical arithmetic machines became available. According to wikipedia, despite a large number of earlier prototypes, the calculator industry did not start before the middle of the 19th century.

This all started with the invention of logarithm by John Napier at the beginning of the seventeenth century. His contact with astronomer Tycho Brahe who was at the time mapping very accurately the motion of celestial bodies (so that Kepler and Newton would have the data for the work that made them famous), and other such person, may not have been foreign to his invention of this most remarkable computation tool.

The fact that logarithms can make multiplication easy was certainly one very important factor in the development of science and technology for nearly 3 centuries. But not knowing exactly who used it and when, I cannot make a more precise statement.