# Getting the angles of a non-right triangle when all lengths are known

I have a triangle that I know the lengths of all the sides. But I need to know the angles. Needs to work with non-right triangles as well.

I know it is possible, and I could have easily done this years ago when I was in trig, but it has completely slipped my mind.

Id prefer a solution that I can code into a function, or something that does not require constructing right triangles from it.

-

2
– Austin Mohr Mar 19 '12 at 23:36

1
Recall the cosine law: if $a,b,c$ are the lengths of the triangle and $\theta$ is the angle opposite $c$ then $c^2=a^2+b^2-2abcos\theta$ – you Mar 19 '12 at 23:37

## 1 Answer

As has been mentioned in comments, the formula that you're looking for is the Law of Cosines. The three formulations are: $$c^2 = a^2 + b^2 - 2ab \cos(C)$$ $$b^2 = a^2 + c^2 -2ac \cos(B)$$ $$a^2 = b^2 + c^2 - 2bc \cos(A)$$

You can use this law to find all three angles. Alternatively, once you have one of the angles, you can find the next using the Law of Sines, which states that: $${\sin{A} \over a} = {\sin{B} \over b} = {\sin{C} \over c}$$

And of course, once you have solved for two of the angles, you need only subtract their sum from $180$ degrees to get the measure of the third.

-

@Théophile: (Now if we delete all these comments, no one will ever know...) – The Chaz 2.0 Mar 20 '12 at 15:55
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 5, "mathjax_display_tex": 4, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9545448422431946, "perplexity_flag": "head"}