Given two sides A, B and angle C. Find the third side of the triangle using law of cosines.
Input : a = 5, b = 8, c = 49 Output : 6.04339
In particular, the Law of Cosines can be used to find the length of the third side of a triangle when you know the length of two sides and the angle in between. See here to learn to how to find the value of cos.
Let us assume a, b, c are the sides of triangle where c is the side across from angle C. Then,
c^2 = a^2 + b^2 - 2*a*b*cos(c) OR c = sqrt(a^2 + b^2 - 2*a*b*cos(c))
- Find coordinates of the triangle given midpoint of each side
- Program to find the side of the Octagon inscribed within the square
- Program to find area of a triangle
- Program to find Circumcenter of a Triangle
- Program to find the Centroid of the triangle
- Program to find the Radius of the incircle of the triangle
- Find the Side of the smallest Square that can contain given 4 Big Squares
- Check if it is possible to draw a straight line with the given direction cosines
- C Program to print Floyd's triangle
- Program to print Sum Triangle for a given array
- Find Perimeter of a triangle
- Find all angles of a triangle in 3D
- Find all angles of a given triangle
- Program to print Reverse Floyd's triangle
- Program for incrementing/decrementing triangle pattern
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.
Improved By : jit_t