This is an example of a logarithmic graph, it's a reflection of an exponential graph in the line y=x.
A logarithm is the answer to the question: "What number do I need to raise this known number to to get this other known number?"
Example of the problem:
2
x
=
32
{\displaystyle 2^{x}=32}
Rewritten as a logarithm:
log
2
(
32
)
=
x
{\displaystyle \log _{2}(32)=x}
You'd pronounce this as, "log base 2 of 32."
As you can see from the graph, you can't have a negative logarithm. If you think about it, this makes sense because it's a reflection of an exponential graph. When you have a positive number and you raise it to any number, the result will always be positive, and never 0; because of this the domain of a logarithm is as follows:
log
a
(
x
)
,
x
>
0
{\displaystyle \log _{a}(x),x>0}
.
Combining logarithms
edit
There are 3 rules that you should know when combining logarithms:
log
k
a
+
log
k
b
=
log
k
a
b
{\displaystyle \log _{k}a+\log _{k}b=\log _{k}ab}
log
k
a
−
log
k
b
=
log
k
a
b
{\displaystyle \log _{k}a-\log _{k}b=\log _{k}{\frac {a}{b}}}
a
log
k
(
b
)
=
log
k
(
b
a
)
{\displaystyle a\log _{k}(b)=\log _{k}(b^{a})}
Expanding logarithms
edit
When expanding logarithms, you can just do the inverse of what you did to combine them.
Example 1:
log
4
(
x
2
5
3
y
)
=
log
4
(
x
2
)
−
log
4
(
5
3
y
)
=
log
4
(
x
2
)
−
log
4
(
5
3
)
+
log
4
(
y
)
=
2
log
4
(
x
)
−
3
log
4
(
5
)
+
log
4
(
y
)
{\displaystyle \log _{4}{\bigg (}{\frac {x^{2}}{5^{3}y}}{\bigg )}=\log _{4}(x^{2})-\log _{4}(5^{3}y)=\log _{4}(x^{2})-\log _{4}(5^{3})+\log _{4}(y)=2\log _{4}(x)-3\log _{4}(5)+\log _{4}(y)}
Example 2 (knowledge of exponentials needed):
log
9
(
1
5
3
)
=
log
9
(
1
5
1
3
)
=
log
9
(
5
−
1
3
)
=
−
1
3
log
9
5
{\displaystyle \log _{9}{\bigg (}{\frac {1}{\sqrt[{3}]{5}}}{\bigg )}=\log _{9}{\bigg (}{\frac {1}{5^{\frac {1}{3}}}}{\bigg )}=\log _{9}(5^{-{\frac {1}{3}}})=-{\frac {1}{3}}\log _{9}5}
Cancelling logarithms with exponentials and vice versa
edit
There are a few more rules you need to know:
log
a
a
x
=
x
{\displaystyle \log _{a}a^{x}=x}
a
log
a
x
=
x
{\displaystyle a^{\log _{a}x}=x}
log
a
b
=
log
n
a
log
n
b
{\displaystyle \log _{a}b={\frac {\log _{n}a}{\log _{n}b}}}
where
n
{\displaystyle n}
can be any number.
log
a
1
=
0
{\displaystyle \log _{a}1=0}
Note: If you're doing a complex algorithm with a computer, try to give your answer in terms of a base 2 logarithm, because whatever base you input, the computer will convert it to base 2. Doing this for the computer so that it doesn't need to convert it each time will make the algorithm run faster.
Balancing questions with these rules
edit
So when you have a normal equation, you can do rules like "multiply both sides by 2" or "add 3 to both sides". With logarithms and exponentials, you can do something similar.
You can now:
"Raise both sides as an exponential of a number"
l
o
g
3
x
=
5
→
3
l
o
g
3
x
=
3
5
→
x
=
3
5
{\displaystyle log_{3}x=5\rightarrow 3^{log_{3}x}=3^{5}\rightarrow x=3^{5}}
"Log both sides (with a common base)"
4
x
=
7
→
log
4
(
4
x
)
=
l
o
g
4
7
→
x
=
l
o
g
4
7
{\displaystyle 4^{x}=7\rightarrow \log _{4}(4^{x})=log_{4}7\rightarrow x=log_{4}7}
The mathematical constant
e
{\displaystyle e}
is often used with logarithms as it's known as the natural base for a logarithm.
e
=
2.71828182845904523536028747135266249775724709369995
…
{\displaystyle e=2.71828182845904523536028747135266249775724709369995\dots }
Certain short-hand notation has been developed for logarithms as follows:
log
e
(
x
)
=
ln
(
x
)
{\displaystyle \log _{e}(x)=\ln(x)}
log
2
(
x
)
=
{\displaystyle \log _{2}(x)=}
lb
(
x
)
{\displaystyle (x)}
log
10
(
x
)
=
log
(
x
)
{\displaystyle \log _{10}(x)=\log(x)}
For this scale of magnitude, we'll be using 10 as we work in base as humans.
log
10
1
=
0
{\displaystyle \log _{10}1=0}
log
10
10
=
1
{\displaystyle \log _{10}10=1}
log
10
100
=
2
{\displaystyle \log _{10}100=2}
log
10
1000
=
3
{\displaystyle \log _{10}1000=3}
log
10
10000
=
4
{\displaystyle \log _{10}10000=4}
Note: remember it's a logarithmic scale, this means that half way between 10 and 100 (55) doesn't produce a half way value (
log
10
55
≠
1.5
,
log
10
55
≈
1.74
{\displaystyle \log _{10}55\neq 1.5,\log _{10}55\approx 1.74}
).