[Math] How to solve quadratic equation in 4 variables

pythonquadratics

I am trying to solve the equation $a^2 + b^2 + c^2 + d^2 = \alpha$ where alpha is a constant and $a, b, c$, and $d$ are the $4$ variables. I need to find some integer values of $a, b, c$ and $d$ which satisfies this equation

I know that I can make $a, b$, and $c$ as $0$ and then $d = \sqrt\alpha$ but this is one very trivial solution.

Another approach which I have in mind is to set $a, b$ as constant and then solve for $c$ and $d$ using brute-force method but that again is very computation intensive method of doing this.

Is there any better way of solving this

Best Answer

The integer solutions to $a^2+b^2+c^2+d^2=n$ for a positive integer $n$ can be found by using the norm for the Hurwitz integers, see here.

Related Question