# Math Insight

### Basic idea and rules for logarithms

#### The basic idea

A logarithm is the opposite of a power. In other words, if we take a logarithm of a number, we undo an exponentiation.

Let's start with simple example. If we take the base $b=2$ and raise it to the power of $k=3$, we have the expression $2^3$. The result is some number, we'll call it $c$, defined by $2^3=c$. We can use the rules of exponentiation to calculate that the result is $$c= 2^3 = 8.$$

Let's say I didn't tell you what the exponent $k$ was. Instead, I told that the base was $b=2$ and the final result of the exponentiation was $c=8$. To calculate the exponent $k$, you need to solve $$2^k = 8.$$ From the above calculation, we already know that $k=3$. But, what if I changed my mind, and told you that the result of the exponentiation was $c=4$, so you need to solve $2^k=4$? Or, I could have said the result was $c=16$ (solve $2^k=16$) or $c=1$ (solve $2^k=1$).

A logarithm is a function that does all this work for you. We define one type of logarithm (called “log base 2” and denoted $\log_2$) to be the solution to the problems I just asked. Log base 2 is defined so that $$\log_2 c = k$$ is the solution to the problem $$2^k=c$$ for any given number $c$. In other words, the logarithm gives the exponent as the output if you give it the exponentiation result as the input. To get all answers for the above problems, we just need to give the logarithm the exponentiation result $c$ and it will give the right exponent $k$ of $2$. The solution to the above problems are: \begin{align*} \log_2 8 &= 3\\ \log_2 4 &=2\\ \log_2 16 &= 4\\ \log_2 1 &=0 \end{align*}

Just like we can change the base $b$ for the exponential function, we can also change the base $b$ for the logarithmic function. The logarithm with base $b$ is defined so that $$\log_b c = k$$ is the solution to the problem $$b^k=c$$ for any given number $c$ and any base $b$.

For example, since we can calculate that $10^3=1000$, we know that $\log_{10} 1000 = 3$ (“log base 10 of 1000 is 3”). Using base 10 is fairly common. But, since in science, we typically use exponents with base $e$, it's even more natural to use $e$ for the base of the logarithm. This natural logarithm is frequently denoted by $\ln(x)$, i.e., $$\ln(x) = \log_e x.$$ In other words, \begin{gather} k= \ln(c) \label{naturalloga} \end{gather} is the solution to the problem \begin{gather} e^k = c \label{naturallogb} \end{gather} for any number $c$. Since using base $e$ is so natural to mathematicians, they will sometimes just use the notation $\log x$ instead of $\ln x$. However, others might use the notation $\log x$ for a logarithm base 10, i.e., as a shorthand notation for $\log_{10} x$. Because of this ambiguity, if someone uses $\log x$ without stating the base of the logarithm, you might not know what base they are implying. In that case, it's good to ask.

#### Basic rules for logarithms

Since taking a logarithm is the opposite of exponentiation (more precisely, the logarithmic function $\log_b x$ is the inverse function of the exponential function $b^x$), we can derive the basic rules for logarithms from the basic rules for exponents.

For simplicity, we'll write the rules in terms of the natural logarithm $\ln(x)$. The rules apply for any logarithm $\log_b x$, except that you have to replace any occurence of $e$ with the new base $b$.

The natural log was defined by equations \eqref{naturalloga} and \eqref{naturallogb}. If we plug the value of $k$ from equation \eqref{naturalloga} into equation \eqref{naturallogb}, we determine that a relationship between the natural log and the exponential function is \begin{gather} e^{\ln c} = c. \label{lnexpinversesa} \end{gather} Or, if we plug in the value of $c$ from \eqref{naturallogb} into equation \eqref{naturalloga}, we'll obtain another relationship \begin{gather} \ln \bigl(e^{k}\bigr) = k. \label{lnexpinversesb} \end{gather} These equations simply state that $e^x$ and $\ln x$ are inverse functions. We'll use equations \eqref{lnexpinversesa} and \eqref{lnexpinversesb} to derive the following rules for the logarithm.

Rule or special caseFormula
Product$\ln(xy) = \ln(x)+\ln(y)$
Quotient$\ln(x/y) = \ln(x)-\ln(y)$
Log of power$\ln(x^y) = y\ln(x)$