It's not too difficult to figure out that $x$ and $y$ can both be 1, and also $x$ can be 2 and $y$ can be 4 (and vice versa). But I can't rule out if there are other solutions. Does it have anything to do with inverse functions? Is there a way to see the solutions by graphing, or algebraically?

  • 1
    $\begingroup$ Are $x$ and $y$ integers or not? $\endgroup$ – pointer May 13 '14 at 22:06
  • $\begingroup$ @user121270 The question doesn't say, but I would say that probably $x$ and $y$ do not have to be integers. $\endgroup$ – yroc May 13 '14 at 22:09
  • $\begingroup$ Negatives would also be another case to consider here. $\endgroup$ – JB King May 5 '15 at 22:10

Here's a good way to look at this: $$ x^y = y^x \implies \\ y \ln x = x \ln y \implies\\ \frac{\ln x}x = \frac{\ln y}y $$ So one way of solving this is looking at the graph of $y = \frac{\ln x}{x}$ and seeing where it hits a particular value twice.

However, I'm going to go a step further. I will say that I want my solution $(x,y)$ of $x^y = y^x$ to be of the form $(x,ax)$ so that $y = ax$ for some value $a$. Furthermore, I'll assume that $x \neq y$ so that $a \neq 1$ (of course, $x = y$ is always a solution if $x^x$ is defined). With that, we have $$ \frac{\ln x}x = \frac{\ln (ax)}{ax} \implies (\text{assume } x\neq 0)\\ \ln x = \frac{\ln (ax)}{a} \implies\\ \ln x = \frac{\ln (a)}{a} + \frac{\ln x}{a} \implies\\ \frac{a-1}{a}\ln x = \frac {\ln(a)}{a} \implies (\text{we assumed }a \neq 1)\\ \ln x = \frac{\ln(a)}{a-1} \implies\\ x = a^{\frac{1}{a-1}} $$ So, for any value $a \neq 1$, the pair $x = a^{1/(a-1)},$ $y = a \cdot a^{1/(a-1)} = a^{a/(a-1)}$ will give you a solution to the original equation.

For example, plugging in $a = 2$ gives you $x=2$ and $y = 4$. Try some other values.

  • $\begingroup$ Hm, parametrics, didn't think of that one! $\endgroup$ – Simply Beautiful Art Dec 19 '16 at 1:32
  • $\begingroup$ Hehehe, since you did parametrics, I did polar. ;D $\endgroup$ – Simply Beautiful Art Dec 22 '16 at 13:55
  • 2
    $\begingroup$ I should mention that the solution I gave is one I had seen here a long while back. Even used the same letter $a$. $\endgroup$ – Ben Grossmann Apr 25 '17 at 12:21
  • $\begingroup$ @Omnomnomnom There exists a question in your solution. When you let $y=ax$, you have assumed that $y$ is a linear function with respect of $x$. But how you know this? Why the function, or the relation between $y$ and $x$ can't be of another case? $\endgroup$ – mengdie1982 Jun 7 '18 at 3:31
  • $\begingroup$ @mengdie1982 It's been a while since you asked, but here's an answer. I am not assuming that "$y$ is a linear function with respect of $x$"; indeed, the relation $y = ax$ that I use here is not linear since $a$ depends on $x$ (and/or on $y$, depending on your perspective). The more accurate way to describe what I've done is to say that I've made a "change of variables". That is, instead of describing the curve as a relation on $x,y$, I'm describing it as a relation on $a,b$ where $$ \begin{cases} a = y/x,\\ b = x. \end{cases} $$ This is similar to changing to polar coordinates. $\endgroup$ – Ben Grossmann May 27 '20 at 16:38

There is an explicit solution to this equation given by $$y = -\dfrac{x \operatorname{W}\left(-\dfrac{\log(x)}{x}\right)}{\log(x)}$$

where $\operatorname{W}(x)$ is the Lambert W-function.

