Given four array of 3 numbers each which represents sides and angles of two triangles. The task is to check if two triangles are similar or not. If it is similar, print the theorem by which it is.
Input : side1 = [2, 3, 3] angle1 = [80, 60, 40] side2 = [4, 6, 6] angle2 = [40, 60, 80] Output: Triangles are similar by SSS AAA SAS Input : side1 = [2, 3, 4] angle1 = [85, 45, 50] side2 = [4, 6, 6] angle2 = [40, 60, 80] Output: Triangles are not similar
Similar triangles are two or more triangles that have all corresponding angles that are equal and all corresponding sides that are proportionate. It does not matter what direction the triangles are facing. Their size does not matter as long as each side is proportionate. The similarity of triangles can be proved by the following theorems:
- Side-Side-Side (SSS) similarity criteria :
If all the sides of a triangle are proportional to the corresponding sides of another triangle then the triangles are said to be similar by the property of Side-Side-Side (SSS).
In a triangle ABC and PQR if, AB/PQ = BC/QR = CA/RP triangles are similar.
- Side-Angle-Side (SAS) similarity criteria :
If two sides of the two triangles are proportional and the angle between them is same in both triangle then the triangles are said to be similar by the property of Side-Angle-Side (SAS).
In a triangle ABC and PQR if, AB/PQ = BC/QR and = triangles are similar.
- Angle-Angle-Angle (AAA) similarity criteria :
If all the angles of a triangle are equal to the corresponding angles of another triangle then the triangles are said to be similar by the property of Angle-Angle-Angle (AAA).
In a triangle ABC and PQR if = , = and = then triangles are similar.
Below is the implementation of the above approach:
Triangles are similar by AAA SSS SAS
- Program to check congruency of two triangles
- Equilateral Triangles using Matchsticks
- Number of triangles after N moves
- Find all possible triangles with XOR of sides zero
- Count the number of possible triangles
- Count number of unique Triangles using STL | Set 1 (Using set)
- Area of the circumcircle of any triangles with sides given
- Counting Triangles in a Rectangular space using BIT
- Number of Triangles in an Undirected Graph
- Number of triangles that can be formed with given N points
- Program to check if two strings are same or not
- Number of triangles formed from a set of points on three lines
- Count of acute, obtuse and right triangles with given sides
- Count of triangles with total n points with m collinear
- Number of possible Triangles in a Cartesian coordinate system
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.