Largest set in which $(x, y)\mapsto \sqrt{xe^y - ye^x}$ is defined I have to find the biggest $\mathbb{R}^2$ subset in which the function 
$g(x,y) = \sqrt{xe^y - ye^x}$
is defined. In order to do it I have to study 
$xe^y - ye^x \ge 0$
but I can't find out a solution. Can someone help me? 
 A: $$g^2(x,y)=G(x,y)=xe^y-ye^x$$ is clearly well defined when $$G(x,y)=xe^y-ye^x=0$$ which is a curve formed by the union of all the diagonal of $\mathbb R^2$ (i.e. $x=y$) and the set 0f $(x,y)$ such that $x\ne y$ satisfying the relation $$\frac xy=\frac{e^x}{e^y}$$ This second set, looking at the plot of the curve is a kind of positive branch of a hyperbola of equation $xy=a\gt0$ (but obviously not properly a hyperbola). Furthermore, it is important remark that the double point where the diagonal cuts this branch is $(x,y)=(1,1)$ which is easily calculated from
$G(x,y)=G_x(x,y)=G_y(x,y)=0$.
Now, the second quadrant is totally excluded (we excludes coordinates axis of the discussion) because
$$ x\lt0\text{ and }y\gt0\Rightarrow G(x,y)=-|x|e^{|y|}-\ |y|e^{-|x|}\lt0$$ and the fourth quadrant is totally included because of 
$$x\gt0\text{ and }y\lt0\Rightarrow G(x,y)=|x|e^{-|y|}+\ |y|e^{|x|}\gt0$$
Now we have for the third quadrant where $x$ and $y$ are negative
$$|x|\gt|y|\Rightarrow -|x|e^{-|y|}+|y|e^{-|x|}=\frac{|y|e^{|y|}-|x|e^{|x|}}{e^{|x|+|y|}}\lt0$$
$$|x|\lt |y|\Rightarrow-|x|e^{-|y|}+|y|e^{-|x|}=\frac{|y|e^{|y|}-|x|e^{|x|}}{e^{|x|+|y|}}\gt0$$
With the first quadrant, where $x$ and $y$ are positive,  the discussion is less easy and we must consider the curve $G(x,y)=0$  and its double point $(1,1)$.
From the graph of the curve $G (x, y) = 0$ seen at the beginning, it follows that for all $x\gt0$, there is $y_x\gt0$ such that $G(x, y_x)=0$. We have
$$x\le y\le y_x\text{ for }  x\le 1\\x\ge y\ge y_x\text{ for } 1\le x $$ 
In both cases one has $G(x,x)=G(x,y_x)=0$. By continuity and because for $x$ fixed the function $f_x(y)=$ $G(x,y)$ must have a minimum  in the bounded intervals $[x,y_x]$ when $x\le1$ and $[y_x,x]$ when $x\gt1$ (See explanation of this enclosed by ► and◄ below), we deduce that
$G(x,y)\lt0$ when
$x\lt y\lt y_x$ and $x\lt 1$ and when $x\gt y\gt y_x$ and $x\gt1$.
► Let $x$ be fixed, say $x=a$ positive and let the function $f_a(y)=ae^y-ye^a$. Because of $f'_a(y)=ae^y-ye^a=0$ gives $y=a-\ln(a)$ and $f''_a(x)=ae^y\gt0$ it is clear that $f_a$ has a minimum at $y=a-\ln(a)$ ◄
Finally the shape of the searched set is $A\cup B\cup C$ where
$A=$the lower half of the third quadrant.
$B=$ the fourth quadrant.
$C$ contained in the first quadrant and $C=C_1\cup C_2$ where 
$$C_1=\{(x,y):\space 0\le x\le1\text{ and }x\ge y\}\cup\{(x,y):\space 0\le x\le1\text{ and } y\ge y_x\}$$
$$C_2=\{(x,y): x\ge1\text{ and }y\le y_x\}\cup\{(x,y): x\ge1\text{ and }x\le y\}$$
NOTE.-It seems impossible to disregard the branch similar to a hyperbola branch of the curve $G (x, y) = 0$. Recall that $G (x, y_x) = 0$.

