CCCG 2008, Montr´eal, Qu´ebec, August 13–15, 2008

Generalized Ham-Sandwich Cuts for Well Separated Sets

William Steiger∗ Jihui Zhao‡

Abstract The present paper is in the same spirit. The starting point is a recent, interesting result about generalized B´ar´any, Hubard, and Jer´onimo recently showed that for ham-sandwich cuts. d given well separated convex bodies S1,... ,Sd in R and Definition 1: (see [8]) Given k d +1,afamily constants βi [0, 1], there exists a unique h ∈ Rd ≤ with the property that Vol(h+ S )=β Vol(S ); h+ is S1,... ,Sk of connected sets in is well-separated if, ∩ i i· i the closed positive transversal halfspace of h,andh is for every choice of xi Si, the affine hull of x1,... ,xk is a (k 1)-dimensional∈ flat in Rd. a “generalized ham-sandwich cut”. We give a discrete − Rd analogue for a set S of n points in which is parti- B´ar´any et.al. [1] proved tioned into a family S = P P of well separated 1 ∪···∪ d sets and are in weak general position. The combinato- Proposition 1 Let K1, ..., Kd be well separated convex d 3 d rial proof inspires an O(n(log n) − ) which, bodies in R and β1,... ,βd given constants with 0 ≤d given positive integers ai Pi , finds the unique hy- βi 1. Then there is a unique hyperplane h R ≤| | ≤ + ⊂ perplane h incident with a point in each Pi and having with the property that Vol(Ki h )=βi Vol(Ki), i = + ∩ · h Pi = ai. Finally we show that the conditions as- 1,... ,d. |suring∩ existence| and uniqueness of generalized cuts are + also necessary. Here h denotes the closed, positive transversal halfs- pace defined by h: that is the halfspace where, if Q is an interior point of h+ and z K h,thed-simplex i ∈ i ∩ ∆(z1, ..., zd,Q)isnegatively oriented [1]. Specifying this 1 Introduction. choice of halfspaces is what forces h to be uniquely de- termined. B´ar´any et. al. give analogous results for Given d sets S ,S , ..., S Rd, a ham-sandwich cut is a 1 2 d ∈ such generalized ham-sandwich cuts for other kinds of hyperplane h that simultaneously bisects each Si.“Bi- + + well separated sets that support suitable measures. sect” means that µ(Si h )=µ(Si h−) < , h ,h− We are interested in a version of Proposition 1 for the closed halfspaces∩ defined by ∩and a∞ suitable, h µ n points partitioned into d sets in Rd; i.e., points in “nice” on Borel sets in Rd, e.g., the volume. S = P1 Pd, Pi Pj = φ, i = j, S = n. For this The well known ham-sandwich theorem guarantees the context∪···∪ we use ∩ 6 | | existence of such a cut. As with other consequences of the Borsuk-Ulam theorem [10] there is a discrete ver- Definition 2: Point sets P1, ..., Pd are well separated sion that applies to sets P1,... ,Pd of points in general if their convex hulls, Conv(P1),... ,Conv(Pn), are well position in Rd. For example Lo et. al [9] gave a direct separated. proof of a discrete version of the ham-sandwich theorem We need some kind of general position, and will assume which inspired an efficient algorithm to compute a cut. the following weaker form. More recently Bereg [4] studied a discrete version of a result of B´ar´any and Matouˇsek [2] that showed the exis- Definition 3: Points in S = P1 ... Pd have weak general position if, for each (x ,...∪ ,x∪), x P , tence of wedges that simultaneously equipartition three 1 d i ∈ i R2 aff(x1,... ,xd) is a (d 1)-flat that contains no other measures on (they are called equitable two-fans). By − seeking a direct, combinatorial proof of a discrete ver- point of S. sion (for counting measure on points sets in R2)hewas This does not prohibit more than d data points from able to strengthen the original result and also obtained a being in a hyperplane, e.g. if they are all in the same beautiful, nearly optimal algorithm to construct an eq- Pi. For the discrete analogue of a generalized cut we uitable two-fan. Finally, Roy and Steiger [12] followed use a similar path to obtain complexity results for several Definition 4: Given positive integers a P ,an other combinatorial consequences of the Borsuk-Ulam i i (a , ..., a )-cut is a hyperplane h for which h≤|P | = φ theorem. 1 d i and h+ P = a , 1 i d. ∩ 6 | ∩ i| i ≤ ≤ ∗Department of Computer Science, Rutgers University, 110 Frelinghuysen Road, Piscataway, New Jersey 08854-8004; As in Proposition 1, a cut is a transversal hyperplane ( steiger,zhaojih @cs.rutgers.edu.) (here incident with at least one data point in each P ) { } i 20th Canadian Conference on Computational Geometry, 2008

and h+ its positive halfspace. The discrete version of We can write h as p Rd : p, v = t ,andh+,the Proposition 1 is positive transversal{ halfspace∈ ,ash i }

h+ = p Rd : p, v t . Theorem 2 If P1,... ,Pd are well separated point sets { ∈ h i≤ } in Rd, then (i) if an (a , ..., a )-cut exists, it is unique. 1 d The relation p h+ is invariant under translation and Also (ii) if the points have weak general position, cuts rotation. ∈ exist for every (a1, ..., ad), 1 ai Pi . ≤ ≤| | Proof of Theorem 2: The proof is by induction. The This might be proved using some results of [1] via a base case d = 2 is probably folklore (but see [11]). Well standard argument that takes the average of n proba- separated implies that points in P1 may be dualized to bility measures, one centered at each data point. The (red) lines having positive slopes and those in P2,to variance of the measures is decreased to zero, and one (blue) lines having negative slope. If a red/blue inter- argues about the limit (see [7]). Instead we give a direct section q has a1 red lines and a2 blue lines above it, combinatorial proof in Section 2. In addition, and of in- vertex q is the dual of an (a1,a2)-cut. It must be the dependent interest, we show that both well-separated unique one because the red levels have positive slope and weak general position are also necessary for every and blue ones have negative slope, proving (i). possible (a1, ..., ad)-cut to exist and be unique. An anal- If P1 and P2 also have weak general position, every ogous converse is likely to hold for Proposition 1. red/blue intersection in the dual is a distinct vertex, There is also interest in the algorithmic problem P P of them in all, and each is incident with just | 1|·| 2| where, given n points distributed among d well sepa- those two lines. This implies that each level in the first rated sets in Rd, and in weak general position, the ob- arrangement has a unique intersection with every level ject is to find the cut for given a1,... ,ad. Our proof of the second, proving (ii). In fact the unique inter- of Theorem 2 leads to the formulation of an efficient, section can be found in linear time by adapting the d 3 O(n(log n) − ) algorithm for generalized cuts. This ap- prune-and-search algorithm given in [11] for intersection pears in Section 3. Throughout, because of space limi- of median levels. tations, some details are omitted. Next, suppose the claim holds for j 1 and any − i i0 Conv(Si),i=1,... ,d. d other z Si=2 Pi0,thenx and ρx span a hyperplane that violates∈ weak general position for P ,... ,P . In view of Definition 2, they hold for the discrete context 1 d as well. Therefore the induction hypotheses apply to P20,... ,Pd0 . Given points pi Conv(Pi),i =1,... ,d (not Given a point x Conv(P )and(a ,... ,a ), a hy- ∈ 1 2 d necessarily data points in S), the hyperplane h perplane h containing∈ x is an (a ,... ,a ) semi-cut (or ≡ x 2 d aff p1,... ,pd is a transversal hyperplane of dimension just a semi-cut) if, for each i>1, it is incident with a { } d 1. As in B´ar´any et. al. [1], if a unit vector c satisfies point p P and h+ P = a . It’s not hard to prove − i ∈ i | x ∩ i| i c, pi = t for some fixed constant t and for all i,the the following useful fact. unith i vector v of h can be chosen as either c or Lemma 3 Given x Conv(P ) and (a ,... ,a ).If c.Thepositive transversal hyperplane arises when v ∈ 1 2 d is− chosen so that, there is an (a2,... ,ad) semi-cut hx then it is unique.

p p p v To advance the induction, fix (a1,... ,ad) and suppose det 1 2 ··· d > 0. 11 10 hx is a cut with these values, x P1. By Lemma 3, ··· ∈ CCCG 2008, Montr´eal, Qu´ebec, August 13–15, 2008

it is the unique semi-cut cut containing x, so suppose cut can be computed in time proportional to the (worst- there is an (a2,... ,ad) semi-cut hy through y P1, y case) time needed to construct a given level in the ar- ∈ 6∈ d 1 hx. hx and hy cannot meet in Conv(P1) since any such rangement of n given in R − . The latter point would be in two different (a2,... ,ad) semi-cuts, problem can be solved within the following bounds: + violating Lemma 3. But this implies that a1 = P1 hy . 6 | ∩ | 4/3 2 Therefore hx is unique, which proves (i). O(n log n/ log∗ n) for d =3, 5/2 1+δ Now suppose P1,... ,Pd have weak general position O(n log n) for d =4, d 1 a(d) and fix x P and (a ,... ,a ). Projecting from x, O(n − − ) for d 5. ∈ 1 2 d ≥ there is a unique (a2,... ,ad)-cut ρx π by the induc- ⊂ d δ>0 is an appropriate constant and a(d) > 0asmall tion hypothesis and the fact that each z0 Si=2 Pi0 is d ∈ constant; also a(d) 0andd . the image of a distinct z S Pi. x and ρx span → →∞ ∈ i=2 a hyperplane hx that is an (mx,a2,... ,ad)-cut, mx de- It is not difficult to verify that the ham-sandwich algo- noting P h+ . Lemma 3 implies that there is no other rithms given in [9] may be extended to find generalized | 1 ∩ x | (mx,a2,... ,ad)-cut. Also, repeating this procedure for cuts for well separated points sets having weak general every x P , existence and uniqueness imply that the position - given that they exist - and in this way, the ∈ 1 integers mx,x P1 form a permutation of 1,... , P1 . complexity of finding generalized cuts may be reduced ∈ | | d 1 a(d) So for some z P1 we have the unique (a1,... ,ad)-cut, to O(n ). ∈ − − and this proves (ii). Finally, we will describe a much more practical al- gorithm, applying ideas from the proof in Section 2. In fact the conditions of the Theorem are also neces- We showed there that for each data point x P and sary. ∈ 1 (a2,... ,ad), there is a unique (mx,a2,... ,ad)-cut hx Corollary 4 Well separation and weak general posi- that contains x. Furthermore, for each j,1 j P1 , there is a unique x P for which m =≤ j.Thus≤| | tion are necessary if all (a1,... ,ad)-cuts exist and are ∈ 1 x unique. we could loop through all x P1, project onto π, ∈ find the unique (a2,... ,ad)cutρx π, and count Weak general position is necessary for the existence and m = P h+ for h , the hyperplane⊂ spanned by x x | 1 ∩ x | x uniqueness of all (a1,... ,ad)-cuts by simple counting. and ρ . At some stage we will find the z P for which x ∈ 1 There are P1 P2 Pd different d-tuples (a1,... ,ad) m = a and h is the (a ,... ,a )-cut. The cost would | |·| |···| | z 1 z 1 d and there are this many different transversal hyper- be bounded by the cost to solve n (d 1)-dimensional planes through data points only if we have weak general problems. − position. In fact we will find the desired z P by solving at ∈ 1 Now suppose P1,... ,Pd are not well separated. By most O(log n)(d 1)-dimensional problems. The key is property 1 at the beginning of this section, there to be able to prune− a fixed fraction of remaining points is a partition I J of 1,... ,d , such that A = in P after each search step, and uses the fact that if ∪ { } 1 Conv(S P ) Conv(S P ) = φ. For points in A on + i I i j J j nx 0, a small, fixed integer (say 10) at least one point in Sj J Pj in its interior. If we set a =1fori I, a = P ∈ for i J,no(a ,... ,a )-cut 2. Find a hyperplane π that separates P from i ∈ i | i| ∈ 1 d 1 can exist. P P 2 ∪···∪ d 3. C P1 3 An Algorithm for Generalized Cuts. ← 4. a a1 From now on we assume weak general position and ← well separation. Theorem 2 implies that there is a 5. WHILE C >cDO | | unique set of data points p ,... ,p , p P , for which 1 d i ∈ i Construct A,an-approximation to C aff(p1,... ,pd)isan(a1,... ,ad)-cut. So we could use • a brute force enumeration and find it in O(nd+1), O(n) FOR each x A DO • ∈ being the cost to test each d-tuple. (a) Project each y P2 Pd onto π; A small improvement can be obtained by resorting to ∈ ∪···∪ let Pi0 denote the projections of the the following algorithmic result of [9] (slightly restated points in Pi to reflect new upper bounds on k-sets [6], [13]). (b) Find the (a2, ..., ad)-cut ρx π for Rd ⊂ Proposition 2. Given n points in which are par- the projections P20,... ,Pd0 by solving titioned into d sets P ,... ,P in Rd, a ham-sandwich a (d 1)-dimensional problem 1 d − 20th Canadian Conference on Computational Geometry, 2008

(c) Get hx, the hyperplane that spans x through 5d. Then, instead of Step 5e, we test whether and ρ . h+ P = a ; exactly one point will have this property. x | ∩ 1| 1 (d) Compute the number of points of C Since the base case for dimension d = 2 has linear run- in the positive transversal halfspace ning time, the present algorithm will find a generalized + cut in O(n(log n)d 2). hx − (e) END FOR Finally, for d = 3, Lo, et. al. [9] showed how to find a ham-sandwich cut for well separated point sets in Prune from C points x P whose m is • ∈ 1 x linear time. That algorithm is easily adapted to gener- too small or too large, and adjust C and alized cuts. Using this as the base case, the algorithm a d 3 just described now has running time O(n(log n) − )for END WHILE d 3. • ≥ 6. For each remaining data point in x C, We tried to find a way to do the inductive step in con- ∈ stant time, similar to the way Lo et. al. did for sep- project, find the (a2, ..., ad)-cut ρx in π for the 3 projections by solving a (d 1)-dimensional arated ham sandwich cuts in R , but did not succeed. − + A main open question is whether there is an O(n) algo- problem, get hx and compute mx = P1 hx , | ∩ | rithm for this problem. stopping when mx = a1. Acknowledgement: We thank the reviewers for in- Finding a separating hyperplane π can be formulated sightful comments. as a linear programming problem and can be solved in time O(n), for fixed dimension d. C is the set of candi- References dates for the sought point z P ; initially C = P . a 1 1 [1] B´ar´any, I., Hubard, A., Jer´onimo, J. “ Slicing Con- denotes the number of undeleted∈ points in the positive vex Sets and Measures by a Hyperplane”. Discrete and transversal halfspace of z’s semicut; initially a = a1. Computational Geometry 39, 67-75 (2008). In the while loop we construct an -approximation to [2] I. B´ar´any and J. Matouˇsek. “Separating Measures by C. The range space (C, ), has VC dimension d +1, Two-Fans”. Discrete and Computational Geometry where denotes the setA of all halfspaces in Rd that [3] I. B´ar´any and P. Valtr. “A positive fraction Erd˝os- containA some points in C.By[5],inO( C ) time [i.e., Szekeres theorem”. Discrete and Computational Geom- linear; in fact its (( +1)3(d+1)( d+1 log| d|+1 )d+1 )] O d 2  C etry 19, 335-342 (1998). we can construct an -approximation A C, having| | [4] S. Bereg. “Equipartitions of Measures by 2-Fans”. constant size [in fact A = k = O( d+1 log ⊂d+1 )]. | | 2  Discrete and Computational Geometry 34 (1), 87-96 The FOR loop is traversed k = A times. The cost (2005). of each traversal is dominated by O| (B| ), the cost of d 1 [5] B. Chazelle: The Discrepancy Method: Randomness the ( 1)-dimensional problem in (b);− the cost of (a) d and Complexity, Cambridge University Press (2000). is O(n)and(d)is− O( C ). [6] T. Dey. ”Improved Bounds for Planar k-Sets and Re- At the end of the FOR| | we have for each x A,the + ∈ lated Problems”. Discrete and Computational Geome- value of nx = hx C . These distinct values order the try 19 (3) 373- 382 (1998). elements x |A, and∩ | our target value, a,islessthan [7] H. Edelsbrunner. in Combinatorial Geome- the smallest∈n , greater than the largest n , or between x x try. Springer, New York (1987) a successive pair in the ordering. In the first case we [8] H. Kramer and A. Nemeth. “Supporting for delete all y C, y h+,wheren =min(n ,x A). u u x families of independent convex sets”. Arch. Math. 24, In the third∈ case we6∈ delete all , +,where∈ y C y hv 91-96 (1973). n =max(n ,x A); here we also∈ reduce∈ a by a v x [9] C.-Y. Lo, J. Matouˇsek, and W. Steiger. “Algorithms a n . The middle∈ case is similar. Since A is an ←- v for Ham-Sandwich Cuts”. Discrete and Computational approximation,− only a constant fraction ( 1 ( +1)+ < / k Geom. 11, 433-452 (1994). 2) of the points in C remains after pruning. [10] J. Matouˇsek. Using the Borsuk-Ulam Theorem. The geometric decrease in C implies that the num- Springer-Verlag (2003). ber of iterations of the WHILE| | loop is bounded by O(log P )=O(log n). Therefore Step 5b contributes [11] N. Megiddo. “Partitioning with two lines in the plane”. | 1| J. Algorithms 6, 430-433 (1985) O(Bd 1 log n) to the total cost of the loop, where Bk denotes− the complexity of the present algorithm in di- [12] S. Roy and W. Steiger. “Some Combinatorial and Algo- rithmic Aspects of the Borsuk-Ulam Theorem”. Graphs mension k. This dominates the total cost of the loop and Combinatorics 23, 331-341, (2007). because all other steps have cost either O(n)or(O C ) and contribute a total of O(n log n) to the loop. | | [13] M. Sharir, S. Smorodinsky, and G. Tardos. “An Im- proved Bound for k-Sets in Three Dimensions”. Dis- When the loop terminates, each remaining point in crete and Computational Geometry 26, 195-204 (2001). C is treated in time O(Bd 1) by executing Steps 5a −