Find distance between intersections of circle and line? - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: HP Prime ( /forum-5.html)+--- Thread: Find distance between intersections of circle and line? ( /thread-12376.html) |

Find distance between intersections of circle and line? - kevin3g - 02-07-2019 03:48 PM
The equations are y=2x+3 and (x+1)^2+y^2=55. I know you can put them in solve and find x and y twice, but is there a faster way? RE: Find distance between intersections of circle and line? - Albert Chan - 02-07-2019 06:05 PM
Midpoint of intersecting points is closest to the circle center, (-1,0), a line with slope -1/2 y = 2x + 3 y = -1/2*x -1/2 ; line passes circle center and midpoint -> midpoint = (-1.4, 0.2) Distance from midpoint to circle center = √(0.4² +0.2²) = √(20)/10 ~ 0.447 Distance from midpoint to intersecting points= √(55 - 20/100) = √(274/5) ~ 7.403 Distance between intersecting points ~ 2 * 7.403 ~ 14.8 Intersecting points = (-1.4 ± t, 0.2 ± 2t) for some t t² + (2t)² = 5 t² = 274/5; matching distance square t = ±√(274)/5 -> Intersecting points ~ (-1.4 ± 3.31, 0.2 ± 6.62) = (-4.71, -6.42) and (1.91, 6.82) RE: Find distance between intersections of circle and line? - kevin3g - 02-07-2019 06:13 PM
Is there a way I can subtract/use the answers I get from the solve function easily without having to retype them? {-4.7106, 1.9106} {-6.4212, 6.8212} RE: Find distance between intersections of circle and line? - ijabbott - 02-07-2019 06:43 PM
(02-07-2019 03:48 PM)kevin3g Wrote: The equations are y=2x+3 and (x+1)^2+y^2=55. I know you can put them in solve and find x and y twice, but is there a faster way? I don't know if it is faster, but: \[ y=2x+3, (x+1)^2+y^2=55 \\ (x+1)^2+(2x+3)^2=55 \\ x^2+2x+1+4x^2+12x+9=55 \\ 5x^2+14x-45=0 \] If the quadratic equation \(ax^2+bx+c=0\) has real roots, the roots are separated by \(\frac{\sqrt{b^2-4ac}}{a}\), since \(\frac{-b+\sqrt{b^2-4ac}}{2a}-\frac{-b-\sqrt{b^2-4ac}}{2a} = \frac{2\sqrt{b^2-4ac}}{2a} = \frac{\sqrt{b^2-4ac}}{a}\). This gives the \(x\) separation of the intersections, \(\Delta x = \frac{\sqrt{b^2-4ac}}{a}\). The \(y\) separation, \(\Delta y\) will be twice that since \(y=2x+3\), so \(\Delta y = 2\Delta x\) (and the \(3\)s cancel). The distance between the intersection points \(D = \sqrt{(\Delta x)^2 + (\Delta y)^2} = \sqrt{(\Delta x)^2 + (2\Delta x)^2} = \sqrt{5(\Delta x)^2} = \sqrt{5\left(\frac{\sqrt{b^2-4ac}}{a}\right)^2} =\sqrt{5\left(\frac{b^2-4ac}{a^2}\right)} = \frac{\sqrt{5(b^2-4ac)}}{a}\). Plugging in the coefficients of the quadratic equation, \(D = \frac{\sqrt{5(14^2- (4 \cdot 5 \cdot (-45)))}}{5} = \frac{\sqrt{5(196+900)}}{5} = \frac{\sqrt{5480}}{5} \approx 14.81\). EDIT: Corrected mistake in \(c\) spotted by Albert Chan. \(c\) should be \(-45\), not \(-41\). RE: Find distance between intersections of circle and line? - Albert Chan - 02-08-2019 12:33 AM
Another way is to find angles of intersection. Move the circle center to (0,0), line -> y' = 2(x' - 1) + 3 = 2x' + 1 Scale down to create a unit circle, line -> y'' = 2 x'' + 1√55 -> sin(z) = 2 cos(z) + 1√55 Use half angle formulas, t=tan(z/2), and let k=1√55: 2t/(1+t²) = 2 * (1-t²)/(1+t²) + k 2t = 2 - 2t² + k + kt² (k-2) t² - 2t + (k+2) = 0 -> t = 0.6605, -1.7328 -> z = 66.89°, 239.98° Distance between intersecting point = 2 r sin(Δz/2) = 2 √(55) sin(173.09°/2) ~ 14.8 Intersecting hi point = (√(55) cos(66.89°) - 1 , √(55) sin(66.89°)) ~ (1.91, 6.82) Intersecting lo point = (√(55)cos(239.98°) - 1, √(55)sin(239.98°)) ~ (-4.71, -6.42) Edit: this may be more accurate: |sin(Δz/2)| = |Δt| / √((1+t1²)(1+t2²)) RE: Find distance between intersections of circle and line? - informach - 02-08-2019 11:59 AM
You can see many examples, from ... http://www.hp-prime.de/files/composite_file/file/55-55-english-hp-prime-127-pages_m.pdf RE: Find distance between intersections of circle and line? - Aries - 02-08-2019 12:08 PM
(02-07-2019 03:48 PM)kevin3g Wrote: The equations are y=2x+3 and (x+1)^2+y^2=55. I know you can put them in solve and find x and y twice, but is there a faster way? Hey @kevin3g, you can solve the system between the two equations and once you found the intersection points coordinates you apply the usual formula (c=sqrt(((x1-x2)^2)+((y1-y2)^2))) to find their distance Honestly I dont know if there is a faster way than that given. Best, Aries RE: Find distance between intersections of circle and line? - informach - 02-08-2019 12:24 PM
More easy is ... https://www.wolframalpha.com/input/?i=circle+and+line RE: Find distance between intersections of circle and line? - Albert Chan - 02-08-2019 12:45 PM
Distance from point (x0, y0) to line Ax + By + C = 0 is abs(Ax0 + By0 + C)/√(A² + B²) -> Distance from circle center (-1,0) to y=2x+3 is abs(-2 + 0 + 3)/√5 = 1/√5 -> Distance between intersecting points = 2 * √(55 - 1/5) = 2 √(274/5) ~ 14.8 RE: Find distance between intersections of circle and line? - informach - 02-08-2019 01:05 PM
Continuing my previous post ... RE: Find distance between intersections of circle and line? - ijabbott - 02-08-2019 04:47 PM
(02-08-2019 12:45 PM)Albert Chan Wrote: Distance from point (x0, y0) to line Ax + By + C = 0 is abs(Ax0 + By0 + C)/√(A² + B²) That's an elegant way to do it! RE: Find distance between intersections of circle and line? - Albert Chan - 09-04-2019 10:16 PM
(02-07-2019 03:48 PM)kevin3g Wrote: The equations are y=2x+3 and (x+1)^2+y^2=55. I just thought of a way, even if we do not know the distance for point to line formula. At the end, I accidentally proved the "official" distance formula First, shift the coordinate so the point (in this case, center of circle), is the origin. y = 2x + 3 = 2(x+1) + 1 = 2x' + 1 With this shifted coordinates, find where the line hit the axis. In other words, find points on line, P=(0, y0), Q=(x0, 0). Let h = distance of origin to the line. Area ΔOPQ = ½ |x0 y0| = ½ |PQ| h \(\large \mathbf{h = {|x_0 y_0| \over \sqrt{x_0^2 + y_0^2 }}}\) But, we can do better ! Assume the line has form y = m x + c, we have (x0, y0) = (-c/m, c) h = | -c²/m | / √(c²/m² + c²) \(\large \mathbf{h = {|c| \over \sqrt{m² + 1}}}\) For this example, h = |1| / √(2² + 1) = 1/√5 Distance of chord = \(\large \mathbf{2 \sqrt{r^2 - \frac{c^2}{m^2+1}}}\) = 2 √(55 - 1/5) ≈ 14.8 For prove of official distance formula, rewrite Ax + By + C = 0 A(x-x0) + B(y-y0) + (Ax0 + By0 + C) = 0 (y-y0) = (-A/B) (x-x0) - (Ax0 + By0 + C)/B Matching pattern y' = mx' + c, then use h formula → \(\large \mathbf{ h= { |A x_0 + B y_0 + C| \over \sqrt{A^2 + B^2}}} \) RE: Find distance between intersections of circle and line? - teerasak - 09-06-2019 05:16 AM
In CAS mode, use command solve({y=2*x+3,(x+1)^2+y^2=55},{x,y}) then the calculator will return you 2 intersection points. Put that in a variable e.g m1 then use command distance(m1(1),m1(2)) you will get the distance between two points |