# How to determine the remaining sides given the three angles and one side of a triangle?

The measure of the interior angles of a triangle are $15^\circ$, $30^\circ$, $135^\circ$ and the length of one edge is 3. In order to determine the length of the remaining two edges, I've tried

a := 3;
eq1 := (a^2 + b^2 - c^2)/(2*a*b);
eq2 := (b^2 + c^2 - a^2)/(2*b*c);
eq3 := (c^2 + a^2 - b^2)/(2*a*c);
Solve[{eq1 == Cos[15 Degree], eq2 == Cos[30 Degree], eq3 == Cos[135 Degree]}, {b,c}]
(*
{{b -> 3 Sqrt[2], c -> (3 (3 Sqrt[2] - 2 Sqrt[6]))/(-3 + Sqrt[3])}}
*)


And

Solve[{x^2 + y^2        == (3 Sqrt[2])^2,
(x - 3)^2 +  y^2 == ((3 (3 Sqrt[2] - 2 Sqrt[6]))/(-3 + Sqrt[3]))^2}, {x, y}]
(*
{{x -> (3 (1 - Sqrt[3]))/(2 (-2 + Sqrt[3])),
y -> -3 Sqrt[(26 - 15 Sqrt[3])/(2 (7 - 4 Sqrt[3]))]},
{x -> (3 (1 - Sqrt[3]))/(2 (-2 + Sqrt[3])),
y -> 3 Sqrt[(26 - 15 Sqrt[3])/(2 (7 - 4 Sqrt[3]))]}}
*)


By putting A := {0, 0, 0}, B := {3,0, 0} and

C := {(3 (1 - Sqrt[3]))/(2 (-2 + Sqrt[3])), 3 Sqrt[(26 - 15 Sqrt[3])/(2 (7 - 4 Sqrt[3]))], 0}


Are the measure of the angles of the triangle $ABC$ $15^\circ$, $30^\circ$, $135^\circ$?

How do I tell Mathematica to do that?

-
You know the VectorAngle[] function? –  Ｊ. Ｍ. Nov 10 '12 at 3:01
VectorAngle, if you look at the docs, gives the angle between two vectors. For vertices A, B, C, the two vectors surrounding A are B-A and C-A. Try VectorAngle[B-A, C-A]. –  VF1 Nov 10 '12 at 3:13
By the way, it is not true that a triangle with vertices at $(0,0)$, $(a,0)$, and $(b,c)$ has edge lengths $a$, $b$, and $c$... –  Rahul Narain Nov 10 '12 at 3:25
I've used Mathematica for 15 years and I didn't know VectorAngle existed. I see it was added in ver. 6. Had I known about it in the past, I could have made good use of it. Will certainly be using it now. –  m_goldberg Nov 10 '12 at 4:16
@István, feel free to expand on it if you wish, though I was hoping OP would try to help himself this time and read the bloody docs... –  Ｊ. Ｍ. Nov 10 '12 at 9:32
show 6 more comments

This is a way to get all possible solutions at once:

d = Degree; Solve /@ (a/Sin[15 d] == b/Sin[30 d] == c/Sin[135 d] /. {# -> 3} & /@ {a, b, c})

-
of course you can make it much easier –  belisarius Nov 10 '12 at 22:02

Use the law of sines, which states that the ratio of the sine of an angle to the length of the side opposite that angle is the same for all three angles. This will give three possible solutions because, as the question states, the known side could be located opposite from any of the three angles.

Proper application of the law of sines will also simplify your code quite a bit.

Here's how you might go about doing this:

(*angles given in the problem*)
angles = {15, 30, 135};

(*for each orientation*)
For[i = 1, i <= 3, i++,

(*use law of sines to calculate each side*)
side1 = 3;