# Inaccuracy in triangles computation

The below link on MSE was a question assuming a second solution was obtained on Mathematica by second method. Appears to be a question of accuracy.

Big Side of Triangle

Given are three side lengths $$(AB,AC,AD)=(3,2,4)$$. Also $$(B,C,D)$$ are collinear and $$AB$$ is tangent to the circle at $$A$$.

The bigger side $$BD$$ is computed in two ways

1. Direct geometry By similar triangles $$BD= AB \cdot AD / AC = 3 \cdot 4/2 =6$$

2. A roundabout method that should give same results.. Cosine Rule on triangles $$\triangle{ABC}$$, $$\triangle{ACD}$$ and tangent property $$BA^2=BC \cdot BD$$

Clear["Global*"]
{a,b,c}={3,2,4};
BigSide=a*c/b
NSolve[{x^2==a^2+b^2-2 a b csbt,y^2+c^2-2 c y csbt==b^2,x(x+y)==a^2},{x,y,csbt}]


Low accuracy is seen in the second solution that is not expected.

Can the accuracy of the second method be improved? If so, how?

Geogebra drawing does not distinguish the circles as the difference is so small.

• I've given my knowledge for Euclidean geometry back to my teacher so cannot analyze the problem, but it doesn't look like a precision issue: Solve[{x^2 == a^2 + b^2 - 2 a b csbt, y^2 + c^2 - 2 c y csbt == b^2, x (x + y) == a^2}, {x, y, csbt}, Quartics -> True] // N[#, 32] & Commented Nov 23, 2022 at 7:54

• The equation doesn't ensure that the three points B,C,D are colinear.
Clear["Global*"]
{a, b, c} = {3, 2, 4};
BigSide = a*c/b;
sol = NSolve[{x^2 == a^2 + b^2 - 2 a b csbt,
y^2 + c^2 - 2 c y csbt == b^2, x (x + y) == a^2, x > 0,
y > 0}, {x, y, csbt}]


• sol[[1]] is right since Cos[ACB]+Cos[ACD]==0
{SolveValues[x^2 + b^2 - 2 x*b*Cos[t] == a^2, Cos[t]],
SolveValues[b^2 + y^2 - 2 b*y*Cos[t] == c^2, Cos[t]]} /. sol[[1]]


• sol[[2]] is wrong since Cos[ACB]+Cos[ACD]!=0
{SolveValues[x^2 + b^2 - 2 x*b*Cos[t] == a^2, Cos[t]],
SolveValues[b^2 + y^2 - 2 b*y*Cos[t] == c^2, Cos[t]]} /. sol[[2]]


## Edit

If we use Cosine Rule to the angle ACB==θ and angle ACD==π - θ, then we can get the only one solution.

Solve[{x^2 + 2^2 - 2*x*2*Cos[θ] == 3^2,
y^2 + 2^2 - 2*y*2*Cos[π - θ] == 4^2, x (x + y) == 3^2,
x > 0, y > 0, 0 <= θ <= π}, {x, y, θ}]


• Does the Cosine Rule sometimes bend straight lines? In this case the first analytic solution is available . With many numerical results won't individual verification be cumbersome to remove extraneous ones? Commented Nov 23, 2022 at 11:44
• @Narasimham Cosine Rule is the relation of the sides and the angles only work in one triangle, and it actual work fine in two triangle ABC and ACD respectly , but we still need to add condition to ensure that ABD is a triangle. Commented Nov 23, 2022 at 11:57
• By the circle property $BA^2=BC \cdot BD$ Euclid implied that 1) BD is a straight line 2) BC is a straight line 3) Points (B,C,D) are collinear. right? Commented Nov 23, 2022 at 13:04
• @Narasimham The inversion transformation $BA^2=BC \cdot BD$ work only when B,C,D are colinear. Commented Nov 23, 2022 at 15:33
• All output results from same code should be correct. Is comment about inversion of circles? Commented Nov 24, 2022 at 19:58