As one question in a somewhat bigger analysis I want to characterize the set of solutions of the generalized Pell-equation in the title:
$$a^2+b^2 = 2 c^2 \tag 1$$
I'm not much fluent with the Pell-solving technology, and from some initial brute-force solutions I constructed the following scheme, which seems to me as if it could produce all solutions by changing a vector of parameters.
My question is, whether the set of solutions that I find is exhaustive or not - tests in small numbers seem to suggest that.
I introduce two matrices; $$T= \begin{bmatrix} 1&0&0\\0&3&2\\0&4&3 \end{bmatrix} \tag 2$$ $$C= \begin{bmatrix} 0&1&0\\1&0&0\\0&0&1 \end{bmatrix} \tag 3$$ The starting solution is the vector $A_0=[a,b,c]=[1,1,1]$.
With this I create further solutions by $$A_k=A_0 \cdot T^k \qquad k \in \mathbb Z \tag {4.1}$$
which gives a list with all solution having $a=1$.
But from each of those solutions one can derive a new initial $A_0$ from where then again a complete list of solutions can be drawn:
$$A_{k_1,k_2,k_3}=A_0 \cdot T^{k_1} \cdot C \cdot T^{k_2}\cdot C \cdot T^{k_3} \tag {4.2}$$
and so on, for arbitrarily many indexes/exponents $k_j$.
Using Pari/GP I implemented a function, which takes the vector of arbitrary length containing the indexes/exponents as argument in the following form
$$ A_x = \operatorname{Pell2Sol}([k_1,k_2,...,k_n]) \tag 5$$
I don't know, whether the resulting structure can be called a tree or whether it has another name.
Q: As I said above, it seems to me that this indexing of solutions is exhaustive (assuming the number of indexes $n$ is taken from $1$ to $\infty$). Does someone know whether this is true?
Context: if this is a valid method, I'll try to extend/adapt it to some similar equations which occur in a combined set of equations in quadratics.
Here is a simple Pari/GP-implementation:
\\ Update: initial vector A0 is configurable to have a gcd-common factor
\\ vector E takes the indexes
\\ env=0 says: give only that solution,
\\ env=1 says: printout the set of neigboured solutions towards index +- env.
\\ A0 can be configured by a common factor in the function call
{Pell2Sol(E,env=0,gcd=1)=my(A0=gcd*[1,1,1], T=[1,0,0;0,3,2;0,4,3],C=[0,1,0;1,0,0;0,0,1]);
if(#E==0,return(A0));
A0*=prod(k=1,#E,C*T^E[k]);
if(!env,return(A0));
return(Mat(vectorv(2*env+1,r,A0 * T^(r-1-env))));}
Giving Pell2Sol([1,0],3)
shows the following sequence of solutions:
a b c
--------------
7 -601 425
7 -103 73
7 -17 13
7 1 5
7 23 17
7 137 97
7 799 565
Here the negative signs should not be significant, since we use the squares anyway. But the signs are significant when computing the lists of solutions using the powers of the matrix T and the matrix C. I didn't supress the signs here to show that internal effect.
and Pell2Sol([1,5,1,0],3)
gives
a b c
76793 -5375863 3801697
76793 -920801 653365
76793 -148943 118493
76793 27143 57593
76793 311801 227065
76793 1843663 1304797
76793 10750177 7601717
Perhaps a better picture than the two above is the following, (where I also draw the motivating connection to the problem of finding magic squares-of-squares) (Screenshot):
Pell2Sol([-2,-2,0],3)
we should see negative values in $a$ and $b$ – Gottfried Helms Dec 03 '21 at 00:36