The pythagorean theorem holds for every right triangle: given the legs [tex] a, b [/tex] and the hypothenuse [tex] c [/tex], the triangle is right if and only if
[tex]a^2+b^2=c^2[/tex]
So, you have to check:
[tex] 30^2+45^2=2925\neq 2500 = 50^2 [/tex]
So the first triangle can't be a right triangle.
[tex] 30^2+40^2=2500= 50^2 [/tex]
So the second triangle is a right triangle.
The third triangle can't be right, because it has the same legs but a different hypothenuse
Finally, we have
[tex] 25^2+40^2=2225= 50^2 [/tex]
So the last triangle can't be a right triangle.