Inspiration from the title of a Bertolt BRECHT play.
We propose to establish algebraic identities of the form :
$x^2+(x+a)^2+(x+b)^2=(x+m)^2+(x+n)^2+(x+p)^2 \tag{1}$
where $a,\;b,\;m,\;n,\;p\;$ are real numbers.
My greatest achievement is the formula in
PROPOSITION 1. Let $a,\;b\;$ be given numbers. It holds
the algebraic identity :
$x^2+(x+a)^2+x+b)^2=\left (x+\frac{2(a+b)}{3}\right )^2+\left (x+\frac{2b-a}{3}\right )^2+\left ( x+\frac{2a-b}{3}\right )^2 \tag{2}$
The proof can be done by direct calculation.
$\square$
For example
$x^2+(x+1)^2+(x+5)^2=(x+4)^2+(x+3)^2+(x-1)^2$
Some choices may be unfortunate, e.g.
$x^2+(x+1)^2+(x+2)^2=(x+2)^2+(x+1)^2+x^2$
$x^2+(x+2)^2+(x+4)^2=(x+4)^2+(x+2)^2+x^2$
$x^2+(x+3)^2+(x+6)^2=(x+6)^2+(x+3)^2+x^2$
while others give us equal terms
$x^2+(x+0)^2+(x+3)^2=(x+2)^2+(x+2)^2+(x-1)^2$
$x^2+(x+3)^2+(x+0)^2=(x+2)^2+(x-1)^2+(x+2)^2$
More seriously we have
$x^2+(x-1)^2+(x+4)^2=(x+2)^2+(x+3)^2+(x-2)^2$
but putting $x-1=y$ we have $(y+1)^2+y^2+(y+5)^2=(y+3)^2+(y+4)^2+(y-1)^2$ which is precisely the example from the beginning.
Another $x^2+(x-2)^2+(x+5)^2=(x+2)^2+(x+4)^2+(x-3)^2$
in which if we put $x-3=y$ , write it backwards, somehow ordering the terms
$y^2+(y+5)^2+(y+7)^2=(y+1)^2+(y+3)^2+(y+8)^2$;
if instead we put $x-2=z$ we have, ordering now
$z^2+(z+2)^2+(z+7)^2=(z-1)^2+(z+4)^2+(z+6)^2$
and if $z-1=t$ and write it backwards, we have
$t^2+(t+5)^2+(t+7)^2=(t+1)^2+(t+3)^2+(t+8)^2$
which is the same as the identity in $"y"$.
Finally
$x^2+(x-1)^2+(x+7)^2=(x+4)^2+(x+5)^2+(x-3)^2$
Ordering we have
$(x-1)^2+x^2+(x+7)^2=(x-3)^2+(x+4)^2+(x+5)^2\;;$
and putting $x-1=y$ we obtain
$y^2+(y+1)^2+(y+8)^2=(y-2)^2+(y+3)^2+(y+6)^2\;;$
putting $x-3=z$ in the backwards we obtain
$z^2+(z+7)^2+(z+8)^2=(z+2)^2+(z+3)^2+(z+10)^2$
so we get a bunch of other identities.
We can write it somehow "in integers" on the (2)
$x^2+(x+a)^2+(x+3c-a)^2=(x+2c)^2+(x+2c-a)^2+(x+a-c)^2 \tag{3}$
where $a$ and $c$ are arbitrary numbers.
Now let's see how we got to (2).
Identifying in (1) the coefficients of $x^1$ and $x^0$ we have the relations
$\begin{cases} m+n+p=a+b\\m^2+n^2+p^2=a^2+b^2\end{cases} \tag{4}$
Eliminating the unknown $n$ we obtain
$m^2+(a+b-m-p)^2+p^2=a^2+b^2\Leftrightarrow2m^2+(a+b)^2-2m(a+b)-2p(a+b)+2mp+2p^2=a^2+b^2$
which divided by 2 and ordered by $p $ gives us
$p^2+p(m-a-b)+m^2-m(a+b)+ab=0 \tag{5}$
The equation (5) in the unknown $p$ has the discriminant
$\Delta_p=(m-a-b)^2-4[m^2-m(a+b)+ab]=(a-b)^2+2m(a+b)-3m^2$.
Assuming that it is a perfect square
$\Delta_p=(a-b)^2+2m(a+b)-3m^3=t^2 \tag{6}$
then the roots of the equation (5) will be
$p_{1,2}=\frac{a+b-m\pm t}{2} \tag{7}$
Writing (6) as an equation in the unknown $m$
$3m^2-2m(a+b)+t^2-(a-b)^2=0 \tag{8}$
we set the condition that its half-discriminant is a perfect square
$\Delta^{'}_m=(a+b)^2-3[t^2-(a-b)^2]=s^2$
so
$s^2+3t^2=(a+b)^2+3(a-b)^2 \tag{9}$
The values of m are given by
$m_{1,2}=\frac{a+b\pm s}{2} \tag{10}$
Choosing in (9) $s=a+b,\;t=a-b$ we obtain
- from (10) : $m_{1,2}=\frac{a+b \pm (a+b)}{2}\in \left \{0,\;\frac{2(a+b)}{3} \right \}$; we take the second value
- from (7) : $p_{1,2}=\frac{a+b-\frac{2(a+b)}{3} \pm (a-b)}{2} \in \left \{\frac{2b-a}{3},\;\frac{2a-b}{3}\right \}$.
Then $n=a+b-m-p$ take the respectively values $\frac{2a-b}{3},\;\frac{-a+2b}{3}$.
If $m=\frac{2(a+b)}{3},\;p_1=\frac{2b-a}{3},\;n=\frac{2a-b}{3}$ we obtain (2). And the values $p_2=\frac{2a-b}{3},\;n_2=\frac{-a+2b}{3}$ give us the same formula (2) with $a$ and $b$ swapped.
If we notice that in (9) the right-hand side is $4a^2-4ab+4b^2=(2a-b)^2+3b^2$ then we can still make the choice $s=2a-b,\;t=b$ but by the end we get the same formula (2) again. More than that, since we already know a solution for the quadratic equation (9) in the unknowns $s\; and\; t$, we can find a general solution to it depending on two parameters $\lambda,\;\mu$:
$s=\frac{(3\mu^2-\lambda^2)(a+b)-6\lambda \mu (a-b)}{\lambda^2+3\mu^2},\;\;\;t=\frac{(\lambda^2-3\mu^2)(a-b)-2\lambda \mu (a+b)}{\lambda^2+3\mu^2}$
We are not going in this direction anymore, but what has been said so far has shown that the following Proposition takes place:
PROPOSITION 2. Let $a,\;b,\;c\;$ be given numbers. We can
determine, in terms of $a,\; b,\; c$ , two numbers $?(a,b,c)$,
$\;??(a,b,c)$ such that
$x^2+(x+a)^2+(x+b)^2=(x+c)^2+(x+?)^2+(x+??)^2 \tag{11}$
Indeed, from (4) we obtain the conditions
$n+p=a+b-c,\;\;n^2+p^2=a^2+b^2-c^2$
which can express $n$ and $p$ in terms of $a,\;b,\;c$ :
$n,p=\frac{a+b-c \pm \sqrt{a^2+b^2-3c^2-2ab+2bc+2ac}}{2}$
Conditions in which these expressions are rational, i.e. without radicals, we leave them to the study of others who are more skilled.
Examples : $x^2+(x+1)^2+(x+2)^2=(x+3)^2+(x-\imath \sqrt{2})^2+(x+\imath \sqrt{2})^2$
$x^2+(x+4)^2+(x+5)^2=(x+6)^2+(x+1)^2+(x+2)^2$
$x^2+(x+7)^2+(x+8)^2=(x+9)^2+(x+3-\sqrt{7})^2+(x+3+\sqrt{7})^2$