# Thread: Finding integer solutions for x² + y² = 41

1. ## Finding integer solutions for x² + y² = 41

How do you find all possible integer solutions of

$\displaystyle x^2 + y^2 = 41$

where x and y are integers.

2. ## Re: Finding integer solutions for x² + y² = 41

You can do an exhaustive search. The absolute value of both x and y have to be less than 7.

3. ## Re: Finding integer solutions for x² + y² = 41

Originally Posted by emakarov
You can do an exhaustive search. The absolute value of both x and y have to be less than 7.
Care to show me what you mean? I was thinking since x and y are integers they are either even or odd numbers. Therefore x = 2n and y = 2m where m and n are integers. And if x and y are odd we can let x = 2p + 1 and y = 2q + 1 where p and q are integers. However I am not sure who to go about from there.

4. ## Re: Finding integer solutions for x² + y² = 41

Originally Posted by MathCrusader
Care to show me what you mean?
From Wikipedia:

Brute-force search or exhaustive search, also known as generate and test, is a trivial but very general problem-solving technique that consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement.

A brute-force algorithm to find the divisors of a natural number n would enumerate all integers from 1 to the square-root of n, and check whether each of them divides n without remainder. A brute-force approach for the eight queens puzzle would examine all possible arrangements of 8 pieces on the 64-square chessboard, and, for each arrangement, check whether each (queen) piece can attack any other.
That is, test x = 1, x = 2 and so on up to x = 6. For each x, test whether 41 - x^2 is a perfect square.

Originally Posted by MathCrusader
I was thinking since x and y are integers they are either even or odd numbers. Therefore x = 2n and y = 2m where m and n are integers. And if x and y are odd we can let x = 2p + 1 and y = 2q + 1 where p and q are integers. However I am not sure who to go about from there.
The numbers x and y cannot be both even or both odd because otherwise their squares are also both even or both odd and therefore the sum of squares is even.