# Logarithmic Functions

Since exponential function `y=a^x` is monotonic (i.e. either increasing or decreasing) then it passes horizontal line test. Thus, it has inverse function. To find this function we use algorithm for finding inverse.

Interchange `x` and `y`: `x=a^y`. To write this in terms of `y` we introduce new record: `y=log_a(x)`.

So, `x=a^y` is equivalent to `y=log_a(x)`. For example, `log_2(8)=3` because `2^3=8`.

Function `y=log_a(x)` is called **logarithmic function**. Its domain is `(0,oo)` and range is `(-oo,oo)`.

Since `y=log_a(x)` is inverse of `y=a^x` then their graphs are symmetric about line `y=x`.

**Properties of Logarithms**

If `x` and `y` are positive numbers then

- `a^(log_a(x))=x`, for any `x`,
- `log_a(a^x)=x`, for `x>0`,
- `log_a(xy)=log_a(x)+log_a(y)`,
- `log_a(x/y)=log_a(x)-log_a(y)`,
- `log_a(x^b)=blog_a(x)` (where `b` is any real number)

First two properties follow from definition of inverse, last three properties follow from corresponding properties of exponentials.

**Example 1**. Evaluate `log_2(3)+log_2(20)-log_2(15)`.

Using properties of logarithms we can write that `log_2(3)+log_2(20)-log_2(15)=log_2(3*20)-log_2(15)=log_2(60)-log_2(15)=log_2(60/15)=log_2(4)=2`

because `2^2=4`.

**Natural logarithm**

Of all possible bases `a` the most convenient when working with logarithms is base `e` (number `e~~2.718`). We will talk why is this so in next notes.

So, logarithm with base `e` is called natural logarithm and is denoted as `ln(x)`: `log_e(x)=ln(x)`.

From definition of inverse it follows that `ln(x)=y\ <=>\ e^y=x`.

Also, `ln(e^x)=x` for `x in (-oo,\ oo)` and `e^(ln(x))=x` for `x>0`.

In particular `ln(e)=1`.

**Example 2**. Solve equation `e^(3x+5)=4`.

Take natural logaritms of both sides: `ln(e^(3x+5))=ln(4)` or `3x+5=ln(4)` , so `x=(ln(4)-5)/3`.

**Example 3**. Solve `ln(x^3+1)=2`.

Apply exponential function to both sides of equation: `e^(ln(x^3+1))=e^2` or `x^3+1=e^2`.

So, `x=root(3)(e^2-1)`.

**Example 4**. Simplify `2ln(x)-1/3 ln(y)`.

Using properties of logarithms we can write that `2ln(x)-1/3 ln(y)=ln(x^2)-ln(y^(1/3))=ln((x^2)/(y^(1/3)))`.

Now, let's see how can we express logaritm with one base through logarithm with another base.

Let `y=log_a(x)`. This means that `a^y=x`.

Taking logarithms with base `b` we have that `log_b(a^y)=log_b(x)` or `y log_b(a)=log_b(x)`.

Thus, `y=(log_b(x))/(log_b(a))`. From another side `y=log_a(x)`.

Finally, `log_a(x)=1/(log_b(a)) log_b(x)`.

**Change of base formula**. `log_a(x)=(log_b(x))/(log_b(a))`.

In case when `b=e` we can write equation as `color(blue)(log_a(x)=ln(x)/ln(a))`.