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))
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Area of Triangle using Side-Angle-Side (length of two sides and the included angle)
- Check if it is possible to draw a straight line with the given direction cosines
- Find coordinates of the triangle given midpoint of each side
- Length of remaining two sides of a Triangle from a given side and its adjacent angles
- Program to print a Hollow Triangle inside a Triangle
- Find the first, second and third minimum elements in an array
- Sum of upper triangle and lower triangle
- Biggest Reuleaux Triangle within a Square which is inscribed within a Right angle Triangle
- Biggest Reuleaux Triangle inscribed within a Square inscribed in an equilateral triangle
- Program to find the side of the Octagon inscribed within the square
- Probability of getting more value in third dice throw
- Minimum swaps to make two strings equal by swapping only with third string
- Program to calculate area of a rhombus whose one side and diagonal are given
- Find the Side of the smallest Square that can contain given 4 Big Squares
- Find the side of the squares which are inclined diagonally and lined in a row
- Find the side of the squares which are lined in a row, and distance between the centers of first and last square is given
- Find side of Square which makes minimal area to fit two identical rectangles inside it
- Find the area of rhombus from given Angle and Side length
- Area of a Square | Using Side, Diagonal and Perimeter
- Length of diagonals of a Rhombus using length of Side and vertex Angle
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.