How do you prove that $\left|A \times A\right|$ is equal to $\left|A\right|$ for every infinite set?

I'm trying to prove this basic fact of cardinal arithmetic, but I'm getting stuck on the uncountable sets.

I suspect there's an obvious technique that I'm missing for proving statements like this.

I'm okay with taking the axiom of choice and am not trying to prove that this fact is equivalent to the axiom of choice as in this question.

Let $\varepsilon$ refer to the empty set.

Let $\mathbb{N}$ refer to the positive integers.

I'm trying to prove that

$$ \text{$\left|A\right| = \left|A \times A\right|$ if and only if $\left|A\right| \in \{0, 1\}$ or $A$ is infinite.} $$

Here's my attempt to prove it.

Let's consider five different mutually exclusive cases for the size of $A$.

- $A$ is empty
- $A$ is a singleton
- $\left|A\right| \in \mathbb{N}_{\ge2}$
- $A$ is countably infinite.
- $A$ is uncountably infinite.

### case 1/5: $A$ is empty.

$ \varepsilon \times \varepsilon $ is equal to $\varepsilon$.

### case 2/5: $A$ is a singleton.

$ \{\sigma_1\} \times \{\sigma_2\} $ is $\{(\sigma_1, \sigma_2)\}$.

### case 3/5: $\left|A\right| \in \mathbb{N}_{\ge2}$

Let $x$ be a real variable.

$$ \text{If $x = xx$, then $x \in \{0, 1\}$ } $$

Therefore, the left and right components of the theorem are both never true.

### case 4/5: $A$ is countably infinite.

Since $A$ is countably infinite, there exists a bijective function $f : A \to \mathbb{N}$.

There's a bijective function $g$ from $\mathbb{N} \times \mathbb{N}$ to $\mathbb{N}$, Arguments to $g$ are shown below with a leading dot, for example `·7`

. `*`

marks a value that has been omitted for expository purposes.

```
x
·1 ·2 ·3 ·4
·1 1 3 6 10
y ·2 2 5 9 *
·3 4 8 * *
·4 7 * * *
```

We notice that the first row is the triangle numbers, so $g(x, 1) = \frac{x+xx}{2}$.

For the cells below the first row, we note that $g(x, y) = g(y+x-1, 1) + (1 - y)$.

$g$ is a bijection from $\mathbb{N} \times \mathbb{N}$ to $\mathbb{N}$.

Thus $h$, as defined below, is a bijection from $A \times A$ to $A$.

$$ h(a, b) = f^{(-1)}(g(f(a), f(b))) $$

### case 5/5: $A$ is uncountably infinite.

This case, I can't prove, but I can prove it for some of the uncountable cardinalities.

Let $\varphi$ be a bijection from $\mathbb{R}$ to $\mathbb{R} \cup \{ -\infty, \infty \}$.

Let $a$ be a bijection from $\mathbb{R}$ to $[0,1]$.

$$ a(t) = \frac{\arctan(t) + \frac{\pi}{2}}{\pi} $$

$$ a(-\infty) = 0 $$ $$ a(+\infty) = 1 $$

Let $j$ be a bijection from $[0,1] \times [0,1]$ to $[0,1]$.

Let $j(x, y)$ be given as follows. Write out $x$ and $y$ in base 2.

Using the following table, convert each digit pair one at a time in $x$ and $y$ to base 4.

```
x
·0 ·1
y ·0 0 1
·1 2 3
```

for example

$$ j(.01\cdots, .11\cdots) = .23\cdots $$

We can use this to define a bijection from $\mathbb{R} \times \mathbb{R}$ to $\mathbb{R}$.

$$ \psi(u, v) = \varphi^{(-1)} \circ a^{(-1)} \circ j(a\circ \varphi(u), a \circ \varphi(v)) $$

Let $S_X$ be the set of functions from $X$ to $\mathbb{R}$, then we can define a bijection $p$ from $S_X \times S_X$ to $S_X$ as follows. Let $\lambda \cdots \mathop. \cdots$ denote an anonymous function.

$$ p(a, b) = \lambda x \mathop. \psi(a(x), b(x)) $$

The same arguments works for the set $D$, where $x \in D$ if $x$ is positive or negative infinity or if $\arctan(x)$ is a dyadic rational. In the case of dyadic rationals, after a prefix of finite length all the digits are zero in both base 2 and base 4. Therefore $D$ is countable.

Therefore, we have bijections between $A$ and $A \times A$ for all cardinalities of the form $\left|\mathbb{R}\right|$, $\left|X \to \mathbb{R}\right|$, and $\left|X \to D\right|$.

However, I don't have any reason to believe that all of the uncountable cardinalities are expressible in this way.