Logarithms are way for us to rewrite exponents. If we have the equation $2^5=32$ we can rewrite this as $\log_232=5$ using logarithms. Similarly, $x^y=z$ can be rewritten as $\log_xz=y$. Hopefully you can see the pattern here. With exponentials, we input a base and an exponent and get a result. With logarithms, we input a base and the result and get the exponent. Logarithms can thus be said to the "opposite" of exponents. If I have the logarithm $\log_{10}100=x$, I like to think of this as: "What number $x$ do I have to raise $10$ to in order to get $100$?". In this case the answer is $2$ so the $\log_{10}100=2$. Similarly, $\log_ba$ is the value that we have to raise $b$ to in order to get $a$. We can write this mathematically as $b^{\log_ba}=a$.
In $\log_ba$ we call $b$ the base and $a$ the argument of the logarithm. The logarithm is a type of function, that outputs a different value depending on the base and the argument.
a) $\log_39$ is the number we have to raise $3$ to in order to get $9$. Since $3^2=9$, we have that $\log_39=2$.
b) By definition, $2^{\log_2{\frac{1}{4}}}=\frac{1}{4}$. Now $\frac{1}{4} =$$ \frac{1}{2^2}= $$ 2^{-2}$, so we have $2^{\log_2{\frac{1}{4}}}=2^{-2}$. Therefore $\log_2{\frac{1}{4}}=-2$. (The methods used in part a) and b) are slightly different, but we're really doing the same thing.)
There are some special cases that are good to know for calculating logarithms. The first is the value of $\log_bb$. By definition $\log_bb$ is the number that satisfies $b^{\log_bb}=b$. The only value that satisfies this is $1$, so $\log_bb=1$ for any $b$. (Unless $b$ equals $0$ or $1$, in which case there are infinitely many solutions. For this reason, base $0$ and $1$ are never used. For the rest of the lesson, we assume that $b\neq0$ and $b\neq1$.) The next property is the value of $\log_b1$. Since $b^{\log_b1}=1=b^0$ we have $\log_b1=0$.
These two properties, $\log_bb=1$ and $\log_b1=0$, are special cases of the general property $\log_b{b^x}=x$. We can think of the value of $\log_b{b^x}$ as: "What number do I need to raise $b$ to in order to get $b^x$?'' Obviously, the answer is $x$, so $\log_b{b^x}=x$.
From this we see that the logarithm $\log_bx$ is actually the inverse of the exponential $b^x$. This is because if we put $b^x$ as the argument of the logarithm we get back $x$.
Another thing that is good to know is that logarithms with negative bases or arguments are almost always undefined. For example, what is the value $\log_{10}({-10})$? It's the value that satisfies $10^{\log_{10}({-10})}=-10$. However, ten to the power of something will never be a negative number. We can get close to zero by taking for example $10^{-100}=\frac{1}{10^{100}}$, but we'll never reach or go below zero. Therefore $\log_{10}(-10)$ is undefined (unless we allow complex numbers, but we aren't able to handle them yet). It is similar for negative bases. For example, what is the value of $\log_{-4}{5}$? It's the value that satisfies $({-4})^{\log_{-4}{5}}=5$. Although $(-4)^x$ can be a positive number (as in $(-4)^2=16$), it can never be $5$. This is because as soon as the exponent $x$ is not a whole number, then $(-4)^x$ is undefined, and by trial and error there are no whole numbers that satisfy $(-4)^x=5$. Since there are no solutions to $(-4)^x=5$, then $\log_{-4}{5}$ must be undefined.
Some logarithms with negative bases are actually defined. For example, $\log_{-4}16=2$ and $\log_{-2}(-8)=3$. However, it only works in very specific cases. This is not very useful, so in this lesson we will mostly look at logarithms with positive bases and arguments.
Even though the base and the argument must always be positive, the result of a logarithm can still be negative. For example, $\log_{5}{\frac{1}{125}}=-3$ and $\log_{\frac{1}{2}}{2}=-1$.