Solving triangles with SAS and SSS
How the law of cosines cracks SAS and SSS triangles, why it beats the law of sines here, and a worked example of each mode.
Two ways a triangle can be pinned down
A triangle is fully determined the moment you know enough about it, and two of those situations are exactly what this calculator handles. SAS, side-angle-side, gives you two sides and the angle trapped between them, which locks the shape because the third side cannot flex without changing that angle. SSS, side-side-side, gives all three lengths, which also fixes the triangle since three sides can hinge together in only one shape up to reflection. In both cases the law of cosines is the right tool, because it directly relates all three sides to one angle and lets you solve for whichever piece is missing without ambiguity.
Why not just use the law of sines
The law of sines is simpler to write, but it stumbles on SAS and SSS. In SAS you start with no side opposite a known angle, so the sine ratio has nothing to anchor to until you have first found the third side with the law of cosines. In SSS you have no angles at all to begin, so again the sine rule cannot start. There is also the ambiguous case, where the law of sines can return two candidate angles because sine is positive for both acute and obtuse angles. The law of cosines avoids that trap entirely: the inverse cosine returns a single angle between 0 and 180 degrees, so an obtuse triangle is reported correctly with no second guessing.
A worked SAS example
Suppose sides a and b are 5 and 7 with an included angle C of 37 degrees. First find side c from c squared equals 25 plus 49 minus 2 times 5 times 7 times the cosine of 37 degrees. That works out to a c of about 4.2539. With all three sides known, the inverse cosine formulas give angle A near 45.0215 degrees and angle B near 97.9785 degrees, which together with the 37 degree angle C sum to 180. Heron's formula on the three sides returns an area of about 10.5318. These are exactly the values the calculator prints, so you can follow the same steps on paper to verify any SAS triangle.
A worked SSS example and the triangle inequality
Now take three sides of 7, 8 and 9 with no angles given. Because each pair of sides sums to more than the third, 7 plus 8 exceeds 9 and so on, a valid triangle exists. Applying the law of cosines to each angle in turn gives roughly 48.1897, 58.4119 and 73.3985 degrees, and Heron's formula yields an area of about 26.8328. Had you instead entered 2, 3 and 9, the sum 2 plus 3 falls short of 9, the triangle inequality fails, and the tool refuses the input rather than returning a meaningless angle. Checking that inequality first is a quick way to know whether three lengths can form a triangle at all.