GP Pari has a function called "qfsolve" which solves over Q the quadratic equation X^t G X = 0, where G is a symmetric matrix.
For example let G = matdiagonal([1,1,-65]) =
| 1 0 0 |
G = | 0 1 0 |
| 0 0 -65|
Running the GP Pari qfsolve(G) gives
x = [4, 7, -1] and double checking: xGxT = 0 as expected.
My observation is this, there is also another vector which works as well:
x = [1, 8, -1] and it too satisfies the xGxT = 0 requirement.
This vector was NOT given by qfsolve but it happens to be the other x-vector associated with G, since 4^2 + 7^2 = 1^2 + 8^2 = 65 and they are the only 2 solutions possible for 2 positive integer squares summing to 65.
Question:
How do we find ALL x-vectors which satisfy the condition?
If I take -1105 as the last term in G, there are 4 solutions possible:
x = [24, 23, -1] x = [31, 12, -1] x = [32, 9, -1] x = [33, 4, -1]
qfsolve(G) only gives [32,-9,-1] which is the 3rd solution, 3 solutions are missing.
Other than setting up a dual loop of x,y and brute forcing solutions of x^2 + y^2 = 1105, is there any better method of obtaining ALL the x-vector solutions using matrix operations?