# Calculate unknowns in a set of triangles

I got a problem of which I can't get mathematica to calculate.

The known inputs are a=17 degree, b=12 degree and side d is 300.

The whole thing is actually 4 right-angled triangles (left side as A, right side as B, the red at bottom as C and the black with the d side as D)

I've tried to type all the equations for the angles and sides I need to get the h value but I can't get a reasonable output.

Remove["Global*"]
va = 17;
vb = 12;
d = 300;
Reduce[{(Tan[va]*(Tan[vc]*d)) == (Sin[va]*(Tan[vd]*d)) == (Tan[vb]*(Cos[vc]/d)) == (Sin[vb]*(Cos[vd]/d)), Tan[vc] == (Tan[vc]*d)/d, Cos[vc] == d/(Cos[vc]/d), Tan[vd] == (Tan[vd]*d)/d, Cos[vd] == d/(Cos[vd]/d)}, h] // N


The ouput I get is

Tan[vc] == -0.275163 Tan[vd] && Sec[vd] == 1.79174 Tan[vd] && Sec[vc] == 1.51196 Tan[vd] && Cos[vd] == 161256. Tan[vd] && Cos[vc] == 136077. Tan[vd]

What is it that I'm missing? I can't see how else I should make the equation more elaborate to get allt the sides and angles that is needed to the the value of h.

• I haven't checked your algebra, but you do need to tell Mathematica that your angles are in degrees. It assumes they are radians the way you have written your code. Commented Jun 3, 2021 at 7:24
• Oh, totally overlooked that. With a small change (forgot to include the variable h) I got an answer but I can't get only that variable as an out put. Commented Jun 3, 2021 at 7:30
• You claim that there are 4 right-angled triangles. That can not be right. If the red triangle is right-angled, then D, the black triangle, must have an angle smaller than Pi/2. Commented Jun 3, 2021 at 9:28

va = 17 Degree;
vb = 12 Degree;
d = 300;


Taking x as the length from A to the base of the tower.

Reduce[{
Tan[va] == h/x,
Tan[vb] == h/Sqrt[d^2 - x^2]}] // N


x == 171.251 && h == 52.3567

You just need enough expressions to determine your system. If you add too many expressions Mathematica may not find the solution.

• Wouw, looks much better then my jibberish of conditions =) Commented Jun 3, 2021 at 11:26
• @JohanGrankvist - To get only h use NSolve[{Tan[va] == h/x, Tan[vb] == h/Sqrt[d^2 - x^2], h > 0}, h, {x}] Commented Jun 3, 2021 at 14:55

Updated code. Now the thing is to only get h value as output

va = 17 Degree; vb = 12 Degree; d = 300;
Reduce[{(h == Tan[va]*(Tan[vc]*d)) == (Sin[va]*(Tan[vd]*d)) == (Tan[vb]*
(Cos[vc]/d)) ==(Sin[vb]*(Cos[vd]/d)), Tan[vc] == (Tan[vc]*d)/d, Cos[vc]
== d/(Cos[vc]/d),Tan[vd] == (Tan[vd]*d)/d, Cos[vd] == d/(Cos[vd]/d)}]
//N
`