Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Determine whether a list of side lengths can form a right triangle
ResourceFunction["RightTriangleQ"][{a,b,c}] determines whether the side lengths a,b and c represent a right triangle. | |
ResourceFunction["RightTriangleQ"][tri] determines whether the triangle tri represents a right triangle. |
The set of lengths {3, 4, 5} forms a right triangle:
In[1]:= |
![]() |
Out[1]= |
![]() |
{2, 3, 4} does not form a right triangle:
In[2]:= |
![]() |
Out[2]= |
![]() |
RightTriangleQ accepts triangle specifications:
In[3]:= |
![]() |
Out[3]= |
![]() |
RightTriangleQ applies to noninteger numbers:
In[4]:= |
![]() |
Out[4]= |
![]() |
In[5]:= |
![]() |
Out[5]= |
![]() |
To determine whether the given ordering of integers forms a Pythagorean triple, use PythagoreanTripleQ:
In[6]:= |
![]() |
Out[6]= |
![]() |
In[7]:= |
![]() |
Out[7]= |
![]() |
Note that RightTriangleQ accepts any ordering of the edge lengths when determining if a right triangle can be formed from the edges, while a Pythagorean triple must be ordered:
In[8]:= |
![]() |
Out[8]= |
![]() |
In[9]:= |
![]() |
Out[9]= |
![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License