Question: Find the length of the chord joining the points in which the straight line $\frac{x}{a} + \frac{y}{b}= 1$ meets the circle $x^2+y^2=r^2$

My initial thoughts were rearranging the straight line equation into the form of $y=mx+c$ which means our equation becomes $y= b - \frac{bx}{a}$

So subbing this into our circle equation we get

$$ x^2 + (b - \frac{bx}{a})^2 = r^2$$

$$ \Leftrightarrow x^2 + b^2 - \frac{2b^2x}{a} + \frac{b^2x^2}{a^2} = r^2$$

$$ \Leftrightarrow a^2x^2+a^2b^2- 2b^2ax+b^2x^2-r^2a^2=0$$

$$ \Leftrightarrow (a^2+b^2)x^2-(2b^2a)x+a^2(b^2-r^2)=0$$

Now I was thinking of finding $(x_1-x_2)^2$ and $(y_1-y_2)^2$ and finding the length of the chord by using the distance formula but I want to know if I am on the right track.

--- Attempt at it

So now to find the length of the chord we need to find $ \sqrt{ (x_1-x_2)^2 + (y_1+y_2)^2}$

Hence by vieta's formulas we get:

$$ \Rightarrow x_1+x_2 = \frac{2ab^2}{a^2+b^2} ~~~~{and} ~~~~ \Rightarrow x_1x_2 = \frac{a^2(b^2-r^2)}{a^2+b^2}$$

As $(x_1-x_2)^2 = (x_1+x_2)^2 -4x_1x_2$

$$ (x_1-x_2)^2 = \left(\frac{2ab^2}{a^2+b^2}\right)^2 - \frac{4a^2(b^2-r^2)}{a^2+b^2} $$

$$ \Leftrightarrow (x_1-x_2)^2 = \frac{4a^2b^4}{(a^2+b^2)^2} - \frac{4a^2(b^2-r^2)}{a^2+b^2} $$

$$ \Leftrightarrow (x_1-x_2)^2 = \frac{4a^2}{a^2+b^2} \left( \frac{b^4}{a^2+b^2} + r^2-b^2 \right)$$

$$ \Leftrightarrow (x_1-x_2)^2 = \frac{4a^2}{(a^2+b^2)^2} \left( {b^4} + r^2-b^2(a^2+b^2) \right)$$

$$ \Leftrightarrow (x_1-x_2)^2 = \frac{4a^2}{(a^2+b^2)^2} \left( {b^4} + (r^2-b^2)(a^2+b^2) \right)$$

$$ \therefore (x_1-x_2)^2 = \frac{4a^2}{(a^2+b^2)^2} \left( r^2a^2+r^2b^2-a^2b^2\right)$$

Now to find the corresponding $(y_1-y_2)^2$

As $y= b - \frac{bx}{a} = b(1-\frac{x}{a}) = \frac{b}{a}(a-x)$ then

$$ y_1+y_2 = \frac{b}{a}(a-x_1) + \frac{b}{a}(a-x_2)$$

$$ \Leftrightarrow y_1+y_2 = \frac{b}{a} (2a - (x_1+x_2)) $$

