# Why is $x^n\approx \left(n(x^{1/4096}-1)+1\right)^{4096}$?

There's an old-school pocket calculator trick to calculate $x^n$ on a pocket calculator, where both, $x$ and $n$ are real numbers. So, things like $\,0.751^{3.2131}$ can be calculated, which is awesome.

This provides endless possibilities, including calculating nth roots on a simple pocket calculator.

The trick goes like this:

1. Type $x$ in the calculator
2. Take the square root twelve times
3. Subtract one
4. Multiply by $n$
6. Raise the number to the 2nd power twelve times (press * and = key eleven times)

Example:

I want to calculate $\sqrt[3]{20}$ which is the same as $20^{1/3}$. So $x=20$ and $n=0.3333333$. After each of the six steps, the display on the calculator will look like this:

1. $\;\;\;20$
2. $\;\;\;1.0007315$
3. $\;\;\;0.0007315$
4. $\;\;\;0.0002438$
5. $\;\;\;1.0002438$
6. $\;\;\;2.7136203$

The actual answer is $20^{1/3}\approx2.7144176$. So, our trick worked to three significant figures. It's not perfect, because of the errors accumulated from the calculator's 8 digit limit, but it's good enough for most situations.

Question:

So the question is now, why does this trick work? More specifically, how do we prove that: $$x^n\approx \Big(n(x^{1/4096}-1)+1\Big)^{4096}$$

Note: $4096=2^{12}$.

I sat in front of a piece of paper trying to manipulate the expression in different ways, but got nowhere.

I also noticed that if we take the square root in step 1 more than twelve times, but on a better-precision calculator, and respectively square the number more than twelve times in the sixth step, then the result tends to the actual value we are trying to get, i.e.:

$$\lim_{a\to\infty}\Big(n(x^{1/2^a}-1)+1\Big)^{(2^a)}=x^n$$

This, of course doesn't mean that doing this more times is encouraged on a pocket calculator, because the error from the limited precision propagates with every operation. $a=12$ is found to be the optimal value for most calculations of this type i.e. the best possible answer taking all errors into consideration. Even though 12 is the optimal value on a pocket calculator, taking the limit with $a\to\infty$ can be useful in proving why this trick works, however I still can't of think a formal proof for this.

Thank you for your time :)

• Which one would you like to prove, the approximation for $a = 12$, or just the limit expression for $a \to \infty$? – Xiangxiang Xu Sep 7 '18 at 2:01
• In my opinion the one with the limit with $a\to\infty$ is better to prove because it is more general. From there, the specific case of $a=12$ can be simpler to prove (I think) – KKZiomek Sep 7 '18 at 2:04

A standard trick is to calculate the natural logarithm first to get the exponent under control:

$$\log(\lim_{a\to\infty}(n(x^{1/a}-1)+1)^a)=\lim_{a\to\infty}a\log(nx^{1/a}-n+1)$$ Set $u=1/a$. We get $$\lim_{u\to 0}\frac{\log (nx^u-n+1)}{u}$$ Use L'Hopital: $$\lim_{u\to 0}\frac{nx^u\log x}{nx^u-n+1}=n\log x=\log x^n$$ Here we just plugged in $u=0$ to calculate the limit!

So the original limit goes to $x^n$ as desired.

• I was confused first at L'Hopital step, but then I realized that I have to differentiate with respect to $u$ not $x$ :). I'm giving this answer the best even though all other answers were equally good, because if you haven't mentioned L'Hopital, I would never think of using it. Thank you for the answer. – KKZiomek Sep 7 '18 at 2:19
• Glad to help. It's a neat problem. – Cheerful Parsnip Sep 7 '18 at 2:24

For fixed $x > 0$ and $n$, let $t = 1/2^a \to 0$. Then we need to prove that $$\lim_{t \to 0} \left( n (x^t - 1) + 1 \right)^{1/t} = x^n.$$ In fact, we have $$\ln \left[\lim_{t \to 0} \left( n (x^t - 1) + 1 \right)^{1/t}\right] = \lim_{t \to 0} \frac{\ln (1 + n(x^t - 1))}{t} = \lim_{t \to 0} \frac{n(x^t - 1)}{t} = n\ln x,$$ where the first equality follows from the continuity of $\ln(x)$, and the second equality has used the fact that $\ln(1 + x) \sim x$ when $x \to 0$.

If $x$ (actually $\ln x$) is relatively small, then $x^{1/4096}=e^{(\ln x)/4096}\approx1+(\ln x)/4096$, in which case

$$n(x^{1/4096}-1)+1)\approx1+{n\ln x\over4096}$$

If $n$ is also relatively small, then

$$(n(x^{1/4096}-1)+1)^{4096}\approx\left(1+{n\ln x\over4096}\right)^{4096}\approx e^{n\ln x}=x^n$$

Remark: When I carried out the OP's procedure on a pocket calculator, I got the same approximation as the the OP, $2.7136203$, which is less than the exact value, $20^{1/3}=2.7144176\ldots$. Curiously, the exact value (according to Wolfram Alpha) for the approximating formula,

$$\left({1\over3}(20^{1/4096}-1)+1\right)^{4096}=2.7150785662\ldots$$

is more than the exact value. On the other hand, if you take the square root of $x=20$ eleven times instead of twelve -- i.e., if you use $2048$ instead of $4096$ -- the calculator gives $2.7152613$ while WA gives $2.715739784\ldots$, both of which are too large. Very curiously, if you average the two calculator results, you get

$${2.7136203+2.7152613\over2}=2.7144408$$

which is quite close to the true value!