Chaitanya's Random Pages

September 13, 2011

Philo’s line: the shortest line segment through a given point in a given angle

Filed under: mathematics — ckrao @ 10:02 pm

In this post we look at the following problem:

Given a point P in a given angle of size {\theta} formed by two lines, what is the shortest length d of a segment MN passing through P with M and N on each line?

I found out recently that such a line is called Philo’s line and the problem of finding the shortest segment is more tricky than one first suspects. It is named after Philo of Byzantium who lived in the 3rd century BC. Had I known it was as tricky to begin with I may not have spent as long investigating it! It was certainly worthwhile though and I encountered a fun mix of calculus, geometry and algebra (polynomials) on the way which I show here.

We can specify the point P in more that one way – for example by its distances to the two sides (a,b), or by the lengths OE, OF (e,f) as shown in the following figure.

The two pairs are related by the equations

\displaystyle e = \frac{a + b \cos \theta}{\sin \theta}, f = \frac{b + a \cos \theta}{\sin \theta}

\displaystyle a = \frac{e - f \cos \theta}{\sin \theta}, b = \frac{f - e \cos \theta}{\sin \theta}

We shall work with a and b with the knowledge that if we need to use e and f, they are simply related to a and b by linear transformations. Note that it is possible for e or f to be negative if \theta > 90^{\circ}.

In the symmetric case of a=b, we can say that for any angle \theta, P will be on the angle bisector of the angle and Philo’s line will be perpendicular to OP by symmetry. In this case, we find by simple trigonometry m = 2a/\sin \theta and so by the cosine rule,

\displaystyle d^2 = m^2 + m^2 - 2m^2\cos \theta = \frac{8a^2(1 - \cos \theta )}{\sin^2 \theta}.\quad \quad (1)

(We can also write the simpler expression d = 2a/\cos (\theta/2) but above form is handier for future reference!)

In the case when a\neq b and \theta = 90^{\circ}, one may think that Philo’s line is that which makes MO = ON, but this is not the case. Take the example of a = 8, b = 1:

The equivalent formulation is this: what is the shortest line segment through the point (8,1) lying in the first quadrant? This is equivalent to the “ladder around a corner” problem that I discussed in an earlier post. The shortest line segment through (8,1) is also the longest ladder that can fit in a corridor with perpendicular corner  bound by the axes and with inside corner at (8,1).

As found in that post, the optimal line has intercepts (a + a^{1/3}b^{2/3}, 0) and (0, b + a^{2/3}b^{1/3}). The resulting squared distance is

\displaystyle d^2 = (a^{2/3} + b^{2/3})^3. \quad \quad (2)

Shown here is this line in the case (a,b) = (8,1) and how it differs from the symmetric line keeping OM = MN. We see that Philo’s line (in red) has length 5\sqrt{5} = \sqrt{125} while the symmetric line has the much greater length 9\sqrt{2} = \sqrt{162}.

This is an instance where our intuition may defy us. In general it is very difficult to identify Philo’s line unless we have an alternative way of characterising it. That is, we need a way of constructing it, or to find other properties that the line satisfies. The above expressions for the intercepts cannot be constructed with compass and straight edge for general a and b since they involve cube roots. In fact Philo was motivated by this problem while working on the classical problem of doubling the cube (equivalently, constructing the cube root of 2) [1, 2]. It was only shown in the 19th century that such a construction with compass and straight edge is impossible so the problem eluded mathematicians for more than two millenia! Even Newton worked on the problem of constructing Philo’s line by compass and straight edge [3].

We will now turn to the general case of an arbitrary angle \theta and use calculus to find the minimum distance in terms of the roots of a cubic polynomial. On the way we will see a few interesting equivalent characterisations of the line. The special case of \theta = 90^{\circ} was solved in an earlier post using Hölder’s inequality without the need for calculus.

Main result

This post will prove the following.

Given two lines intersecting in an angle \theta and a point P with distances a and b to the two lines, the squared length of Philo’s line, the shortest line segment through P and joining the two lines, is given by

\displaystyle d^2 = \frac{1}{\sin^2 \theta}\left[3x^2 - \frac{a^2b^2}{x^2} + 4(a - b \cos \theta )x + a^2 + b^2 - 4ab \cos \theta\right], \quad \quad (3)

where x is the positive root satisfying the cubic equation

\displaystyle x^3 - (b \cos \theta)x^2 + (ab \cos \theta)x - ab^2 = 0.\quad \quad (4)

Before proving this, let us check to see what happens in the special cases we saw earlier. In the case a=b, the cubic (4) becomes

