Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

The basic equation for a straight line is $y = mx + b$, where $b$ is the height of the line at $x = 0$ and $m$ is the gradient. The basic equation for a circle is $(x - c)^2 + (y - d)^2 = r^2$, where $r$ is the radius and $c$ and $d$ are the $x$ and $y$ shifts of the center of the circle away from $(0,\ 0)$.

I'm trying to come up with an equation for determining the intersection points for a straight line through a circle. I've started by substituting the "y" value in the circle equation with the straight line equation, seeing as at the intersection points, the y values of both equations must be identical. This is my work so far:

$$(x - c)^2 + (mx + b - d)^2 = r^2$$ $$x^2 + c^2 - 2xc + m^2x^2 + (b - d)^2 + 2mx(b - d) = r^2$$ I'll shift all the constants to one side $$x^2 - 2xc + m^2x^2 + 2mx(b - d) = r^2 - c^2 - (b - d)^2$$ $$(m^2 - 1)x^2 + 2x(m(b - d) - c) = r^2 - c^2 - (b - d)^2$$

That's as far as I can get. From what I've gathered so far, I ought to be able to break down the left side of this equation into a set of double brackets like so: $$(ex + f)(gx + h)$$ where $e,\ f,\ g$ and $h$ are all constants. Then I simply have to solve each bracket for a result of $0$, and I have my $x$ coordinates for the intersections of my two equations. Unfortunately, I can't figure out how to break this equation down.

Any help would be appreciated.

share|improve this question
    
Why don't you just solve for $x$? You know the constans, right? –  M.B. Nov 4 '12 at 12:22
    
I'm trying to develop an equation that will deduce what x is for any set of constants, not just a specific set. –  Cambot Nov 4 '12 at 12:41

3 Answers 3

Let's say you have the line $y = mx + c$ and the circle $(x-p)^2 + (y-q)^2 = r^2$.

First, substitute $y = mx + c$ into $(x-p)^2 + (y-q)^2 = r^2$ to give

$$(x-p)^2 + (mx+c-q)^2 = r^2 \, . $$

Next, expand out both brackets, bring the $r^2$ over to the left, and collect like terms:

$$(m^2+1)x^2 + 2(mc-mq-p)x + (q^2-r^2+p^2-2cq+c^2) = 0 \, .$$

This is a quadratic in $x$ and can be solved using the quadratic formula. Let us relabel the coefficients to give $Ax^2 + Bx + C = 0$, then we have

$$x = \frac{-B \pm \sqrt{B^2-4AC}}{2A} \, . $$

If $B^2-4AC < 0$ then the line misses the circle. If $B^2-4AC=0$ then the line is tangent to the circle. If $B^2-4AC > 0$ then the line meets the circle in two distinct points.

Since $y=mx+c$, we can see that if $x$ is as above then

$$y = m\left(\frac{-B \pm \sqrt{B^2-4AC}}{2A}\right) + c \, . $$

share|improve this answer
    
Ah! Thank you! This certainly looks like it'll do what I'm trying to do! –  Cambot Nov 4 '12 at 13:20

You've got a quadratic in $x$. Use the discriminant to see if it has real solutions, and if so how many. Then solve the quadratic for $x$, and substitute the solution(s), if any, back into the equation for the line.

share|improve this answer

Have you checked the general solution on wolframalpha? You've already made your quadratic equation and so, you can get the roots of $x$ as the solutions that can then be used to get the values of $y$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.