Proof of Intersection of a Line and a Circle
Total Page:16
File Type:pdf, Size:1020Kb
Proof of Intersection of a Line and a Circle P2(x2,y2) P1(x1,y1) r C(xc,yc) This problem is most easily solved if the circle is in implicit form: 2 2 2 (x − xc) + (y − yc) − r = 0 and the line is parametric: x = x0 + ft y = y0 + gt Substituting for (parametric line) x and y into the circle equation gives a quadratic equation in t: • Two roots of which give points on the line where cuts the circle. p f(x − x ) + g(y − y ) ± r2(f 2 + g2) − (f(y − y ) − g(x − x ))2 t = c 0 c 0 c 0 c 0 (f 2 + g2) • The roots maybe coincident if the line is tangential to the circle. P1(x1,y1) 1 r C(xc,yc) • If roots are imaginary then there is no intersection. 1 1 Proof: The circle is in implicit form: 2 2 2 (x − xc) + (y − yc) − r = 0 (1) and the line is parametric: x = x0 + ft y = y0 + gt (2) Substituting for (parametric line) x and y from Eqn. 2 into the circle equation, Eqn. 1, gives a quadratic equation in t gives: 2 2 2 (x0 + ft − xc) + (y0 + gt − yc) − r = 0 (3) Let xd = x0 − xc yd = y0 − yc (4) Then we may write Eqn. 3 2 2 2 (xd + ft) + (yd + gt) − r = 0 (5) Expanding the quadratic parts in Eqn. 5 gives: 2 2 2 2 2 2 2 xd + 2fxdt + f t + yd + 2gydt + g t − r = 0 (6) Express Eqn. 6 as a quadratic in t, so gather terms in t in Eqn. 6: 2 2 2 2 2 2 (f + g )t + (2fxd + 2gyd)t + xd + yd − r = 0 2 2 2 2 2 2 (f + g )t + 2(fxd + gyd)t + xd + yd − r = 0 (7) 2 2 Now the general solution of a quadratic of the form ax + bx + c = 0, gives the roots, xi; i = 1; 2 as: p −b ± b2 − 4ac x = (8) i 2a So in our problem (a quadratic in t) from Eqn. 7 we can see that for Eqn. 8: a = (f 2 + g2) b = 2(fxd + gyd) 2 2 2 c = xd + yd − r Substituting for a; b and c in Eqn. 8 we get roots of t, ti: q 2 2 2 2 2 2 −2(fxd + gyd) ± (2(fxd + gyd)) − 4(xd + yd − r )(f + g ) t = i 2(f 2 + g2) q 2 2 2 2 2 2 −2(xd + gyd) ± 4(fxd + gyd) − 4(xd + yd − r )(f + g ) t = i 2(f 2 + g2) (9) The expression of the right hand side of Eqn. 9 can be simplified in a few ways. p Firstly we can factor 4 from the term and the division by 2 then simplifies the equation to: q 2 2 2 2 2 2 −2(xd + gyd) ± 2 (fxd + gyd) − (xd + yd − r )(f + g ) t = i 2(f 2 + g2) q 2 2 2 2 2 2 −(fxd + gyd) ± (fxd + gyd) − (xd + yd − r )(f + g ) t = i (f 2 + g2) (10) 3 p Let us now consider the term and simplify this, let: 2 2 2 2 2 2 S = (fxd + gyd) − (xd + yd − r )(f + g )) 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 S = f xd + 2fgxdyd + g yd − f xd − f yd + f r − g xd − g yd + g r (11) 2 2 2 2 Eqn 11 can be simplified as follows, some terms cancel out f xd, g yd and others can be gathered together r2; f; and g terms: 2 2 2 2 2 2 2 S = r (f + g ) − (f yd − 2fgxdyd + g xd 2 2 2 2 S = r (f + g ) − (fyd − gxd) 2 2 2 2 S = r (f + g ) − (−gxd + fyd) (12) Substituting for xd and yd from Eqn. 4 in Eqn 12 we get: 2 2 2 2 S = r (f + g ) − (−g(x0 − xc) + f(y0 − yc)) 2 2 2 2 S = r (f + g ) − (g(xc − x0) − f(yc − y0)) p Substituting for S from Eqn. 13 and xd and yd from Eqn. 4 in the term in Eqn. 10 gives us the solution: p f(x − x ) + g(y − y ) ± r2(f 2 + g2) − (f(y − y ) − g(x − x ))2 t = c 0 c 0 c 0 c 0 (f 2 + g2) Q.E.D 4.