Finding solution in naturals to $a^b=b^a$ with the help of $f(x)=\frac{\ln(x)}{x}$ As the title said, 
I'm trying to find solution in naturals numbers to $a^b=b^a$ with the help of the function 
$f(x)=\large\frac{\ln(x)}{x}$.
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!
 A: 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. 
=-=-=-=-=-=-=-=-=-=-=-=-=-=

=-=-=-=-=-=-=-=-=-=-=-=-=-=
A: 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}
$$
A: 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$.
A: 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$.
