3

I have been looking for an algebraic way to solve for 2 squares when given a sum, but I got nothing so far.

For example:

$$y^2 + x^2 = 9797$$

I thought that the solution would have to do something like this, but I want a method which is certain to give me a solution without trial and error.

$$f(x) = \sqrt{(9797 - x^2)}$$

or this where I would just increase the variable a by one until x^2 is a perfect square.

$$9797 - y^2 = x^2$$

I came across the sum of two squares theorem, as well Fermat's theorem on sums of two squares. However, they state that a number can be written as $x^2 + y^2 = z$ but from my research, I believe they did not state a solution to solve the two squares.

Edit: I wanted to add that I know there can be multiple solutions to problem, as the example I gave has $4$ solutions.

  • an article from about 1990 by Stan Wagon, called The Euclidean Algorithm Strikes Again. https://www.jstor.org/stable/2323912?seq=1#page_scan_tab_contents – Will Jagy Oct 20 '19 at 00:07
  • I gave an answer for primes at https://math.stackexchange.com/questions/1521776/express-prime-as-sum-of-squares-p-a2-b2?rq=1 – Will Jagy Oct 20 '19 at 00:23
  • here is one that discusses composite numbers https://math.stackexchange.com/questions/1471878/sum-of-two-squares-n-a2-b2-where-n-is-not-prime?rq=1 – Will Jagy Oct 20 '19 at 00:24
  • 1
    This is possible only for certain sums by Fermat's two squares theorem. – Bernard Oct 20 '19 at 00:45

1 Answers1

0

$$x^2+y^2=9797\implies y=\sqrt{9797-x^2}\\ \implies\bigg\lceil\sqrt{9797-\big(\big\lfloor\sqrt{9797}\;\big\rfloor\big)^2}\space \bigg\rceil=14\le x\le \big\lfloor\sqrt{9797}\;\big\rfloor=98$$ This shows a finite search and any $\space x \space $ that yields an integer $\space y\space $ is a solution. Since $\space x,y\space $ are interchangeable, this means $\qquad|x|,|y|\in\big\{31,49,86,94\big\}\qquad$ with the valid solutions being combinations of the pairs $\space 31,94\space $ and $\space 49,86\space $ for a total of $\space 16\space $ solutions.

Note: The reason that the ends and middles of the set are paired is because the farthest and nearest members must be paired in the same way that $\space 100,1\space $ and $\space 51,50\space $ would be paired to sum integers. If paired otherwise, their squares summed would be smaller or larger than $\space 9797.\space $

poetasis
  • 6,338