## Log-Log Transformations of Power Functions

Scientists and others who work with data are generally familiar with the concept of re-plotting data on logarithmic scales, or plotting the log of x vs. the log of y, as a way of transforming the regression from a curve to a straight line. I recently realized that I had become hazy on the mathematical basis for this operation, and had forgotten some of the key properties of logarithms and exponents that allow you to move back and forth between the raw data and the log transform and relate the slope of the line on the log-log plot to the properties of the original curved function. I eventually learned what I needed but I had trouble finding a clear and succinct explanation on the Internet so I offer this one for anyone in a similar situation (and for myself next time I need a reminder).

First off, you might want to be sure you are clear on the difference between exponential and power functions, which is explained here.

#### {1}   log(xc) = c*log(x)

This is a fundamental property of logs that is best memorized.

NB: I am using the convention that "log" with no subscript means log10 while "ln" means natural log (loge)

Now lets look at an example to see exactly how that plays out. The plot below is for a simple power function:

#### y = f(x) = xc

where c = 2.5 and x is the set of whole numbers from 1 to 30. Obviously it is curved and would be a logical candidate for a log-log transformation. So here is what happens if we take the log of both sides (using equation {1}):

#### log(y) = log(xc) = c * log(x)

In other words if we make the independent variable the log of x and the dependent variable the log of y, which happens to be 2.5*log(x), the dependent variable will be a simple multiple of the independent variable, which is the definition of a straight line. Our exponent, c (2.5), becomes the slope of a line on a log-log plot. Here is what it looks like: You can check pretty easily that the slope of this line is 2.5; for example note that line goes through (0,0) and (1,2.5). And you can see from the mathematical relationship in {1} that any power function would behave the same way; that is, it does not matter whether the power is 2, -2, 3 or 100. That exponent will always become the slope of the line.

#### 2. More complex power functions and non-zero intercepts

You might wonder about a more complex power function, such as:

#### y = f(x) = axc

And you might be wondering whether the straight line we get on the log-log plot always has an intercept of zero. Well these two questions are closely related. If our power function has a coefficient a, what happens when we take the logarithm? We get the term:

#### log(a*xc)

To deal with this requires our second property of logarithms that you may or may not remember from High School:

#### {2}   log(a*b) = log(a) + log(b)

Using {2} on our power function gives us:

#### log(a*xc) = log(a) + log(xc) = log(a) + c * log(x)

You can probably see that when we treat this as the equation for a straight line, log(a) becomes the vertical intercept while c is still the slope. Here is an example where a = 10 and c = 1.5: And here is what it looks like when transformed to log-log. Note that the y-intercept is 1, which is the base 10 log of 10. The slope is of course 1.5. #### 3. Finding the raw function from the log-transformed parameters.

This is actually the problem that got me started reviewing all this stuff. I was looking at a log-log plot in a book on power laws and fractals that simply told me the value of the slope of the line on the log-log plot and I was unsure how to back out the original, untransformed, equation. Just as if you were just given the preceding plot and told that the slope was 1.5. Now from the foregoing discussion you would already know that this meant the original equation was of the form x1.5 but how would you actually show that algebraically? Here is how:

i. Start with an equation from a plot such as the preceding:

#### log(y) = b + c * log(x)

where b is the intercept on the vertical axis and c is the slope of a line on a logx vs logy plot.

ii. You can assume that b is the log of something--just raise it to the power of 10 to find out what. For example, if b = 1, 101 = 10. If b = 0, 100 = 1

now we have:

#### log(y) = log(a) + c * log(x)

iii. Write both sides of the equation as powers of 10 (or e if you are using natural logs):

#### 10log(y) = 10log(a) + c*log(x)

The one property of logarithms that even I usually remember is:

so:

#### y = 10log(a) + c*log(x)

and one of the most basic laws of exponents is:

so:

#### y = 10log(a) * 10c*log(x)

now we can use {3} again to simplify the first coefficient:

#### y = a * 10c*log(x)

iv. For the last step we need one more rule of exponents, and this is one I had forgotten:

this gives us:

#### y = a * (10log(x))c

and we can use {4} again to reduce the part in parentheses to x:

#### y = a * xc

This is where we were trying to get, back to our original power function (which we were pretending we did not already know). Hopefully this is a clear enough explanation of the very fundamental aspects of power functions and log transformations. As elementary as this is, it is a critical stepping stone to more interesting applications of power functions and log transformations in fractal geometry, statistics, emergence theory, etc.

Home  |  Contact  |  Search  |  MTB  |  Family  |  Mini Cooper  |  Science Notes  |