$$ \Leftrightarrow y_1+y_2 = \frac{b}{a} (2a - (\frac{2ab^2}{a^2+b^2}) $$

$$ \Leftrightarrow y_1+y_2 = 2b(1- \frac{b^2}{a^2+b^2}$$

$$ \Rightarrow y_1+y_2 = 2b(\frac{a^2}{a^2+b^2})$$

Now to find $y_1y_2$

$$ y_1y_2 = \frac{b}{a}(a-x_1)\frac{b}{a}(a-x_2) $$

$$ \Leftrightarrow y_1y_2 = \frac{b^2}{a^2}(a^2-x_1a-x_2a+x_1x_2)$$

$$ \Leftrightarrow y_1y_2 = \frac{b^2}{a^2}(a^2-a(x_1+x_2) + (x_1x_2))$$

$$ \Leftrightarrow y_1y_2 = \frac{b^2}{a^2}(a^2-a(\frac{2ab^2}{a^2+b^2}) + \frac{a^2(b^2-r^2)}{a^2+b^2})$$

$$ \Leftrightarrow y_1y_2 = \frac{b^2}{a^2}(a^2-\frac{2a^2b^2}{a^2+b^2}+ \frac{a^2(b^2-r^2)}{a^2+b^2})$$

$$ \Leftrightarrow y_1y_2 = b^2(1- \frac{2b^2}{a^2+b^2} + \frac{b^2-r^2}{a^2+b^2}) $$

$$ \Rightarrow y_1y_2 = \frac{b^2}{a^2+b^2}(a^2-r^2)$$

So $$(y_1-y_2)^2 = (y_1+y_2)^2-4y_1y_2$$

$$ \Leftrightarrow (y_1-y_2)^2 = \left( 2b(\frac{a^2}{a^2+b^2}) \right)^2 - \frac{4b^2}{a^2+b^2}(a^2-r^2) $$

$$ \Leftrightarrow (y_1-y_2)^2 = 4b^2(\frac{a^4}{(a^2+b^2)^2})- \frac{4b^2}{a^2+b^2}(a^2-r^2) $$

$$ \Leftrightarrow (y_1-y_2)^2 = \frac{4b^2}{a^2+b^2}(\frac{a^4}{a^2+b^2} + r^2-a^2) $$

$$ \therefore (y_1-y_2)^2 = \frac{4b^2}{(a^2+b^2)^2}(r^2a^2+r^2b^2-a^2b^2) $$

So Length of Chord is

$$ L = \sqrt{ (x_1-x_2)^2 + (y_1+y_2)^2}$$

$$L = \sqrt{ \frac{4a^2}{(a^2+b^2)^2} \left( r^2a^2+r^2b^2-a^2b^2\right) + \frac{4b^2}{(a^2+b^2)^2}(r^2a^2+r^2b^2-a^2b^2)}$$

$$ \Leftrightarrow L = \sqrt{ \left(\frac{4}{(a^2+b^2)^2}\right)(r^2a^2+a^2b^2r^2-a^4b^2+r^2a^2b^2+b^2b^4-a^2b^4) } $$

$$ \Leftrightarrow L = \frac{2}{a^2+b^2} \sqrt{2a^2b^2r^2 + r^2a^2-a^4b^2+b^2b^4-a^2b^4 } $$

  • 1
    $\begingroup$ Are there any restrictions on $a$ and $b$ to ensure you get an intersection? $\endgroup$ – Ian Miller Jun 18 '16 at 11:35
  • 1
    $\begingroup$ Draw it. It then becomes easy $\endgroup$ – samerivertwice Jun 18 '16 at 11:45
  • 1
    $\begingroup$ But yes, your method will work. Solve the quadratic for $x$ first and then substitute into your straight line to find the unique $y$ for each $x$, then find the distance. $\endgroup$ – samerivertwice Jun 18 '16 at 11:54
  • $\begingroup$ I've added a new, simpler solution to my answer. $\endgroup$ – PM 2Ring Jun 19 '16 at 5:15

Using Vieta's formula should help.

The distance between the line and the origin is $$\frac{|-ab|}{\sqrt{a^2+b^2}}$$ so, in the following, we may suppose that $$\frac{|-ab|}{\sqrt{a^2+b^2}}\le r.$$ Let $\alpha,\beta$ be the $x$ coordinates of the intersection points.

Then, by Vieta's formula, $$\alpha+\beta=\frac{2ab^2}{a^2+b^2},\quad \alpha\beta=\frac{a^2(b^2-r^2)}{a^2+b^2}$$

Using this, the length is given by $$\begin{align}\sqrt{(\alpha-\beta)^2+\left(\left(b-\frac{b\alpha}{a}\right)-\left(b-\frac{b\beta}{a}\right)\right)^2}&=\sqrt{\left(1+\left(-\frac ba\right)^2\right)(\alpha-\beta)^2}\\&=\sqrt{\frac{a^2+b^2}{a^2}((\alpha+\beta)^2-4\alpha\beta)}\end{align}$$

Therefore, the length is


  • $\begingroup$ Hey thanks for showing me this it really helped, I just wrote up my attempt could you tell me where I went wrong and as to why I did not get the same Length as you.. $\endgroup$ – bigfocalchord Jun 18 '16 at 12:21
  • $\begingroup$ @dydxx: You are almost there. You have an error at the last step. You should have $$L=\sqrt{\left(\frac{4}{a^2+b^2}\right)^2(r^2a^{\color{red}{4}}+a^2b^2r^2-a^4{b^2}+r^2a^2b^2+\color{red}{r^2}b^4-a^2b^4)}$$ $\endgroup$ – mathlove Jun 18 '16 at 12:33
  • $\begingroup$ @dydxx In your working on your second last line you should get a $a^4r^2$ and $b^4r^2$ terms when you multiple in the $a^2$ and $b^2$ parts. $\endgroup$ – Ian Miller Jun 18 '16 at 12:36
  • $\begingroup$ @dydxx: Then, we can write it as $$L=2\sqrt{\frac{(a^4+2a^2b^2+b^4)r^2-a^2b^2(a^2+b^2)}{(a^2+b^2)^2}}.$$ $\endgroup$ – mathlove Jun 18 '16 at 12:54
  • $\begingroup$ @dydxx: Sorry, I just found an error in my first comment. I wanted to write $$L=\sqrt{\frac{4}{(a^2+b^2)^2}(r^2a^4+a^2b^2r^2-a^4b^2+r^2a^2b^2+r^2b^4-a^2b^4)}$$ $\endgroup$ – mathlove Jun 18 '16 at 12:57

As Robert Frost's hint suggests, there's a simple geometric solution.

$$\frac{x}{a} + \frac{y}{b}= 1$$

is the intercept form of the equation of a line, i.e., the X & Y intercepts of the line are $a$ and $b$, respectively. Let $c$ be the length of the line segment between the intercept points. This segment is the hypotenuse of a right triangle, so

$$c^2 = a^2 + b^2$$

Let $h$ be the altitude of that triangle, i.e., the perpendicular distance from the origin $O$ to the line. Clearly,

$$hc = ab$$

because $hc$ and $ab$ are both twice the area of that right triangle.

so $$h^2 = \left(\frac{ab}{c}\right)^2 = \frac{a^2b^2}{a^2+b^2}$$

Let $P_0$ and $P_1$ be the points where the line cuts the circle $x^2 + y^2 = r^2$. The triangle $OP_0P_1$ is isosceles since the lengths $OP_0 = OP_1 = r$, and its altitude is $h$. The base of this isosceles triangle is the desired chord. Let $d$ be the length of the chord. By Pythagoras' theorem:

$$\begin{align} \left(\frac{d}{2}\right)^2 & = r^2 - h^2\\ & = r^2 - \frac{a^2b^2}{a^2+b^2} \end{align}$$

Thus $$d = 2\sqrt{r^2 - \frac{a^2b^2}{a^2+b^2}}$$

I have created an SVG diagram for this problem but unfortunately this site doesn't support SVG (AFAICT), so here's a PNG version.

circle and chord

$Y$ and $X$ are the intercepts, $P_0P_1$ is the desired chord, $OQ$ is perpendicular to $P_0P_1$.


Solving these two simultaneously gives me:

$$x=\frac{a(b^2\pm \sqrt{r^2(a^2+b^2)-b^2})}{a^2+b^2}$$

$$y=\frac{b(a^2\pm \sqrt{r^2(a^2+b^2)-a^2})}{a^2+b^2}$$

To find the chord length we can find $\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$.

This gives:




Also because I didn't read the question properly you could also find the arc length consider the dot product of the two vectors:

$x_1 x_2+y_1 y_2=r^2\cos\theta$


This simplifies easily due to $(x+y)(x-y)=x^2-y^2$





  • 1
    $\begingroup$ The OP wants the chord length, not the arc length. $\endgroup$ – PM 2Ring Jun 18 '16 at 12:15
  • $\begingroup$ Oh shoot. And I thought it was such an elegant solution. $\endgroup$ – Ian Miller Jun 18 '16 at 12:26

Here's a slightly different way. Rather than messing around with $x$ and $y$ we express the equation of the line in parametric form and work with the parameter $t$.

The equation of the line is given in intercept form, i.e., the line passes through $(0, b)$ and $(a, 0)$. We can easily change it to parametric form:

$$x = at, \, y = b(1 - t)$$

where $t = 0$ maps to $(0, b)$ and $t = 1$ maps to $(a, 0)$.

The distance between 2 points $t_0$ and $t_1$ is

$$\begin{align} d & = \sqrt{(x_1-x_0)^2 + (y_1-y_0)^2}\\ & = \sqrt{a^2(t_1-t_0)^2 + b^2((1-t_1) - (1-t_0))^2}\\ & = \sqrt{(a^2 + b^2)(t_1-t_0)^2}\\ d & = \sqrt{a^2 + b^2}|t_1-t_0|\\ \end{align}$$

Thus we can get the chord length from a nice linear equation of the parameters of the intersection points without having to calculate $x$ and $y$.

To find those parameters we substitute the parametric equations for $x$ and $y$ into the equation of the circle:

$$ a^2t^2 + b^2(1-t)^2 = r^2\\ a^2t^2 + b^2 -2b^2t + b^2t^2 = r^2\\ (a^2 + b^2)t^2 -2b^2t + (b^2 - r^2) = 0\\ $$

Now the solutions of the general quadratic $At^2 + Bt + C = 0$ are given by $$ t = \frac{-B \pm\sqrt{B^2 - 4AC}}{2A}$$ so the absolute difference of the two solutions is $$|t_1-t_0| = \frac{\sqrt{B^2 - 4AC}}{A}$$

Thus $$\begin{align} d & = \sqrt{a^2 + b^2}\left(\frac{\sqrt{(-2b^2)^2 - 4(a^2 + b^2)(b^2 - r^2)}}{a^2 + b^2}\right)\\ & = \frac{\sqrt{4b^4 - 4(a^2 + b^2)(b^2 - r^2)}}{\sqrt{a^2 + b^2}}\\ & = 2\sqrt{\frac{b^4 - a^2b^2 + a^2r^2 - b^4 + b^2r^2}{a^2 + b^2}}\\ & = 2\sqrt{\frac{a^2r^2 + b^2r^2 - a^2b^2}{a^2 + b^2}}\\ d & = 2\sqrt{r^2 - \frac{a^2b^2}{a^2 + b^2}}\\ \end{align}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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