alexcey wrote:
In general, if it's known that a triangle is a right triangle and its hypotenuse is c, it is not enough to find a and b in the equation a^2 + b^2 = c^2.
For instance, a^2 + b^2 = 5^2, we can't assume that it's a 3-4-5 triangle whenever a,b,c are real numbers.
However, my question is whether this applies to the integer case. Clearly if a^2 + b^2 = 5^2 and we know that a and b are integers then it's definitely a 3-4-5 triangle. In this case it's easy to get all permutations, but what if I'm given a^2 + b^2 = (large integer)^2, how do I know if there is more than one pair of perfect squares that would add up to the square of hypotenuse?
I'm asking this question because often I have seen in DS problems that only one side is given for a right triangle and the question prompt asks whether the data is sufficient. Clearly in certain cases it is sufficient, but not in the general one. Can anybody provide insight into this?
You are obviously not expected to know all the pythagorean triplets.
For a small number, you can easily verify that there is only one pair of sides which gives the required hypotenuse. Say for 5, you can see that no other pair of numbers from 1 to 4 will give you the desired relation.
But if the hypotenuse is large e.g. 65, you are not expected to know or calculate that it has 2 sets of sides possible (16, 63, 65) and (33, 56, 65). So there is no way they are going to test you on this.