MathAnalysisCalculusNumerical functions

Logarithmic function

11 minutes read

You already know about numerical functions and have just visited the topic of exponential functions. In this topic, we will concentrate on another kind of numerical function – logarithmic functions. These functions are strongly related to exponential functions, and you will see how. Logarithms are widely used in math and computer science. For example, to find the minimal length of the letter A binary code, you need to take a binary logarithm of the alphabet size. We will get the intuition behind logarithms, plot logarithmic functions, and discuss their main properties.

Logarithmic growth

Let's revisit the example of our lucky investment. You have invested 1$1\$ in a project and earn 20%20\% of profit every day. As you know, exponential functions help solve the task of finding how much money you will have on day xx – as many as 1.2x1.2^x dollars. You might remember that even though initially our money is low, it grows very fast.

Three bags of money

Now let's solve the opposite task: find out how many days you need to wait to obtain, say, 1000$1000\$ (or more, since the sums are unlikely to be integers). Surprisingly, you need to wait for only 38 days.

The thing that allows us to calculate this is the logarithm. It is defined as follows:

alogab=ba^{\log_ab}=bBy definition, logab\log_ab is the power to which we need to raise aa to get bb.

Logarithmic function

Let's define a logarithmic function:

f(x)=logax,a>0,a1f(x)=\log_ax,a>0,a\neq1

The function outputs to which power you need to raise a constant aa, the base of the logarithm, to get an argument xx.

Now let's apply this new knowledge to the investment example. Every day the sum is multiplied by 1.21.2, so you are going to have xx dollars on your account on day log1.2x\log_{1.2}x, which makes the number of days depend logarithmically on the account money:

f(x)=log1.2xf(x)=\log_{1.2}x

As you can see, logarithmic functions are rather handy. In our toy example, though, the number of days cannot be fractional or negative, while the codomain of logarithmic functions is R\mathbb{R}.

Specific logarithm bases are widely used, so these logarithms acquired special notation.

  • Logarithm with base 1010 is commonly known as lgx\lg x.

  • Logarithm with base ee, an irrational constant you remember from the topic about exponential functions, is typically called the natural logarithm and written as lnx\ln x (or simply logx\log x, in many programming languages).

Change of base

Logarithms have a remarkable property known as change of base. The formula below demonstrates how to change the logarithm base:

logab=logcblogca\log_ab=\dfrac{\log_cb}{\log_ca}This formula also has a significant special case when you want to swap aa and bb:

logab=logbblogba=1logba\log_ab=\dfrac{\log_bb}{\log_ba}=\dfrac{1}{\log_ba}

By this formula, two logarithmic functions with different bases are linked by a constant:

f(x)=logax,g(x)=logbxf(x)=\log_ax, g(x)=\log_bxf(x)=logax=logbxlogba=1logbalogbx=1logbag(x)=logabg(x)f(x)=\log_ax=\dfrac{\log_bx}{\log_ba}=\dfrac{1}{\log_ba}\cdot \log_bx=\dfrac{1}{\log_ba}\cdot g(x)=\log_ab\cdot g(x)

Logarithm rules

Logarithm rules can help you simplify really complex mathematical expressions containing logarithms. Let's learn them!

The first one is the product rule. It states that the logarithm of the product is the sum of the logarithms of the factors: loga(xy)=logax+logaylog_a(x\cdot y)=log_ax+log_ay

Here's an example of its application. Imagine that you are solving an equation, and one of the terms is log5(5(1+x))log_5(5\cdot(1+x)). Can you simplify this term? Of course, you can!log5(5(1+x))=log55+log5(1+x)=1+log5(1+x)log_5(5\cdot(1+x))=log_55+log_5(1+x)=1+log_5(1+x)

After such simplification, it is much easier to solve the equation.

The second rule is the quotient rule. It states that the logarithm of the ratio of two quantities is the logarithm of the numerator minus the logarithm of the denominator:loga(xy)=logaxlogaylog_a(\frac{x}{y})=log_ax-log_ay

Let's apply this rule to simplify the following expression: log5(45)log_5(\frac{4}{5}).

log5(45)=log54log55=log541log_5(\frac{4}{5}) = \log_54-log_55=log_54-1Now let's move on to the last rule, the power rule. It states that the logarithm of an exponential number equals the exponent multiplied by the logarithm of the base: logaxb=blogaxlog_ax^b=b\cdot log_ax

This rule is also useful for simplification of complex expressions. For example: log58=log523=3log52log_58=log_52^3=3\cdot log_52

Why are the Logarithm rules like this? It is due to their connection to the properties of the exponential function. These proofs are not that easy, so we won't discuss them in our topic.

Plots

Now you are ready to move on to the plots. The following figure shows two examples of logarithmic functions with bases greater than 11.

Two examples of logarithmic functions

As you can see, both functions are strictly increasing. Besides, the nature of growth depends on the base: when x1x \leq 1, the red function values are greater, but when xx passes 11, the yellow function is in the lead. The latter is very intuitive because powers of 44 grow much faster and reach higher values sooner than powers of 2.

In the following figure, there are two more examples of logarithmic functions, now with bases less than 11.

 Two more examples of logarithmic functions

Here both functions are strictly decreasing. It is easy to notice that these functions are similar to the ones in the previous figure but vertically flipped. Let's see why:

f1(x)=log2x=log12xlog122=log12x1=log12x=f3(x)f_1(x)=\log_2x=\dfrac{\log_{\frac{1}{2}}x}{\log_{\frac{1}{2}}2}=\dfrac{\log_{\frac{1}{2}}x}{-1}=-\log_{\frac{1}{2}}x=-f_3(x)As you can see, change of base works. It also makes functions like logax\log_ax to be vertically flipped versions of log1ax\log_{\frac{1}{a}}x.

Properties

Now that you have seen several examples, let's formulate the main properties of logarithmic functions.

  • A logarithmic function is strictly increasing if a>1a>1, and strictly decreasing if 0<a<10<a<1.

  • The domain of all logarithmic functions is (0,+inf)\left(0,+\inf\right). Indeed, since the base is positive, the result of exponentiation (which is xx in case of logarithmic functions) can be neither negative nor 00.

  • The codomain of all logarithmic functions is R\mathbb{R}.

  • Any logarithmic function is unbounded below and above.

  • Logarithmic functions are not symmetrical, thus being neither even nor odd.

You may have noticed that plots and properties of logarithmic functions are somehow related to those of exponential functions. Indeed, these functions are inverse to each other:

y=axx=logayy = a^x \Leftrightarrow x=\log_ayTherefore, the properties of logarithmic functions are inverse to those of exponential functions, and the plots of f(x)=logaxf(x)=\log_ax and g(x)=axg(x)=a^x are symmetrical about the line y=xy=x.

Conclusion

In this topic, you have gone through logarithmic functions and understood the logic behind them and their main properties. Now you know that:

  • Logarithmic functions are inverse to exponential functions, so their properties are inverse to those of exponential functions.

  • Logarithmic functions have very different plots and properties depending on aa: they are strictly increasing if a>1a>1, and strictly decreasing if 0<a<10<a<1.

  • Two logarithmic functions with different bases differ only by a constant coefficient.

  • There are three main logarithm rules: the product rule, the quotient rule and the power rule

You have also learned some peculiar properties of logarithms, such as change of base and dependency between logax\log_a x and log1ax\log_{\frac1a}x.

11 learners liked this piece of theory. 1 didn't like it. What about you?
Report a typo