Obviously x=y is a solution.
x = -y is not a solution even if x is an even integer.
Because for x even x^(-x) = 1/ x^x, but (-x)^x = x^x which are not the same.
Here is how to find all positive solutions to the equation x^y=y^x. Take the xy-th root of both sides and you would get:
x^(1/x) = y^(1/y)
Now define the function f(x) = x^(1/x). We have f(x) = f(y).
f(x) = exp(Lnx/x) and we can evaluate its derivative: f ’ (x) = exp(Lnx/x) * ( (1 – Lnx) /x^2). Which means if x < e then f(x) is increasing and if x > e then f(x) is decreasing.
Now, lets look at f(x)=f(y) because f is increasing for x < e and decreasing for x > e both of x and y cannot be larger than e. Both cannot be less than e either. So one is less than e and the other is larger than e.
How does the graph of x^(1/x) look like? As we saw above it takes its maximum at x=e. As x approaches zero, f(x) approaches zero. Because x^(1/x) for small numbers x is less than x and x approaches zero.
As x goes to infinity x^(1/x) approaches 1. Because
Lim Ln( x^(1/x) ) = Lim (Ln x / x) which by L’Hospital’s rule is equal to Lim 1/x which is zero as x approaches infinity.
So Lim x^(1/x) is exp (0) =1.
So the graph of x^(1/x) has a horizontal asymptote y=1. It is increasing from zero to e and decreases from e to infinity. Therefore (other than x=y which is an obvious solution), for any x such that 1 < x < e there is a unique number y > e such that x^y = y^x. And these are all solutions of this equation.
If you are only looking at integer solutions then since either x or y should be less than e, we should have one of them is 1 or 2 which means:
1^y = y^1 and hence y=1
2^y = y^2 and you can easily see y =2 or y=4. (Remember we already know that for any 1 < x <e there is exactly one y > e such that x^y = y^x.)