Answer:
A triangle is a right triangle if and only if the sum of the squares of the two shorter sides is equal to the square of the longest side. This is known as the Pythagorean theorem.
Let's check each triangle to see if it satisfies this condition:
Triangle P:
Shortest side = 12
Middle side = 24
Longest side = 30
12^2 + 24^2 = 144 + 576 = 720
30^2 = 900
720 is not equal to 900, so triangle P is not a right triangle.
Triangle Q:
Shortest side = 9
Middle side = 40
Longest side = 41
9^2 + 40^2 = 81 + 1600 = 1681
41^2 = 1681
1681 is equal to 1681, so triangle Q is a right triangle.
Triangle R:
Shortest side = 5
Middle side = 18
Longest side = 21
5^2 + 18^2 = 25 + 324 = 349
21^2 = 441
349 is not equal to 441, so triangle R is not a right triangle.
Therefore, only triangle Q is a right triangle.