After finding out that you could factor $a^2 + b^2$ as $(a+bi)(a-bi)$ using complex numbers I wondered if there were any useful factoring tricks using the quaternions or octonions and after some playing around I found that you could factor the sum of up to $4$ squares using this formula: $$a^2 + b^2 + c^2 +d^2 = (a+bi+cj+dk)(a-bi-cj-dk)$$ where $i,j,k$ are the complex units used by the quaternions and $a,b,c,d$ are real constants. Now, I am not too familiar with octonions and any of the ones above that, so my question is:
Can you extend this formula to the octonions or sedenions and all of the ones above that to factor the sum of $n$ squares? If yes, how? If no, is there anything similar that might be useful?
Let's say that $z$ is an octonion, so $z \in \mathbb{O}$ aka $z \in \left\{ \mathbb{R},\, \mathbb{C},\, \mathbb{H},\, \mathbb{O} \right\}$, and that $\overline{z}$ is a conjugate $z$, then: $$ \begin{align*} z \cdot \overline{z} &= \overline{z} \cdot z \tag{1.1} \label{eq: 1.1}\\ z \cdot \overline{z} &= \left| z \right|^{2} \tag{1.2} \label{eq: 1.2}\\ \end{align*} $$
aka if $z := x_{0} + \sum\limits_{k = 1}^{7}\left[ x_{k} \cdot i_{k} \right]$ where $x_{k} \in \mathbb{R}$ and $i_{k}$ are the imaginary units: $$ \begin{align*} \left( x_{0} + \sum\limits_{k = 1}^{7}\left[ x_{k} \cdot i_{k} \right] \right) \cdot \left( x_{0} - \sum\limits_{k = 1}^{7}\left[ x_{k} \cdot i_{k} \right] \right) &= \left( x_{0} - \sum\limits_{k = 1}^{7}\left[ x_{k} \cdot i_{k} \right] \right) \cdot \left( x_{0} + \sum\limits_{k = 1}^{7}\left[ x_{k} \cdot i_{k} \right] \right) \tag{2.1} \label{eq: 2.1}\\ \left( x_{0} + \sum\limits_{k = 1}^{7}\left[ x_{k} \cdot i_{k} \right] \right) \cdot \left( x_{0} - \sum\limits_{k = 1}^{7}\left[ x_{k} \cdot i_{k} \right] \right) &= \sum\limits_{k = 0}^{7}\left[ x_{k}^{2} \right] \tag{2.2} \label{eq: 2.2}\\ \end{align*} $$
Derivation Options
Octonions
If $z \in \mathbb{R}$, then the formula is trivial. If $z \in \mathbb{C}$, then the formula follows directly from difference of two squares is a squared, and $z \in \mathbb{H}$ then follows from Euler Four-Square Identity and at $z \in \mathbb{O}$ the formula from Degen's Eight-Square Identity follows. The identitys also follows from the fact that the norm of the product of two complex numbers, quaternions or octonions is the product of the norms. It also follows directly from their vector representations with real components and the Euclidean norm.
Hurwitz's proved that (as you can see here: Hurwitz's theorem of composition algebras - there are multible proves on the page).
For another reference see wikipedia.
Sedenions and beyond
Define: $$ \begin{align*} z &:= \sum\limits_{k = 0}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \right]\\ \end{align*} $$
Rewrtie $z \cdot \overline{z}$: $$ \begin{align*} z \cdot \overline{z} &= \left( x_{0} + \sum\limits_{k = 1}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \right] \right) \cdot \left( x_{0} - \sum\limits_{k = 1}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \right] \right)\\ z \cdot \overline{z} &= x_{0}^{2} - \sum\limits_{k = 1}^{2^{n} - 1}\left[ \sum\limits_{g = 1}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \cdot x_{g} \cdot i_{g} \right] \right]\\ z \cdot \overline{z} &= x_{0}^{2} - \left( \sum\limits_{k = 1}^{2^{n} - 1}\left[ \sum\limits_{k \ne g = 1}^{2^{n} - 1}\left[ x_{k} \cdot x_{g} \cdot i_{k} \cdot i_{g} \right] \right] - \sum\limits_{k = 1}^{2^{n} - 1}\left[ x_{k}^{2} \right] \right)\\ z \cdot \overline{z} &= \sum\limits_{k = 0}^{2^{n} - 1}\left[ x_{k}^{2} \right] - \sum\limits_{k = 1}^{2^{n} - 1}\left[ \sum\limits_{k \ne g = 1}^{2^{n} - 1}\left[ x_{k} \cdot x_{g} \cdot i_{k} \cdot i_{g} \right] \right]\\ z \cdot \overline{z} &= \sum\limits_{k = 0}^{2^{n} - 1}\left[ x_{k}^{2} \right] - \left( \sum\limits_{k = 1}^{2^{n} - 1}\left[ \sum\limits_{k < g = 1}^{2^{n} - 1}\left[ x_{k} \cdot x_{g} \cdot i_{k} \cdot i_{g} \right] \right] + \sum\limits_{k = 1}^{2^{n} - 1}\left[ \sum\limits_{k > g = 1}^{2^{n} - 1}\left[ x_{k} \cdot x_{g} \cdot i_{k} \cdot i_{g} \right] \right] \right) \tag{use $i_{m} \cdot i_{n} = - i_{n} \cdot i_{m}$ when $m \ne n \wedge \left\{ m,\, n \right\} \notin \left\{ 0 \right\}$}\\ z \cdot \overline{z} &= \sum\limits_{k = 0}^{2^{n} - 1}\left[ x_{k}^{2} \right] - \left( \sum\limits_{k = 1}^{2^{n} - 1}\left[ \sum\limits_{k > g = 1}^{2^{n} - 1}\left[ x_{k} \cdot x_{g} \cdot i_{k} \cdot i_{g} \right] \right] - \sum\limits_{k = 1}^{2^{n} - 1}\left[ \sum\limits_{k > g = 1}^{2^{n} - 1}\left[ x_{k} \cdot x_{g} \cdot i_{k} \cdot i_{g} \right] \right] \right)\\ z \cdot \overline{z} &= \sum\limits_{k = 0}^{2^{n} - 1}\left[ x_{k}^{2} \right]\\ \end{align*} $$
So the formula applies for all algebras of the Cayley–Dickson construction (from $\mathbb{R}$).
Youn can find a calculator for stuff like that here.
Other Hypercomplex Numbers with Similar Formulas
Dual Numbers
$z$ is a dual number if $z = a + b \cdot \varepsilon \wedge \varepsilon^{2} = 0 \ne \varepsilon \wedge \left\{ a,\, b \right\} \in \mathbb{R}$. A similar formular is: $$ \begin{align*} z \cdot \overline{z} &= \overline{z} \cdot z\\ z \cdot \overline{z} &= \left( a + b \cdot \varepsilon \right) \cdot \left( a - b \cdot \varepsilon \right)\\ z \cdot \overline{z} &= a^{2} - \left( b \cdot \varepsilon \right)^{2} = a^{2} - b^{2} \cdot \varepsilon^{2} = a^{2} - b^{2} \cdot 0 = a^{2}\\ \end{align*} $$ $$\fbox{$ \begin{align*} a^{2} &= \left( a + b \cdot \varepsilon \right) \cdot \left( a - b \cdot \varepsilon \right)\\ \end{align*} $}$$
Split-Hypercomplex Numbers (only composition algrbras)
A split hypercomplex number $z$ is of the form $z = \sum\limits_{k = 0}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \right] \wedge 8 \geq 2^{n} \in \mathbb{N}$ where $i_{\geq n}^{2} = 1 \ne i_{\geq n}^{2} \wedge i_{< n}^{2} = -1$, $i_{0} = 1$, ... So:
$$ \begin{align*} z \cdot \overline{z} &= \overline{z} \cdot z\\ z \cdot \overline{z} &= \left( x_{0} + \sum\limits_{k = 1}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \right] \right) \cdot \left( x_{0} - \sum\limits_{k = 1}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \right] \right)\\ z \cdot \overline{z} &= \sum\limits_{k = 0}^{2^{n - 1} - 1}\left[ x_{k}^{2} \right] - \sum\limits_{k = 2^{n - 1}}^{2^{n} - 1}\left[ x_{k}^{2} \right] \end{align*} $$ $$\fbox{$ \begin{align*} \sum\limits_{k = 0}^{n - 1}\left[ x_{k}^{2} \right] - \sum\limits_{k = n}^{2^{n} - 1}\left[ x_{k}^{2} \right] &= \left( x_{0} + \sum\limits_{k = 1}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \right] \right) \cdot \left( x_{0} - \sum\limits_{k = 1}^{2^{n} - 1}\left[ x_{k} \cdot i_{k} \right] \right)\\ \end{align*} $}$$
Bi-Hypercomplex Numbers (only composition algrbras)
Some bi-hypercomplex numbers have similar formulas like bi-quaternions and bi-octanions...