Consider: $$x^y = y^x$$

Take the logarithm of both sides

$$y\log(x) = x\log(y)$$

$$\dfrac{y\log(x)}{x} = \log(y)$$

Multiply by $-1$ and exponentiate

$$\exp\left(-\dfrac{y\log(x)}{x}\right) = \dfrac{1}{y}$$

Multiply each side by $-\dfrac{y\log(x)}{x}.$

$$-\dfrac{y\log(x)}{x}\exp\left(-\dfrac{y\log(x)}{x}\right) = -\dfrac{\log(x)}{x}$$

Solve using the properties of the $\operatorname{W}$ function.

$$-xy\log(x) = \operatorname{W}\left(-\dfrac{\log(x)}{x}\right)$$

$$y = -\dfrac{x \operatorname{W}\left(-\dfrac{\log(x)}{x}\right)}{\log(x)}$$

  • 1
    $\begingroup$ Wow good answer but a little beyond high school level$\ldots$ Is there a way by graphing? $\endgroup$ – yroc May 13 '14 at 22:16
  • $\begingroup$ Are you looking for solutions by way of a graphing calculator? $\endgroup$ – Brad May 13 '14 at 22:27
  • 1
    $\begingroup$ An iterative method comes to mind quicker than anything that has to do with graphing. The best way to find solutions graphically is to pick a value of $y$ that you want a solution for and then plot $x^y - y^x$ looking for when the graph hits the $x$-axis. There is no way (that I know of) to graphically find all of the solutions at once on a Ti-84. $\endgroup$ – Brad May 13 '14 at 22:40
  • 1
    $\begingroup$ I feel like saying the W Lambert function solves it is almost a tautology. I've never been satisfied with such solutions. It's almost like saying "the solution is the solution!" from my perspective. $\endgroup$ – Cameron Williams May 13 '14 at 23:03
  • 1
    $\begingroup$ @CameronWilliams If your area of expertise led you to use and understand the Lambert W-function regularly, you would probably be quite satisfied with it. Same goes for much of mathematics: if you're an algebraist, then a topological solution to your problem will probably feel unsatisfactory, whereas if you're a topologist it's great. $\endgroup$ – zibadawa timmy Jul 4 '15 at 2:25

If we convert everything to polar form, we end up with


Take the $r$th root of both sides and you'll get





which is the curve you are interested in. A graph may be found here.

Plugging in $\theta=\arctan(0.5)$ will yield the rectangular coordinate $(4,2)$.


For finding solutions by graphing, take the logarithm of both sides of the equation to get $y\cdot\log(x)=x\cdot\log(y)$. Assuming $x$ and $y$ are not zero, divide by them and get $\frac{\log(x)}{x}=\frac{\log(y)}{y}$ and consider the map $f:(0,\infty)\rightarrow \mathbb{R}, x\mapsto \frac{\log(x)}{x}$. Now your question is equivalent to finding values $x,y$ with $f(x)=f(y)$.



Algebra says that after taking $\ln$ both sides,

$$y\ln(x) =x\ln(y) $$

This implies $\ln(x) /x=\ln(y) /y$

What can you say about the function $x\to \ln(x)/x $?

  • $\begingroup$ Well, $x\rightarrow\ln(x)$ is the inverse of $x\rightarrow e^x$, right? $\endgroup$ – yroc May 13 '14 at 22:18
  • $\begingroup$ @yroc typo on my part, updated $\endgroup$ – Gabriel Romon May 13 '14 at 22:37
  • $\begingroup$ OK, thanks. Now your suggestion makes sense and is similar to others' suggestions. $\endgroup$ – yroc May 13 '14 at 23:28
  • $\begingroup$ I don't quite understand this answer, could you elaborate? $\endgroup$ – Simply Beautiful Art Dec 22 '16 at 13:43

all numbers of the form $x^{1/(x-1)}$, $x>1$ satisfy this.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.