# Iterating Hamilton's construction $\Bbb R\to \Bbb C$ yields what type of algebraic structure on $\Bbb C^2$ (e.g. occurs in nested complex datatypes).

The C++ language provides a general template-based implementation of complex numbers. Normally, these are using to manipulate numbers of the form $$a + b i$$, where $$a, b$$ are chosen as either 32 or 64 bit floating point numbers. These are respectively denoted by std::complex<float> and std::complex<double>. The language implements the standard multiplication, division, addition etc. operators on complex numbers.

Because the code provided to manipulate complex numbers is general, we can embed complex numbers within complex numbers, e.g. using std::complex<std::complex<double>>, nesting arbitrarily deeply. The doubly nested data type is uniquely defined by four floating point numbers. It is thus representing numbers in a form $$(a + b i) + (c + d i) j$$, where $$i^2 = -1$$, $$j^2 = -1$$, and $$a, b, c, d \in \mathbb{R}$$.

I initially thought these would be related to quaternions, but the structure encountered here is not anti-commutative in the $$i, j$$ basis units which is apparently a property of quaternions. On top of that, these seem to not be equivalent to bicomplex numbers, because there is no third analog of the imaginary unit present, named $$k$$ in this article. I get the suspicion that std::complex<std::complex<double>> is isomorphic to the complex numbers after reading the Frobenius theorem about real division algebras.

Is this the correct conclusion? If so, why? If not, what algebraic structure is std::complex<std::complex<double>> isomorphic to?

• By CRT $\,\Bbb C[j]/(j^2+1) \cong C[j]/(j-i) \times \Bbb C[j]/(j+i)\cong \Bbb C^2\ \$ Feb 10, 2023 at 18:15
• Pardon my lack of algebra knowledge, but what is $\mathbb{C}[j]/(j^2+1)$ ? You're saying this is isomorphic to $\mathbb{C}^2$? Feb 10, 2023 at 18:36
• It's the quotient of the polynomial ring $\Bbb C[j]$ by its ideal $(j^2+1),\,$ i.e. said polynomials mod $\,j^2\equiv -1,\,$ just like Hamiltons pair construction $\Bbb C \cong \Bbb R[i]/(i^2+1)\,$ (or, w/o notation abuse, $\Bbb C\cong \Bbb R[x]/(x^2+1),\,$ where $\,i = \bar x := x+(x^2+1)\,$ denotes the image of $\,x\,$ in the quotient ring); i.e. we iterate the same construction that we used to create $\Bbb C$ from $\Bbb R,\,$ just as you do in C++. Please give more context, e.g. do you know any ring theory? Feb 10, 2023 at 18:50
• @Prem, the operations I had in mind are defined by introducing the $i$ and $j$ I identified in the post, and I've verified that my compiler indeed produces operations in line with this definition. Besides, the template parameter can be any numeric type, it's just that behavior is undefined and left to be explored by the user in the event it's not float, double, or long double. I'm not planning to write production code employing this behavior, but rather sought only to explore the behavior exhibited by std::complex<std::complex<double>>. Feb 10, 2023 at 19:00
• @Gavin The answer you accepted uses concepts unlikley to be familiar at the level of your question (e.g. tensor products). If you are interested in simpler / better explanations then you should unaccept it (many readers don't browse questions with accepted answers). Generally it's a good idea to wait at least a few days before accepting an answer. Feb 10, 2023 at 20:05

This structure cannot possibly be isomorphic to complex numbers; as　you say yourself, it is four-dimensional over $$\mathbb R$$ while the complex numbers are two dimensional.
What you're missing is that the bicomplex $$j, k$$ from the article you linked have $$j^2 = 1$$ and $$k^2 = -1$$, but your $$j$$ has $$j^2 = -1$$. So take your $$i,j$$ and define $$i' = i,\quad j' = ij,\quad k' = j.$$ You will find using the basis $$1,i',j',k'$$ that your algebra is the bicomplex numbers exactly as described in the article.
In the structure $$\Bbb C\otimes_{\Bbb R}\Bbb C$$ you get $$i^2+1=j^2+1=0$$ and thus also $$i^2-j^2=0$$, identifying $$i\otimes 1$$ with $$i$$ and $$1\otimes j$$ with $$j$$. This means that $$(i+j)(i-j)=0,$$ so you get zero-divisors. In a further step, as also $$(ij)^2=1$$, $$P_\pm=\frac12(1\pm ij)$$ are projectors on sub-spaces of $$\Bbb C\otimes_{\Bbb R}\Bbb C$$ where $$i$$ acts like $$\pm j$$, so the space decomposes into the vector-space sum of two "cross-diagonal" copies of $$\Bbb C$$.
• Ah, the modulus operator, which I'd guess is used to find inverses and do division, is $|z_1+z_2j|^2=z_1^2+z_2^2$, not $|z_1|^2+|z_2|^2$. Feb 10, 2023 at 19:30
• @Bill : Considering the spaces as real vector spaces, any set $X$ of dimension 2 in a vector space $M$ of dimension 4 has measure zero. Almost every point of $M$ does not belong to $X$. Feb 10, 2023 at 20:17