Verify my induction proof for Balanced Ternary expressions

476 Views Asked by At

In first place I apologize if you find a grammatical error, my English is not too good for now, but I'm work on it. That also goes for errors in my question (this is my first post).

I encounter the following problem on internet:

Use induction to proof that all integer can be written in the form $$\sum_{i} \pm3^i$$ where the exponents $i$ are distinct non-negative integers.

My proof goes like that:

let $P(k):=$ any integer in the interval $[-\sum_{i=0}^k 3^i, \sum_{i=0}^k 3^i]$ can be written as following $\sum_{i=0}^k a_i3^i$ (as a ternary balanced expression) where $a_i\in\{-1,0,1\}$

$$\text{Proof by induction}$$

If $k=0$ then for $P(k)$ we have the following interval [-1,1] and we can write $-1$ as $-1(3^0)$, $0$ as $0(3^0)$, $1$ as $1(3^0)$

For now let assume that $P(k)$ holds. So for $P(k+1)$ we have the interval $[-\sum_{i=0}^{k+1} 3^i, \sum_{i=0}^{k+1} 3^i]$

How we are assuming that we can write any integer using the expression above in the range of $[-\frac{3^{k+1}-1}{2}, \frac{3^{k+1}-1}{2}]$ we only have to show that for any integer in the following intervals, the proposition holds:

(1) $\frac{3^{k+1}-1}{2}<n\le\frac{3^{(k+1)+1}-1}{2}$

(2) $-\frac{3^{(k+1)+1}-1}{2}<n\le-\frac{3^{k+1}-1}{2}$

But that is quite easy, because if you have $3^{k+1}$ we only have to subtract one number from $0$ to $\frac{3^{k+1}-1}{2}-1$ or add one number from $1$ to $\frac{3^{k+1}-1}{2}$, the same goes for $-3^{k+1}$ but using the range $[0, \frac{3^{k+1}-1}{2}]$ for subtraction, and the range $[1, \frac{3^{k+1}-1}{2}-1]$ for addition. So a number in those ranges fits well into our induction hypothesis, in the end we are going to have a ternary balanced expression. QED