\displaystyle x^3 - (a \cos \theta )x^2 + a^2 \cos \theta - a^3 = (x-a) (x^2 + a(1 - \cos \theta )x + a^2) = 0.

The quadratic factor has only complex roots, and so we have the unique real solution x = a. This leads to

\begin{array} {lcl} d^2 &=& \frac{1}{\sin^2 \theta } \left[ 3x^2 - \frac{a^2b^2}{x^2} + 4(a - b \cos \theta )x + a^2 + b^2 - 4ab \cos \theta\right]\\&=& \frac{1}{\sin^2 \theta} \left[ 3a^2 - \frac{a^2.a^2}{a^2} + 4(a - a \cos \theta ) a + a^2 + a^2 - 4a^2 \cos \theta \right] \\&=& \frac{1}{\sin^2 \theta } \left[ 3a^2 - a^2 + 4a^2 - 4a^2 \cos \theta + a^2 + a^2 - 4a^2 \cos \theta \right] \\ &=& \frac{8a^2(1-\cos \theta )}{\sin^2 \theta}, \end{array}

matching with (1).

In the other special case \theta = 90^{\circ}, the cubic becomes

\displaystyle x^3 - (b \cos \theta)x^2 + (ab \cos \theta)x - ab^2 = x^3 - ab^2 = 0,

giving us x = a^{1/3}b^{2/3} as the unique real solution. Substituting this into (3) we obtain (2):

\begin{array}{lcl} d^2 &=& \frac{1}{\sin^2 \theta }\left[ 3x^2 - \frac{a^2 b^2}{x^2} + 4(a - b\cos \theta )x + a^2 + b^2 - 4ab \cos \theta \right]\\ &=& \frac{1}{1}\left[ 3(a^{1/3}b^{2/3})^2 - \frac{a^2b^2}{(a^{1/3}b^{2/3})^2} + 4a.a^{1/3}b^{2/3} + a^2 + b^2\right]\\ &=& 3a^{2/3} b^{4/3} - a^{4/3}b^{2/3} + 4a^{4/3}b^{2/3} + a^2 + b^2\\ &=& \left( a^{2/3} + b^{2/3} \right)^3. \end{array}

Hence both earlier results are verified. Isn’t it interesting how the cubic yields such different looking solutions? 🙂

Finding equivalent characterisations

I will firstly show my initial approach leading to a couple of known characterisations of the problem. Then I will present a second approach leading to the above result.

Let \alpha be the angle between the shortest line and the line ON (0 < \alpha < \pi - \theta). Let \beta be the angle between the shortest line and the line OM. Observe that \alpha + \beta +\theta = \pi.

The distance to be minimised is \displaystyle d(\alpha) = \frac{a}{\sin \alpha} + \frac{b}{\sin(\alpha + \theta)} where 0 < \alpha < \pi - \theta.

Setting d'(\alpha) to 0 gives

\displaystyle -\frac{a \cos \alpha}{\sin^2 \alpha} - \frac{b \cos (\alpha + \theta)}{\sin^2 (\alpha + \theta)} = 0.

From this,

\displaystyle \frac{b}{a} = \frac{-\sin^2 (\alpha + \theta) \cos \alpha}{\sin^2 \alpha \cos (\alpha + \theta)} = \frac{\sin^2 \beta \cos \alpha}{\sin^2 \alpha \cos \beta},\quad \quad (5)

where \alpha + \beta +\theta = \pi. Neither of the boundary conditions \alpha =0 or \alpha = \pi will lead to the solution (for a, b > 0), so the minimum d will occur when (5) is satisfied.

Let D be the foot of the altitude from O to MN (refer to next figure below). Then we also have

\displaystyle \frac{\sin^2 \beta \cos \alpha}{\sin^2 \alpha \cos \beta} = \frac{ (OD/OM) (ND/ON) \sin \beta}{ (OD/ON)(MD/OM)\sin \alpha} = \frac{ND \sin \beta}{MD \sin \alpha}, \quad \quad (6)


\displaystyle \frac{b}{a} = \frac{MP \sin \beta}{NP \sin \alpha}. \quad \quad (7)

Combining (5), (6) and (7) it follows that P must satisfy ND/MD = MP/NP, from which MD = NP. That is, Philo’s line is chosen so that P is the isotomic conjugate of the foot of the altitude from O to MN. This is possibly the most commonly known characterisation of Philo’s line as presented in [1].

A second characterisation is that the intercepts M and N of Philo’s line with the two lines of the given angle are equidistant to the point Q which is the midpoint of OP. Equivalently, Q is on the perpendicular bisector of Philo’s line.

