# Log-log plots

#### Prerequisite

When we have a data set or a complicated function, it is sometimes useful to approximate it by a simple power law. One way to do this is to use a log-log plot. Instead of just plotting the variables themselves, we plot the logarithm of the variables. Let's see how this works.

Suppose we have a power law function $y = x^N$. If we plot this, we get the curves shown in the figure at the left below for values of N from 1 to 4. The higher the power we have, the faster the function rises (and the odd powers are negative for negative values of $x$.)

But if we take the logarithm of both sides of that equation, $y = x^N$, ^{,}we get

$$log(y) = N log(x)$$.

If we now take as new variables $Y = log(y)$ and $X = log(x)$, then our new equation is just $Y = NX$. This is the graph of a straight line with the slope is just being the power that $x$ was raised to. If we plot $X$ vs $Y$, we get the figures at the right below. In the log plot, all the power laws are straight lines with increasing slope as the powers get larger.

So if we have some complicated function that can be modeled by a power law, we can easily see that this is the case by plotting the logarithms of the variables. If we get a straight line a power law works. (We have only plotted positive values of $x$ and $y$ in the log-log plot since the log of a negative number is not a real number.)

Note that this works for negative powers too. Here's what the linear and log-log plots look like for these. The plot of $x$ vs $y$ is on the left and $X$ vs $Y$ on the right.

Joe Redish 11/15/11

Last Modified: August 23, 2018