(Not logged on) | Register | Log On

You can subscribe to this discussion group using an RSS feed reader. techInterview Discussion

Answers to technical interview questions. A part of TechInterview.org

A part of techInterview.org: answers to technical interview questions.

Your host: Michael Pryor

Pythagorean Triples

x = 3, y = 4, z = 5 is one solution to the equation:

x^2 + y^2 = z^2

Can you prove that this equation has an infinite number of solutions ?

Hint: You don't need to use algebra to find the solution
Sajid Send private email
Friday, July 21, 2006
 
 
Sure.

(3n,4n,5n) where n is any natural number is a solution.
Tapori Send private email
Friday, July 21, 2006
 
 
Sorry Tapori, I should have said that x and y cannot share a common factor ...
Sajid Send private email
Saturday, July 22, 2006
 
 
This equation represents a circle at center (0, 0) and radius "z". For any value of z, a circle can be drawn which has infinite number of points, thus infinite solutions for the equation.
Piyush S Send private email
Saturday, July 22, 2006
 
 
.. and x, y and z need to be integers ;-)
Sajid Send private email
Sunday, July 23, 2006
 
 
x=0,y=1,z=1
x=0,y=2,z=2
x=0,y=3,z=3
x=0,y=4,z=4
...
Put 0 in either x or y.
Wills
Monday, July 24, 2006
 
 
Take two integers m and n and consider the equation

square(m-n) + 4*m*n = square(m+n). This equation is always true. So if we find m and n such that, m*n is a perfect square, then we can have x = m+n, y = 2*sqrt(m*n) and z = m-n and always satisfy square(x)+square(y)=square(z).

It is obvious that we can find infinite such m and n such that m*n is a perfect square.
Piyush Srivastava Send private email
Tuesday, July 25, 2006
 
 
Look at the sequence of differences of consecutive squares:
N:  1  2  3  4  5  6
n^2:1  4  9  16  25  36
diff    3  5  7  9  11

An infinite number of (odd) squares occur in the 3rd row.  Where 9 occurs in the 3rd row, that corresponds to
5^2 - 4^2 = 9 = 3^2; similarly at 13^2 - 12^2 = 25, etc.

Each of those infinitely many occurrences is a Pythagorean triple.
Will Dowling Send private email
Tuesday, July 25, 2006
 
 
I made a mess of this question - sorry.

All of the previous solutions are correct, but the solution I was looking for is the one given by Will Dowling.

I'm sure the previous posters would also have reached this answer if I had asked the question correctly in the first place !
Sajid Send private email
Tuesday, July 25, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz