Skip to content
Family Table Math
Auto

Voronoi Diagrams

Which fire station is closest to your house? Which weather station’s rainfall reading best describes your farm? A Voronoi diagram answers questions like these at a glance: it splits a map into regions, one around each important point, so that every location belongs to the point nearest to it. Voronoi diagrams are used in urban planning, ecology, meteorology and the study of how diseases spread, and they’re built entirely from perpendicular bisectors.

  • Sites are the given points (towns, schools, weather stations).
  • Each site has a cell: the region of all points closer to that site than to any other site.
  • An edge is a boundary between two neighbouring cells. Every point on the edge between sites AA and BB is the same distance from AA as from BB.
  • A vertex is a point where three (or more) edges meet. It is the same distance from three sites.
A Voronoi diagram in the rectangle from (0, 0) to (12, 10) with sites A(2, 8), B(4, 2), C(10, 2) and D(10, 8). Edges: x = 6 above (6, 6) between A and D; y = x/3 + 4 from (0, 4) to (6, 6) between A and B; y = -x + 12 from (6, 6) to (7, 5) between B and D; x = 7 below (7, 5) between B and C; and y = 5 right of (7, 5) between C and D. The vertices (6, 6) and (7, 5) are marked, and the point P(8, 3) lies in the cell of C. 2 4 6 8 10 2 4 6 8 A B C D (6, 6) (7, 5) P
A Voronoi diagram with four sites. The two vertices are (6,6)(6, 6) and (7,5)(7, 5); the point P(8,3)P(8, 3) is in the cell of CC.

Edges are pieces of perpendicular bisectors

Section titled “Edges are pieces of perpendicular bisectors”

All the points equally far from AA and BB form the perpendicular bisector of ABAB. So the edge between two neighbouring cells is part of that bisector. To find its equation:

  1. Find the midpoint of the two sites.
  2. Find the gradient of the segment joining them, and take the negative reciprocal.
  3. Write the equation of the line through the midpoint with that gradient.

An edge usually stops at a vertex, where a third site becomes just as close. A vertex is where two edges cross, so you find it by solving the two edge equations simultaneously. It’s equidistant from its three sites (it’s the circumcentre of their triangle), which gives a good check.

In IB exams, the coordinates of the sites are given, and you won’t have to construct perpendicular bisectors with a compass. Questions may ask for the equation of an edge, the site closest to a given point, or the area of a cell.

To add a new site to an existing diagram:

  1. Find the cell the new site lands in. Draw the perpendicular bisector between the new site and that cell’s site, inside that cell, until it meets an edge.
  2. At that edge you cross into a neighbouring cell. Draw the bisector between the new site and that cell’s site, and keep going.
  3. Continue around until you’re back where you started (or reach the boundary of the region).
  4. Erase the old edges that are now inside the new cell.

The new cell takes area from its neighbours; cells that aren’t next to it don’t change.

If each site has a measured value (rainfall, temperature, pollution level), you can estimate the value anywhere else by using the value of the nearest site. In other words, every point in a cell is given the same value as its site. This is called nearest-neighbour interpolation. It’s quick and simple, though it jumps suddenly at each edge.

Suppose something unpleasant (a toxic waste dump, a noisy airport) must be built inside a region, as far as possible from the nearest site. Inside a cell, you can always get further from the site by moving away from it, so the best point is never in the middle of a cell. Along an edge, the distance to the two sites is smallest at their midpoint and grows as you move away, so the farthest point on an edge is at one of its ends. That’s why the best location is at a vertex of the Voronoi diagram. To solve it:

  1. List the vertices inside the region.
  2. For each vertex, find its distance to one of its three sites (all three are equal).
  3. Choose the vertex with the largest distance.

In general the boundary of the region (for example, its corners) can also need checking, but in IB exams the solution is always at a vertex where three edges meet.

All the examples use the diagram above. The sites are towns, A(2,8)A(2, 8), B(4,2)B(4, 2), C(10,2)C(10, 2) and D(10,8)D(10, 8), in a region from (0,0)(0, 0) to (12,10)(12, 10), with units in kilometres.

The yearly rainfall measured at the four towns is AA: 620620 mm, BB: 540540 mm, CC: 480480 mm, DD: 700700 mm. Use nearest-neighbour interpolation to estimate the yearly rainfall at a farm at P(8,3)P(8, 3).

Solution. The diagram shows PP in the cell of CC. To confirm, compare the squared distances from PP:

SiteAABBCCDD
Squared distance to PP62+52=616^2 + 5^2 = 6142+12=174^2 + 1^2 = 1722+12=52^2 + 1^2 = 522+52=292^2 + 5^2 = 29

CC is nearest, so the estimated rainfall at the farm is 480480 mm.

Example 2: The equation of an edge and a vertex

Section titled “Example 2: The equation of an edge and a vertex”
  • (a) Find the equation of the edge between the cells of AA and BB.
  • (b) The edge between AA and DD lies on the line x=6x = 6. Find the vertex where these two edges meet, and check that it is equidistant from AA, BB and DD.

Solution. (a) The midpoint of ABAB is (2+42,8+22)=(3,5)\left(\dfrac{2 + 4}{2}, \dfrac{8 + 2}{2}\right) = (3, 5). The gradient of ABAB is 2−84−2=−3\dfrac{2 - 8}{4 - 2} = -3, so the perpendicular gradient is 13\dfrac{1}{3}:

y−5=13(x−3)⇒y=13x+4y - 5 = \frac{1}{3}(x - 3) \quad\Rightarrow\quad y = \frac{1}{3}x + 4

(b) Substitute x=6x = 6: y=13(6)+4=6y = \dfrac{1}{3}(6) + 4 = 6. The vertex is (6,6)(6, 6).

Check the distances from (6,6)(6, 6):

to A:42+22=20to B:22+42=20to D:42+22=20\text{to } A: \sqrt{4^2 + 2^2} = \sqrt{20} \qquad \text{to } B: \sqrt{2^2 + 4^2} = \sqrt{20} \qquad \text{to } D: \sqrt{4^2 + 2^2} = \sqrt{20}

All three are equal. ✓

A toxic waste dump is to be built in the region, as far as possible from the nearest town. Find its location and its distance from the nearest town.

Solution. The vertices are (6,6)(6, 6) and (7,5)(7, 5).

  • (6,6)(6, 6) is 20≈4.47\sqrt{20} \approx 4.47 km from each of AA, BB and DD (Example 2).
  • (7,5)(7, 5) is on the edges between BB, CC and DD: its distance to BB is 32+32=18≈4.24\sqrt{3^2 + 3^2} = \sqrt{18} \approx 4.24 km (and the same to CC and DD).

The larger distance is at (6,6)(6, 6). Among the vertices, the best site for the dump is (6,6)(6, 6), which is 20≈4.47\sqrt{20} \approx 4.47 km from the nearest towns (AA, BB and DD). (In this particular region, a few boundary points happen to be equally far from their nearest town: the corner (0,0)(0, 0) and the points where edges meet the border at (0,4)(0, 4) and (6,10)(6, 10) are also 20\sqrt{20} km away. Exam questions are set up so that the answer is a single vertex.)

A new town EE is founded at (6,4)(6, 4). It lands in the cell of BB, and its new cell will border the cells of all four towns, so its edges lie on the perpendicular bisectors of AEAE, BEBE, CECE and DEDE.

  • (a) Find the equations of these four bisectors.
  • (b) Find the vertices of the new cell of EE, and its area.

Solution. (a) Use midpoint and perpendicular gradient each time:

PairMidpointGradient of segmentBisector
A(2,8)A(2, 8), E(6,4)E(6, 4)(4,6)(4, 6)−1-1y=x+2y = x + 2
B(4,2)B(4, 2), E(6,4)E(6, 4)(5,3)(5, 3)11y=−x+8y = -x + 8
C(10,2)C(10, 2), E(6,4)E(6, 4)(8,3)(8, 3)−12-\frac{1}{2}y=2x−13y = 2x - 13
D(10,8)D(10, 8), E(6,4)E(6, 4)(8,6)(8, 6)11y=−x+14y = -x + 14

(b) Neighbouring bisectors meet at the new vertices:

x+2=−x+8⇒(3,5)(sites A,B,E)−x+8=2x−13⇒(7,1)(sites B,C,E)2x−13=−x+14⇒(9,5)(sites C,D,E)−x+14=x+2⇒(6,8)(sites A,D,E)\begin{aligned} x + 2 = -x + 8 &\quad\Rightarrow\quad (3, 5) && \text{(sites } A, B, E\text{)} \\ -x + 8 = 2x - 13 &\quad\Rightarrow\quad (7, 1) && \text{(sites } B, C, E\text{)} \\ 2x - 13 = -x + 14 &\quad\Rightarrow\quad (9, 5) && \text{(sites } C, D, E\text{)} \\ -x + 14 = x + 2 &\quad\Rightarrow\quad (6, 8) && \text{(sites } A, D, E\text{)} \end{aligned}

Each new vertex lies on an old edge. For example, (3,5)(3, 5) is on y=13x+4y = \frac{1}{3}x + 4. The old edges inside the new cell (including both old vertices) are erased.

The Voronoi diagram after adding site E(6, 4). The new cell of E is a shaded quadrilateral with vertices (6, 8), (3, 5), (7, 1) and (9, 5). The old edges inside it, which have been removed, are shown dashed. 2 4 6 8 10 2 4 6 8 A B C D E (6, 8) (3, 5) (7, 1) (9, 5)
After adding E(6,4)E(6, 4), its cell (shaded) has vertices (6,8)(6, 8), (3,5)(3, 5), (7,1)(7, 1) and (9,5)(9, 5). The dashed old edges are removed.

For the area, split the cell along the horizontal diagonal from (3,5)(3, 5) to (9,5)(9, 5), which has length 66. The top triangle reaches up to (6,8)(6, 8), a height of 33; the bottom triangle reaches down to (7,1)(7, 1), a height of 44:

Area=12(6)(3)+12(6)(4)=9+12=21 km2\text{Area} = \frac{1}{2}(6)(3) + \frac{1}{2}(6)(4) = 9 + 12 = 21 \text{ km}^2

Joining the sites instead of bisecting them. Edges are perpendicular to the segment between two sites, through its midpoint. The segment ABAB itself is not part of the diagram.

Using the gradient of the segment for the edge. The edge’s gradient is the negative reciprocal. In Example 2, ABAB has gradient −3-3, so the edge has gradient 13\dfrac{1}{3}, not −3-3 or 33.

Drawing bisectors between sites that aren’t neighbours. Only cells that share a boundary have an edge between them. In the diagram above, AA and CC have no common edge, so their bisector isn’t used.

Forgetting to erase old edges when adding a site. After adding EE in Example 4, the old vertices (6,6)(6, 6) and (7,5)(7, 5) are inside EE‘s cell and are no longer vertices. Any answer that still uses them (for example, for a new dump location) is out of date.

Choosing the smallest distance in the toxic waste problem. You want the vertex farthest from its nearest sites. Compute the distance from each vertex to one of its three sites, then pick the largest.

Deciding the nearest site by eye. Points near an edge are easy to misjudge. Compare (squared) distances, as in Example 1, or substitute into the edge equation to see which side the point is on.

1. (Warm-up) Use the four-site diagram (sites A(2,8)A(2, 8), B(4,2)B(4, 2), C(10,2)C(10, 2), D(10,8)D(10, 8)).

  • (a) Which sites share an edge with BB?
  • (b) Which site is nearest to Q(2,5)Q(2, 5)? Show working.
Solution

(a) AA, CC and DD. (The cell of BB touches all three.)

(b) QQ is close to the edge between AA and BB, so compare squared distances: to AA: 02+32=90^2 + 3^2 = 9; to BB: 22+32=132^2 + 3^2 = 13. CC and DD are much further (7373 each). The nearest site is AA.

Another way: on the edge y=13x+4y = \frac{1}{3}x + 4, at x=2x = 2 we have y≈4.67y \approx 4.67. QQ is above the edge, on AA‘s side.

2. (Warm-up) Find the equation of the perpendicular bisector of the sites P(1,3)P(1, 3) and Q(5,1)Q(5, 1).

Solution

Midpoint: (3,2)(3, 2). Gradient of PQPQ: 1−35−1=−12\dfrac{1 - 3}{5 - 1} = -\dfrac{1}{2}, so the perpendicular gradient is 22.

y−2=2(x−3)⇒y=2x−4y - 2 = 2(x - 3) \quad\Rightarrow\quad y = 2x - 4

3. (Core) Three sites are X(0,0)X(0, 0), Y(8,0)Y(8, 0) and Z(0,6)Z(0, 6).

  • (a) Find the equations of the perpendicular bisectors of XYXY, XZXZ and YZYZ.
  • (b) Find the vertex of the Voronoi diagram, and show it is equidistant from all three sites.
Solution

(a) XYXY is horizontal with midpoint (4,0)(4, 0), so its bisector is x=4x = 4. XZXZ is vertical with midpoint (0,3)(0, 3), so its bisector is y=3y = 3. YZYZ has midpoint (4,3)(4, 3) and gradient 6−00−8=−34\dfrac{6 - 0}{0 - 8} = -\dfrac{3}{4}, so the perpendicular gradient is 43\dfrac{4}{3}:

y−3=43(x−4)⇒y=43x−73y - 3 = \frac{4}{3}(x - 4) \quad\Rightarrow\quad y = \frac{4}{3}x - \frac{7}{3}

(b) x=4x = 4 and y=3y = 3 meet at (4,3)(4, 3), which also satisfies the third equation: 43(4)−73=3\frac{4}{3}(4) - \frac{7}{3} = 3. ✓

Distances: to XX: 42+32=5\sqrt{4^2 + 3^2} = 5; to YY: 42+32=5\sqrt{4^2 + 3^2} = 5; to ZZ: 42+32=5\sqrt{4^2 + 3^2} = 5.

4. (Core) The four towns in the worked examples have weather stations recording these temperatures one afternoon: AA: 14∘C14^\circ\text{C}, BB: 17∘C17^\circ\text{C}, CC: 19∘C19^\circ\text{C}, DD: 15∘C15^\circ\text{C}. Use nearest-neighbour interpolation to estimate the temperature at (a) (5,7)(5, 7) and (b) (9,6)(9, 6).

Solution

(a) Squared distances from (5,7)(5, 7): AA: 9+1=109 + 1 = 10, BB: 1+25=261 + 25 = 26, CC: 25+25=5025 + 25 = 50, DD: 25+1=2625 + 1 = 26. Nearest is AA, so the estimate is 14∘C14^\circ\text{C}.

(b) Squared distances from (9,6)(9, 6): AA: 49+4=5349 + 4 = 53, BB: 25+16=4125 + 16 = 41, CC: 1+16=171 + 16 = 17, DD: 1+4=51 + 4 = 5. Nearest is DD, so the estimate is 15∘C15^\circ\text{C}.

5. (Core) In the four-site diagram (before EE is added), find the area of (a) the cell of CC and (b) the cell of AA.

Solution

(a) The cell of CC is bounded by x=7x = 7, y=5y = 5 and the region’s edges x=12x = 12 and y=0y = 0: a 5×55 \times 5 square, with area 25 km225 \text{ km}^2.

(b) The cell of AA has vertices (0,4)(0, 4), (6,6)(6, 6), (6,10)(6, 10) and (0,10)(0, 10). It’s a trapezium with parallel vertical sides of length 10−4=610 - 4 = 6 (on x=0x = 0) and 10−6=410 - 6 = 4 (on x=6x = 6), a distance 66 apart:

Area=6+42×6=30 km2\text{Area} = \frac{6 + 4}{2} \times 6 = 30 \text{ km}^2

6. (Core) Four wells are at P(1,1)P(1, 1), Q(7,1)Q(7, 1), R(7,9)R(7, 9) and S(11,5)S(11, 5) in a region from (0,0)(0, 0) to (12,10)(12, 10) (units in km). In the Voronoi diagram, the cell of PP borders the cells of QQ and RR, and the cell of SS borders the cells of QQ and RR.

  • (a) Find the equation of the edge between PP and RR.
  • (b) Find the equation of the edge between QQ and SS.
  • (c) The edge between PP and QQ is x=4x = 4 and the edge between QQ and RR is y=5y = 5. Find the vertex where the cells of PP, QQ and RR meet.
Solution

(a) Midpoint of PRPR: (4,5)(4, 5). Gradient of PRPR: 9−17−1=43\dfrac{9 - 1}{7 - 1} = \dfrac{4}{3}, so the perpendicular gradient is −34-\dfrac{3}{4}:

y−5=−34(x−4)⇒y=−34x+8y - 5 = -\frac{3}{4}(x - 4) \quad\Rightarrow\quad y = -\frac{3}{4}x + 8

(b) Midpoint of QSQS: (9,3)(9, 3). Gradient of QSQS: 5−111−7=1\dfrac{5 - 1}{11 - 7} = 1, so the perpendicular gradient is −1-1:

y−3=−(x−9)⇒y=−x+12y - 3 = -(x - 9) \quad\Rightarrow\quad y = -x + 12

(c) x=4x = 4 and y=5y = 5 meet at (4,5)(4, 5). Check it’s on the edge from (a): −34(4)+8=5-\frac{3}{4}(4) + 8 = 5. ✓ The vertex is (4,5)(4, 5).

7. (Core) In the diagram from question 6, the only other vertex is (7,5)(7, 5), where the cells of QQ, RR and SS meet. A waste incinerator is to be built at a vertex of the Voronoi diagram, as far as possible from the nearest well. Find its location and its distance from the nearest well.

Solution
  • (4,5)(4, 5): distance to PP is 32+42=5\sqrt{3^2 + 4^2} = 5 km (the same to QQ and RR).
  • (7,5)(7, 5): distance to QQ is 02+42=4\sqrt{0^2 + 4^2} = 4 km (the same to RR and SS).

The incinerator should be at (4,5)(4, 5), 55 km from the nearest wells.

8. (Challenge) A new well T(9,3)T(9, 3) is added to the diagram from question 6.

  • (a) Find the equations of the perpendicular bisectors of QTQT, RTRT and STST.
  • (b) Show that (5,5)(5, 5) and (8,6)(8, 6) are vertices of the new cell of TT, by showing that each is equidistant from three sites.
  • (c) Which vertex of the old diagram is removed? Justify your answer.
Solution

(a)

PairMidpointGradientBisector
Q(7,1)Q(7, 1), T(9,3)T(9, 3)(8,2)(8, 2)11y=−x+10y = -x + 10
R(7,9)R(7, 9), T(9,3)T(9, 3)(8,6)(8, 6)−3-3y=13x+103y = \frac{1}{3}x + \frac{10}{3}
S(11,5)S(11, 5), T(9,3)T(9, 3)(10,4)(10, 4)11y=−x+14y = -x + 14

(b) (5,5)(5, 5) lies on the first two bisectors: −5+10=5-5 + 10 = 5 and 53+103=5\frac{5}{3} + \frac{10}{3} = 5. Its distances to QQ, RR and TT are 22+42\sqrt{2^2 + 4^2}, 22+42\sqrt{2^2 + 4^2} and 42+22\sqrt{4^2 + 2^2}, all equal to 20\sqrt{20}.

(8,6)(8, 6) lies on the last two bisectors: 83+103=6\frac{8}{3} + \frac{10}{3} = 6 and −8+14=6-8 + 14 = 6. Its distances to RR, SS and TT are 12+32\sqrt{1^2 + 3^2}, 32+12\sqrt{3^2 + 1^2} and 12+32\sqrt{1^2 + 3^2}, all equal to 10\sqrt{10}.

(c) The old vertex (7,5)(7, 5) is removed. It was 44 km from QQ, RR and SS, but it is only 22+22=8≈2.83\sqrt{2^2 + 2^2} = \sqrt{8} \approx 2.83 km from TT. So it is now inside the cell of TT, not on a boundary.

9. (Challenge) Three villages are at X(0,0)X(0, 0), Y(10,0)Y(10, 0) and Z(4,8)Z(4, 8) (units in km). A clinic is to be built at the point equally far from all three villages. Find its coordinates and its distance from each village.

Solution

The point is the Voronoi vertex of the three sites, where the perpendicular bisectors meet.

Bisector of XYXY: x=5x = 5.

Bisector of XZXZ: midpoint (2,4)(2, 4), gradient of XZXZ is 22, so the perpendicular gradient is −12-\dfrac{1}{2}:

y−4=−12(x−2)y - 4 = -\frac{1}{2}(x - 2)

At x=5x = 5: y=4−32=52y = 4 - \dfrac{3}{2} = \dfrac{5}{2}. The clinic is at (5, 2.5)(5,\ 2.5).

Distances: to XX: 52+2.52=31.25\sqrt{5^2 + 2.5^2} = \sqrt{31.25}; to YY: 52+2.52=31.25\sqrt{5^2 + 2.5^2} = \sqrt{31.25}; to ZZ: 12+5.52=31.25\sqrt{1^2 + 5.5^2} = \sqrt{31.25}. Each is 31.25≈5.59\sqrt{31.25} \approx 5.59 km.