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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As the title said,

I'm trying to find solution in naturals numbers to $a^b=b^a$ with the help of the function


I've been reading some solutions of that problem posted in math forums, and still don't know how to deduce, the obvious solutions, $(2,4)$ and $(4,2).$

Thank you very much!

share|cite|improve this question
up vote 4 down vote accepted

The missing ingredient in the answers so far is this interpretation: carefully fraw the curve $y = \log x.$ Your $f(a)$ is the slope of the line between the origin $(0,0)$ and the point on the graph $(a, \log a).$ Then, if $f(a) = f(b)$ for any real numbers $a,b,$ this means the slopes are the same, hence there is a straight line going through the points $(0,0),(a, \log a),(b, \log b). $

If you look a little more carefully, you see that the line through the origin with slope $1/e$ is tangent to the curve at $(e,1),$ which uses calculus. The slope (positive) of any line that intersects the curve twice is $0 < m < 1/e. $ Finally, given the two intersections $(a, \log a),(b, \log b) $ with $a < b,$ we find that $$ 1 < a < e. $$ Since you wanted $a$ to be an integer, it follows that $a=2.$

Please draw the graph and some lines through the origin. It becomes quite easy to see, with a careful graph, that the smaller one (real number $a$) satisfies $1 < a < e.$ I ran out of energy. In the image below, the graph in black is $y = \log x,$ the green line is the tangent to the graph that goes through the origin and the point $(e,1),$ and the blue line goes through the origin and $(2, \log 2)$ and $(4,\log 4).$ If you think about it, $\log 4$ is exactly double $\log 2,$ so we are looking at some similar triangles. I do not remember whether there are any other rational solutions to this.


enter image description here


share|cite|improve this answer
+1 Very nicely put! – amWhy Mar 9 '13 at 0:33

Knowing that when $x > 0,\;\; x^y = e^{\large \ln x^y}= e^{y \ln x}$,

we have, since $a, b \in \mathbb{N}:$ $$a^b = b^a \iff e^{b\ln a} = e^{a \ln b} \iff b \ln a = a\ln b$$

Now try dividing each side of the equation by $\;ab$.

share|cite|improve this answer
Your answer is more helpful than mine, +1. – 1015 Mar 8 '13 at 20:50
After dividing: $f(a)=f(b)$, and now what? hmm... – 17SI.34SA Mar 8 '13 at 21:02
@amWhy, could you please elaborate more? Clearly I'm missing were something :( – 17SI.34SA Mar 8 '13 at 21:23
$f(a) = f(b) \implies a = b \;\;(a, b \geq 1),\;$ or $\;a = 2, b = 4\;$ or $\;a = 4, b = 2$ – amWhy Mar 8 '13 at 21:26
See Wolfram for a graph of $(\ln x)/x$ for x>1. You'll see that the only positive INTEGER values $a\neq b$ for which $f(a) = f(b)$ are $(2, 4), (4, 2).$ – amWhy Mar 8 '13 at 21:34

Note that $$ f'(x)=\frac{\mathrm{d}}{\mathrm{d}x}\frac{\log(x)}{x}=\frac{1-\log(x)}{x^2}\tag{1} $$ Suppose that $a\lt b$ and $a^b=b^a$. Taking $\log$ and dividing by $ab$ yields $$ \frac{\log(a)}{a}=\frac{\log(b)}{b}\tag{2} $$ $(1)$, $(2)$, and Rolle's Theorem say that there must be an $x$ between $a$ and $b$ so that $$ f'(x)=\frac{1-\log(x)}{x^2}=0\tag{3} $$ $(3)$ is satisfied if and only if $x=e$. Therefore, if $a\lt b$, then $$ a^b=b^a\Rightarrow a\lt e\lt b\tag{4} $$ Thus, there are two options for $a\in\mathbb{Z}$, $1$ and $2$. Since $1^b=b^1\Rightarrow b=1$, the only solution with $a<b$ must have $a=2$. Since $$ \frac{\log(2)}{2}=\frac{2\log(2)}{2\cdot2}=\frac{\log(4)}{4}\tag{5} $$ we must have $b=4$. Any other solution, $x$, of $\frac{\log(2)}{2}=\frac{\log(4)}{4}=\frac{\log(x)}{x}$ must have $e$ between $2$ and $x$ and $e$ between $x$ and $4$. Both cannot be true simultaneously for any $x$.

The only solution is therefore $$ 2^4=4^2\tag{6} $$

share|cite|improve this answer

We write the factor prime decompsition of $a$ and $b$ : $$a=p_1^{\alpha_1}p_2^{\alpha_2}\cdots p_r^{\alpha_r}\quad\text{and}\quad b=p_1^{\beta_1}p_2^{\beta_2}\cdots p_r^{\beta_r},$$ with $0\leq \alpha_i$ and $0\leq \beta_i$. The relation $a^b=b^a$ gives: $$\forall i\in\{1,2,\ldots,r\}, \alpha_ib=\beta_ia.$$ If we suppose $a\leq b$, then we have: $$\forall i\in\{1,2,\ldots,r\}, \alpha_ib\leq\beta_ia$$ so $a|b$.

Let $m$ defined by $b=ma$, then $a$ solve the equation: $$a^{m-1}=m.$$ Let's search the solutions of this equation.

We note that if $a\geq 2$ and $m>2$, then $a^{m-1}\geq 2^{m-1}>m$.

If $a\geq2$ is solution then $m\leq 2$, we find $a=2$ and $m=2$, $a\geq2$ and $m=1$ as solutions.

Finally the solutions are $(a,b)=(2,4)$ or $(a,b)=(4,2)$ or $a=b$.

share|cite|improve this answer

Your Answer


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.