A: Note that $x e^y - y e^x \ge 0$ iff $x e^{-x} - y e^{-y} \ge 0$.
Let $f(x) = x e^{-x}$. We will look for pairs $(x,y)$ such that $f(y) \le f(x)$, so first look at some properties of $f$.
Let $E= \{(x,y) | f(x) = f(y) \}$, $L= \{(x,y) | f(x) \ge f(y) \}$. We are interested in a description of $L$.

Note that $f$ is smooth, $f(0)=0$, $f$ has a $\max$ of ${1 \over e}$ at $x=1$, and is strictly increasing on $x<1$, strictly decreasing on $x>1$, strictly positive
for $x>0$ and strictly negative for $x<0$.
(This shows that $(1,y) \in L$ for all $y$.)
Note that $f^{-1} (\{\alpha\})$ is empty for $\alpha > {1 \over e}$, has exactly two points for $\alpha \in (0,{1 \over e})$ and has one point otherwise.
Hence the set $f^{-1} ( \{ f(x) \} )$ contains one point (which must be $x$) for $x \le 0$ and two points (one of which must be $x$) for $x >0$, $x \neq 1$. Let $\phi(x)$ denote the other point for $x >0$, $x \neq 1$. We see that $\phi$ is continuous, strictly decreasing, $\lim_{x \downarrow 0} \phi(x) = \infty$, $\lim_{x \to \infty} \phi(x) = 0$ and $\lim_{x \to 1} \phi(x) = 1$. Note that the inverse function theorem shows that $\phi$ is smooth for $x >0$, $x \neq 1$. To simplify life, let $\phi(1) = 1$.
Now note that $E = \{ (x,x) \} \cup \{ (x,\phi(x)) | x > 0 \}$.
From this we see that
$L= \{ (x,y) |x \le 0, y \le x \} \cup \{ (x,y) |0<x \le 1, y \le x  \text{ or } y \ge \phi(x) \} \cup \{ (x,y) |1 < x, y \le \phi(x)  \text{ or } y \ge x \}$.
Note: The graph of $\phi$ is symmetric around the $y=x$ line.
Note: The function $\phi$ is differentiable at $x=1$ with derivative $-1$, but is rather tedious to show.
First we establish a Lipschitz bound on $\theta$.
We have $f(x) = f(1) + {1 \over 2} f''(\xi) (x-1)^2$ for some $\xi \in [1,x]$ (the interval is understood to be $[x,1]$ if $x <1$).
Since $f(\theta(x)) = f(1) + {1 \over 2} f''(\xi_1) (\theta(x)-1)^2 = f(x)$ and $(1-x), (1-\theta(x))$ have opposite sign we get
$\theta(x) -1 = \sqrt{f(x)-f(1) \over 2 f''(\xi_1)}$ and expanding
$f(x)$ yields $\theta(x) -1= \sqrt{f''(\xi_2) \over f''(\xi_1)} (1-x)$.
In particular, for $x$ close to $1$ there is some $L$ such that
$|\theta(x)-1| \le L |x-1|$.
Since $f$ is smooth, for $x$ close to $1$ there is some $K$ such that
$|f(x)-f(1)-{1 \over 2} f'(1)(x-1)^2| \le K(x-1)^3$.
Then $f(\theta(x)) -f(x) = 0$ gives
${1 \over 2}|f''(1)((\theta(x)-1)^2 + (x-1)^2) | \le K(|\theta(x)-1|^3 + |x-1|^3) \le (1+KL^3)|x-1|^3$.
Rearranging gives
$|\theta(x)-x| |(\theta(x)-1) -(-1)(x-1)| \le {2 \over f''(1)}(1+KL^3) |x-1|^3$, and since
$|\theta(x)-x| \ge |x-1$, we have
$|(\theta(x)-1) -(-1)(x-1)| \le {2 \over f''(1)}(1+KL^3) |x-1|^2$
from which it follows that $\theta$ is differentiable at $x=1$ with
derivative $-1$.
Whew! A lot of work for little gain :-).
