I’m trying to understand how to linearize functions using logs and I can’t quite wrap my head around this.
Let’s say we have two functions:
p(x) = x^2
q(x) = x(i-1)*1.5 (for x >= 1, q(1) = 1)
p:
p(1) = 1
p(2) = 4
p(3) = 9
…
Linearize p (if you graph the coordinates below, you get a straight line):
log(1), log(1)
log(2), log(4)
log(3), log(9)
q:
q(1) = 1
q(2) = 1.5
q(3) = 2.25
…
Linearize q:
1, log(1)
2, log(2)
3, log(3)
To linearize p, we have to take the log of both x, and p to make the function linear.
To linearize q, we have to take the log of just q to make the function linear.
What is the rule for this, or how can I think through this to determine how to linearize a function without trial and error?
Best Answer
The way you've written $q(x)$ doesn't make sense because in addition to $x$ there's a free variable $i$ that you didn't introduce. I think you probably mean $q(x)=q(x-1)\cdot1.5\text{ with } q(1)=1$, which is a recurrence relation for $q$ that can be solved in the closed form $q(x)=1.5^{x-1}$.
If so, you have two functions, $p(x)=x^2$ and $q(x)=1.5^{x-1}$. Note that in one the independent variable $x$ is in the base and in the other it's in the exponent. Taking the logarithms of both functions yields $\log p(x)=2\log x$ and $\log q(x)=(x-1)\log1.5$. The first is a linear relationship between $\log p(x)$ and $\log x$, the second a linear relationship between $\log q(x)$ and $x$. That's why in the one case you need to plot $\log x$ and in the other $x$.