If $x$ and $2^x$ are both rational then they are integers

My friend Aaron Brown asked me a question a while back:

Suppose $x > 0$ is some rational number, and that $2^x$ is also rational.
Does this mean that both of them must actually be integers?

Let’s see what happens if we proceed in a way similar to
showing that $\sqrt{2}$ is irrational.

Let

$\displaystyle x = \frac{m}{n}$ and $\displaystyle 2^x = \frac{k}{l}$

where $m, n, k, l$ are all positive integers.
Make sure to choose $k$ and $l$ so that $\displaystyle \frac{k}{l}$ is in lowest terms, meaning that $k$ and $l$ do not have any common positive integer divisors (other than the number $1$ if you want to count that).

Then

$\displaystyle 2^{\frac{m}{n}} = \frac{k}{l}$

and so by taking $n$-th powers,

$\displaystyle \left(2^{\frac{m}{n}}\right)^n = \left(\frac{k}{l}\right)^n$

This gives

$\displaystyle 2^m = \frac{k^n}{l^n}$

and so

$\displaystyle 2^m l^n = k^n$

Now using unique factorization into primes, write $k$ and $l$ as products of powers of distinct prime numbers:

$\displaystyle k = p_1^{a_1} p_2^{a_2} \cdots p_K^{a_K}$ and $\displaystyle l = q_1^{b_1} q_2^{b_2} \cdots q_L^{b_L}$

Substitute into $\displaystyle 2^m l^n = k^n$ and you get

$\displaystyle 2^m \left( q_1^{b_1} q_2^{b_2} \cdots q_L^{b_L} \right)^n = \left( p_1^{a_1} p_2^{a_2} \cdots p_K^{a_K} \right)^n$

and so

=== BEGIN THE GREEN EQUATION ======================

$\displaystyle 2^m q_1^{b_1 n} q_2^{b_2 n} \cdots q_L^{b_L n} = p_1^{a_1 n} p_2^{a_2 n} \cdots p_K^{a_K n}$

=== END THE GREEN EQUATION ========================

Crucial observations from the green equation:

1. The right side $\displaystyle p_1^{a_1 n} p_2^{a_2 n} \cdots p_K^{a_K n}$ is a prime factorization of $k^n$.
2. No prime $p_i$ is the same as a prime $q_j$, because the fraction $\displaystyle \frac{k}{l}$ is in lowest terms. Otherwise there would be a common prime factor of $k$ and $l$ …
3. The equality of the left and right sides shows that the prime $2$ divides (is a factor of) the right side, and so is one of the primes appearing in the prime factorization of the right side.
4. (From #3 and unqiue factorization into primes)
Exactly one of the $p_i$ equals $2$.
5. (From #2 and #4)
None of the $q_j$ equals $2$.
Thus the left side is also a unique prime factorization (of the same number as the right side).
6. (From #4 and unqiue factorization into primes)
The exponent of $2 = p_i$ in the prime factorization of the right side $\displaystyle p_1^{a_1 n} p_2^{a_2 n} \cdots p_K^{a_K n}$ equals $a_i n$.
7. (From #5 and unqiue factorization into primes)
The exponent of $2$ in the prime factorization of the left side $\displaystyle 2^m q_1^{b_1 n} q_2^{b_2 n} \cdots q_L^{b_L n}$ equals $m$.
8. Again by unique prime factorization, the exponent of the prime $2$ must be the same on the left and the right sides.
9. (From #6, #7, and #8)
Conclusion: if $p_i = 2$, then $a_i n = m$.

We’re done.
From $a_i n = m$ we deduce $\displaystyle a_i = \frac{m}{n} = x$ is an integer, and $\displaystyle 2^x$ must also be.