Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

up vote 3 down vote accepted

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.$$

share|improve this answer

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.

share|improve this answer

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,

share|improve this answer
    
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.