> 
> $X$ and $Y$ are two sets. $X^Y$ denotes the set of all functions from $Y$ to $X$. Similarly, $Y^X$ denotes the set of all functions from $X$ to $Y$. If $X^Y = Y^X$, prove that $X = Y$.
> 
> 
> 

I tried to show this by way of contradiction, but my argument seems to be lacking rigor. To begin, assume that $X\neq Y$. Then there exists $y\in Y$ such that $y \notin X$. If we think about $X^Y$, then this set contains functions $f:Y\to X$, which assign a unique image $f(y)$ to $y\in Y$. As $y\notin X$, we can obviously *not find* such functions in $Y^X$. So $X^Y \neq Y^X$, which is a contradiction. Hence, $X=Y$.

Are there better ways of proving this? Is my argument complete? How can I make it more rigorous?