# Solving equality to find upper limit

I need to find a sensible upper limit for a part of an algorithm in a program I am writing. I have boiled it down to this.

Given $a$, $b$ and $c$, find $x$ in $a^{x-1}b < c < a^{x}b$.

But I have no idea how to approach it.

-

Divide by b and then take log base a of both sides to get $$x-1 < \log_a (c/b) < x.$$ So, if you want an upper bound for $x$, I guess you use the left inequality to get $$x < \log_a(c/b) + 1.$$

-

Assuming $a$, $b$, and $c$ are positive throughout:

Dividing through by $b$, you get $$a^{x-1} \lt \frac{c}{b}\lt a^x.$$

Taking logarithms, we get $$(x-1)\ln(a) \lt \ln(c)-\ln(b) \lt x\ln(a)$$ If $a\gt 1$, then dividing through by $\ln (a)$ gives $$x-1 \lt \frac{\ln c-\ln b}{\ln a} \lt x$$ and any value of $x$ that satisfies this condition will satisfy your inequality.

In particular, $\displaystyle x \lt \frac{\ln c + \ln a - \ln b}{\ln a}$ (though not all values of $x$ that satisfy this inequality will satisfy both inequalities you have).

If $0\lt a\lt 1$, then $\ln(a)\lt 0$, so instead you would need $$x-1 \gt \frac{\ln c-\ln b}{\ln a}\gt x$$ which is impossible; so there are no solutions in this case.

(If $a=1$, then your inequalities become $b\lt c\lt b$, which are impossible to achieve.)

In summary: if $a\gt 1$, then any $x$ that satisfies $$x-1 \lt \frac{\ln c-\ln b}{\ln a}\lt x$$ works; if $0\lt a\leq 1$, then there is no solution.

-

Use logarithms. I assume $b,c>0$ and $a> 1$. (The conditions $b,c<0$ and $0<a<1$ also have a solution, but multiplying by $-1$ and $(1/a)^x$ makes it the same as the previous case)

Then the right inequality becomes $$\log c< x\log a + \log b$$ and hence $$\frac{\log c-\log b}{\log a}<x.$$ The left hand inequality is $$(x-1)\log a+\log b<\log c$$ and hence $$x<\frac{\log c-\log b}{\log a}+1.$$ Thus you have the inequalities $$\frac{\log c-\log b}{\log a}<x<\frac{\log c-\log b}{\log a}+1.$$

Hope that helps,

-
Ok,it is fixed. – Eric Naslund Apr 7 '11 at 19:01

Take $\ln$ of each term: $(x-1)\ln a+\ln b<\ln c<x\ln a +\ln b$. Of course, assuming everything is positive.

-