The following figure shows these two characterisations.

In our earlier 90 degree example of P at (8,1) the intercepts (10, 0) and (0,5) are equidistant from Q(4,0.5).

I also played with other equivalent formulations of the condition (5) and came up with the following figures in an attempt to find \alpha and \beta given a, b and \theta.

1) A maps to B and B maps to A under inversion in each circle illustrated below, where \theta is the angle between the tangents shown.

2) The following dual figure can be constructed:

3) In this construction, unlike the previous two, one can at least draw part of the figure with the known information. Start with a triangle OAB with lengths a, b and included angle \pi - \theta and construct rays from O perpendicular to OA and OB. Then we wish to construct points C and D on these rays so that the red lines shown form 90-degree angles.

These equivalent characterisations may look interesting, but they still do not tell us the length of the line! I had to adopt a different tactic.

Proof of result using Lagrange multipliers

The approach that leads one to the cubic (4) is by solving the following optimisation problem through Lagrange multipliers. Let OM = m, ON = n. Then by the cosine rule, \displaystyle d^2 = m^2 + n^2 - 2mn \cos \theta. The condition that P is on MN is equivalent to the condition that the areas of triangles OMP and ONP add to OMN, or mb + na = mn \sin \theta (equivalently, a/m + b/n = \sin \theta). Hence we state our optimisation problem as

\displaystyle \max m^2 + n^2 - 2mn \cos \theta \quad \text{ s.t. }\quad mb + na = mn \sin \theta.

To solve this, we form the Lagrangian L(m,n,\lambda) = m^2 + n^2 - 2mn \cos \theta - \lambda(mb + na - mn \sin \theta) and set its partial derivatives \partial L/\partial m and \partial L/\partial n to 0:

\displaystyle 2m - 2n \cos \theta - \lambda(b - n \sin \theta) = 0
\displaystyle 2n - 2m \cos \theta - \lambda(n - m \sin \theta) = 0

This gives us

\displaystyle \frac{m - n\cos \theta}{b - n\sin \theta} = \frac{n - m \cos \theta}{a - m \sin \theta} \Rightarrow \frac{b - n\sin \theta}{a - m \sin \theta} = \frac{m - n\cos \theta}{n - m \cos \theta}.\quad \quad (8)

At this point we make the substitution m = \frac{a + x}{\sin \theta}, n = \frac{b + y}{\sin \theta}. This is motivated by the simpler cases considered earlier: geometrically x and y are as shown below and they have more manageable forms in those simpler cases.

We also find that the constraint mb + na = mn \sin \theta or a/m + b/n = \sin \theta becomes

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

Ordinarily one might be satisfied with such a condition, but further simplification is possible!

\begin{array}{rcl} \frac{a}{a+x} &=& 1 - \frac{b}{b+y}\\ &=& \frac{y}{b+y}\\ \Leftrightarrow \frac{x+a}{a} &=& \frac{b+y}{y} \\ \Leftrightarrow\ \frac{x}{a} &=& \frac{b}{y} \\ \Leftrightarrow\ xy &=& ab \end{array}

Cool! I never would have thought that \frac{a}{a+x} + \frac{b}{b+y} = 1 is equivalent to xy = ab. 🙂

The equations m = \frac{a + x}{\sin \theta}, n = \frac{b + y}{\sin \theta} give x= m\sin \theta - a, y = n \sin \theta - b and so (8) under this subsitution for m and n becomes

\begin{array}{lcl} \frac{y}{x} &=& \frac{m - n\cos \theta}{n - m \cos \theta}\\ &=& \frac{(a+x)/\sin \theta - (b+y)\cos \theta /\sin \theta }{(b + y)/\sin \theta - (a + x)\cos \theta/\sin \theta }\\ &=& \frac{x + a - b\cos \theta + y \cos \theta}{y + b - a \cos \theta + x\cos \theta} \\ &=& \frac{x + a - b\cos \theta}{y + b - a \cos \theta} \quad \text{(by addendo).}\end{array}

Substituting y = ab/x into this equation gives us ab/x^2 = (x + a - b\cos \theta)/(ab/x + b - a\cos \theta), which is equivalent to the following quartic equation (for x \neq 0).

\displaystyle x^4 + (a - b\cos \theta)x^3 - ab(b - a\cos \theta)x - a^2b^2 = 0 \quad \quad (9)

This quartic has a factor (x+a) (found with help from Wolfram|Alpha) and cancelling this factor from both sides gives us our cubic (4):

\displaystyle x^3 - (b \cos \theta)x^2 + (ab \cos \theta)x - ab^2 = 0.

