For a sum of two squares: $a^2 + b^2 = c$ where $0 < b < a$, if I know of a valid $a^2$ and $b^2$, is there a fast algorithm for finding all other two square combinations that have the same sum? One that is faster than having to sum every possible $a^2$ and $b^2$ less than $c$.
2026-03-29 09:10:08.1774775408
Finding other representations for a sum of two squares
828 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in NUMBER-THEORY
- Maximum number of guaranteed coins to get in a "30 coins in 3 boxes" puzzle
- Interesting number theoretical game
- Show that $(x,y,z)$ is a primitive Pythagorean triple then either $x$ or $y$ is divisible by $3$.
- About polynomial value being perfect power.
- Name of Theorem for Coloring of $\{1, \dots, n\}$
- Reciprocal-totient function, in term of the totient function?
- What is the smallest integer $N>2$, such that $x^5+y^5 = N$ has a rational solution?
- Integer from base 10 to base 2
- How do I show that any natural number of this expression is a natural linear combination?
- Counting the number of solutions of the congruence $x^k\equiv h$ (mod q)
Related Questions in ALGORITHMS
- Least Absolute Deviation (LAD) Line Fitting / Regression
- Do these special substring sets form a matroid?
- Modified conjugate gradient method to minimise quadratic functional restricted to positive solutions
- Correct way to prove Big O statement
- Product of sums of all subsets mod $k$?
- (logn)^(logn) = n^(log10+logn). WHY?
- Clarificaiton on barycentric coordinates
- Minimum number of moves to make all elements of the sequence zero.
- Translation of the work of Gauss where the fast Fourier transform algorithm first appeared
- sources about SVD complexity
Related Questions in SUMS-OF-SQUARES
- How many variations of new primitive Pythagorean triples are there when the hypotenuse is multiplied by a prime?
- If $x^2-dy^2 = -1$ has a solution in $\mathbb{Z^2}$, then $d$ is the sum of two coprime squares.
- How to interpret this visual proof for Archimedes' derivation of Sum of Squares?
- consecutive integers that are not the sum of 2 squares.
- Sum of the Squares of the First n square Numbers is not a perfect square number
- How many sub-square matrices does a square matrix have and is there a simple formula for it?
- On near-Pythagorean triples $(n^5-2n^3+2n)^2 + (2n^4-2n^2+1)^2 = n^{10} + 1$
- Closed form for the sum $\sum_{n=-\infty}^{\infty}\sum_{m=-\infty}^{\infty}{\left(n^2+m^2\right)^{-{p}}}$
- Prove that any power of $10$ can be written as sum of two squares
- Can Gauss-Newton algorithm give better optimization performances than Newton algorithm?
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
Let me first say a bit about how the problem goes if you don't have a representation to start from.
Writing $c$ as a sum of two squares $a^2+b^2$ is equivalent to factoring $c$ as $(a+bi)(a-bi)$ over the Gaussian integers. The way to list out all of these would be to solve the problem for each prime factor of $c$ of the form $4k+1$, and combine those in all possible ways.
For example, let $c = 65$, which factors as $5\cdot 13$. We have $5 = 2^2+1^2$, or $5 = (2+i)(2-i)$, and $13 = 2^2 + 3^2$, or $13 = (2+3i)(2-3i)$. We can write $65$ as a sum of two squares by picking one of the complex conjugates from each factor:
For a more complicated example, let $c = 1170$, which factors as $2 \cdot 3^2 \cdot 5 \cdot 13$. Since $3$ is a prime of the form $4k+3$, it cannot be written as a sum of two squares, so all we can do with it is treat $3^2$ as $3^2+0^2 = (3+0i)(3-0i)$. Also, $2$ is special (it ramifies in $\mathbb Z[i]$): we can write $2 = 1^2+1^2=(1+i)(1-i)$, but this will not help us get more solutions. So we still only consider the two possibilities from $5$ and $13$:
Doing the above steps is hard for large $c$, because factoring is hard. In fact, solving the problem is more or less as hard as factoring: knowing all the ways to write $c$ as a sum of two squares tells us what all its prime factors of the form $4k+1$ are. To see this, consider $1170$ again. If we know that $$1170 = 21^2 + 27^2 = 33^2 + 9^2,$$ we can:
Having one representation $c = a^2+b^2$ doesn't change the fact that factoring is hard, so we still have to do that work.
However, having one representation helps us tremendously with the "easy" step afterwards (which can still be quite hard when the primes are large): writing each prime factor of the form $4k+1$ as a sum of two squares. We can do this by taking the GCD again.
For example, if we know how that $1170 = 2 \cdot 3^2 \cdot 5 \cdot 13$, and also that $1170 = 21^2 + 27^2$, we can:
Then we can combine these factors in other ways, as before, to get the other representations $a^2 + b^2 = c$. (In this case, there's just one more: $(1+i)(3)(1+2i)(3-2i) = 9+33i$, for $1170 = 9^2 +33^2$.)
One caveat: if a prime of the form $4k+1$ appears to a higher power, then some representations $a^2+b^2$ might not help with that prime. For example, if we instead take $5850 = 2 \cdot 3^2 \cdot 5^2 \cdot 13$, then there are three representations: $$5850 = 51^2+57^2 = 33^2+69^2 = 15^2 + 75^2.$$ The first two will help us out with all the primes, but the last will just give us $\gcd(5, 15+75i) = 5$, so it will not tell us how to write $5$ as a sum of two squares. (The first two ways to write $5850$ are relying on nontrivial representations of $5^2=25$ as $3^2 + 4^2$; the last relies on the trivial solution $25 = 5^2+0^2$.)