Find integral solution of $a^{b} - b^{a} = 3$ Find the integral solution of $$a^b -  b^a = 3$$
I am a student of class 10 and got this question in a maths competetive exam.
I have tried converting into a log equation in one variable, or solve it by using parity but couldn't solve it.
Thanks in advance
 A: I suppose you are familiar with the inequality $\ln(1+x)\le x$. Now if $b>a$, then $$b^a=a^a\left(1+\frac{b-a} a\right)^a=a^a e^{a\ln(1+(b-a)/a)}\le a^a e^{b-a}.$$
When $a\ge 3$, we have
$$3=a^b-b^a\ge a^a(a^{b-a}-e^{b-a})\ge a^a(a-e)\ge27(3-e)>7$$
a contradiction. So $a\le2$ if $b>a$. But it can be checked that there is no solution for $a=1$ (obvious) and $a=2$ (since $2^b-b^2>3$ for $b\ge 5$). We conclude that there is no solution satisfying $b>a$. But $b\neq a$, so the only possibility is that $b<a$.  
However, for $3\le b<a$, it's well-known that $a^b<b^a$. So it's only possible when $b\le 2$. For $b=1$ the solution is $(a,b)=(4,1)$. For $b=2$, due to the same reason above($a^2-2^a<-3$ for $a\ge 5$), there is no solution.  
To conclude, the only solution is $(a,b)=(4,1)$.
A: Consider the equation in modulo $3$, clearly we have
$$
a^b\equiv b^a\pmod3
$$
Clearly $a=b=1$ is a solution of this equation. However this does not solve the original. We note that $4\equiv 1 \pmod 3\ $ and conclude that $a=4, b=1$. This a positive integer solution to your equation.
A: $a,b$ are of opposite parity,
If $b$ is odd, and $b>1$ we further have $b>a$. Then in the equation $a^b = b^a+3$ has LHS equal to $0$ modulo $8$, while RHS is $4$ modulo $8$.
If $a \ge 3$ is odd, then  in the above equation, LHS and RHS will be $1, 3$ resp. modulo $8$.
The only remaining case is $b=1$, which gives $a=4$.
Hence the only solution is $(4,1)$.