In terms of x, the length of Philo’s line is given by

\begin{array}{lcl} d^2 &=& m^2 + n^2 - 2mn \cos \theta \\ &=& \frac{1}{\sin^2 \theta} \left[ (a + x)^2 + (b+y)^2 -2(a+x)(b+y) \cos \theta \right]\\ &=& \frac{1}{\sin^2 \theta} \left[ x^2 + y^2 - 2(ab + xy)\cos \theta + 2(ax +by) - 2(bx + ay)\cos \theta + a^2 + b^2 \right] \\&=& \frac{1}{\sin^2 \theta} \left[ x^2 + (ab/x)^2 - 4ab \cos \theta + 2(ax + ab^2/x) - 2(bx + a^2b/x) \cos \theta + a^2 + b^2 \right]\\ &=& \frac{1}{\sin^2 \theta} \left[ x^2 + (ab/x)^2 +2\left( (a - b\cos \theta)x+ (b - a\cos \theta)ab/x\right) + a^2 + b^2 - 4ab \cos \theta\right]. \quad \quad (10)\end{array}

Some simplification here is possible by using the quartic form (9), which gives us \displaystyle (ab/x)^2 + 2(b- a \cos \theta)ab/x = 2 x^2 + 2(a-b\cos \theta)x - (ab/x)^2. Subsituting this into (10) gives our desired form (3):

\displaystyle d^2 = \frac{1}{\sin^2 \theta}\left[3x^2 - \frac{a^2b^2}{x^2} + 4(a - b \cos \theta )x + a^2 + b^2 - 4ab \cos \theta\right].

Finally we show why there is only one positive root of the cubic (4). There is an easier approach than evaluating the cubic’s discriminant. Let \displaystyle f(x) = x^3 - (b \cos \theta)x^2 + (ab \cos \theta)x - ab^2. Since f(0) = -ab^2 < 0, there is either one positive root or three (Imagine a graph of the positive cubic – by the intermediate value theorem it crosses the x axis at some positive x value. Here we are counting repeated roots more than once). Suppose there are three positive roots 0 < r_1 \leq r_2 \leq r_3. We now seek a contradiction.

The relationship f(x) = (x-r_1)(x-r_2)(x-r_3) leads to r_1 + r_2 + r_3 = b \cos \theta and \displaystyle 1/r_1 + 1/r_2 + 1/r_3 = (r_1r_2 + r_2r_3 + r_1r3)/r_1r_2r_3 = (ab \cos \theta)/(ab^2) = \frac{\cos \theta}{b}. Multiplying these two equations together gives

\displaystyle (r_1 + r_2 + r_3)(1/r_1 + 1/r_2 + 1/r_3) = \cos^2 \theta \leq 1.

But this contradicts the left side being at least 3 (in fact it is at least 9). We conclude that the three roots cannot all be positive (even including multiplicity), and so there is only one positive root.

Finally here are a few more cases where a nice solution is found from specific values of a, b and \theta:

  • a = 4, b = 108/13, \cos \theta = 33/65 leads to x=36/5 , d=14 (drawing the figure gives a 13-14-15 triangle)
  • a = 18, b = 2, \theta = 60^{\circ} leads to x=3 , d^2\sin^2 \theta = 343
  • a = 48/17, b = 12, \cos \theta = -13/85 leads to x=120/17 , d=21 (drawing the figure gives a 10-17-21 triangle)
  • a = 18, b = 2, \cos \theta = 1/4 leads to x=3 , d^2 \sin^2 \theta = 160

For more about Philo’s line see the references below. In particular, a Euclidean (non-calculus) proof of why Philo’s line is characterised by P being the isotomic conjugate of the foot of the altitude from O is given in p198 of [4]. According to one of the links from [3], Newton found a characterisation in the more general case when the lines OM and ON are curves and the shortest line segment is required to be tangent to a given curve – it involves the concurrency of three normals to the curves.


[1] Wikipedia – Philo Line

[2] Philon’s line

[3] The Philon’s Line

[4] Project Gutenberg’s First Six Books of the Elements of Euclid, by John Casey. Available at

[5] Philon Line–minimal length proof? – Yahoo! Answers

[6] Weisstein, Eric W. “Philo Line.” From MathWorld–A Wolfram Web Resource.

1 Comment »

  1. […] previous post was inspired by the following problem I found at the geometry problems […]

    Pingback by The shortest broken line of fixed angle joining three parallel lines « Chaitanya's Random Pages — September 17, 2011 @ 8:10 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at

%d bloggers like this: