Ham sandwich theorem
Not to be confused with the "squeeze theorem" (sometimes called the "sandwich theorem").
In measure theory, a branch of mathematics, the ham sandwich theorem, also called the Stone–Tukey theorem after Arthur H. Stone and John Tukey, states that given n measurable "objects" in n-dimensional space, it is possible to divide all of them in half (with respect to their measure, i.e. volume) with a single (n − 1)-dimensional hyperplane. Here the "objects" should be sets of finite measure (or, in fact, just of finite outer measure) for the notion of "dividing the volume in half" to make sense.
The ham sandwich theorem takes its name from the case when n = 3 and the three objects of any shape are a chunk of ham and two chunks of bread — notionally, a sandwich — which can then all be simultaneously bisected with a single cut (i.e., a plane). In two dimensions, the theorem is known as the pancake theorem of having to cut two infinitesimally thin pancakes on a plate each in half with a single cut (i.e., a straight line).
According to Beyer & Zardecki (2004), the earliest known paper about the ham sandwich theorem, specifically the n = 3 case of bisecting three solids with a plane, is by Steinhaus (1938). Beyer and Zardecki's paper includes a translation of the 1938 paper. It attributes the posing of the problem to Hugo Steinhaus, and credits Stefan Banach as the first to solve the problem, by a reduction to the Borsuk–Ulam theorem. The paper poses the problem in two ways: first, formally, as "Is it always possible to bisect three solids, arbitrarily located, with the aid of an appropriate plane?" and second, informally, as "Can we place a piece of ham under a meat cutter so that meat, bone, and fat are cut in halves?" Later, the paper offers a proof of the theorem.
A more modern reference is Stone & Tukey (1942), which is the basis of the name "Stone–Tukey theorem". This paper proves the n-dimensional version of the theorem in a more general setting involving measures. The paper attributes the n = 3 case to Stanislaw Ulam, based on information from a referee; but Beyer & Zardecki (2004) claim that this is incorrect, given Steinhaus's paper, although "Ulam did make a fundamental contribution in proposing" the Borsuk–Ulam theorem.
Reduction to the Borsuk–Ulam theorem 
The ham sandwich theorem can be proved as follows using the Borsuk–Ulam theorem. This proof follows the one described by Steinhaus and others (1938), attributed there to Stefan Banach, for the n = 3 case.
Let A1, A2, …, An denote the n objects that we wish to simultaneously bisect. Let S be the unit (n − 1)-sphere embedded in n-dimensional Euclidean space , centered at the origin. For each point p on the surface of the sphere S, we can define a continuum[disambiguation needed] of oriented affine hyperplanes (not necessarily centred at 0) perpendicular to the (normal) vector from the origin to p, with the "positive side" of each hyperplane defined as the side pointed to by that vector. By the intermediate value theorem, every family of such hyperplanes contains at least one hyperplane that bisects the bounded object An: at one extreme translation, no volume of An is on the positive side, and at the other extreme translation, all of An's volume is on the positive side, so in between there must be a translation that has half of An's volume on the positive side. If there is more than one such hyperplane in the family, we can pick one canonically by choosing the midpoint of the interval of translations for which An is bisected. Thus we obtain, for each point p on the sphere S, a hyperplane π(p) that is perpendicular to the vector from the origin to p and that bisects An.
Now we define a function f from the (n − 1)-sphere S to (n − 1)-dimensional Euclidean space as follows:
- f(p) = (vol of A1 on the positive side of π(p), vol of A2 on the positive side of π(p), ..., vol of An−1 on the positive side of π(p)).
This function f is continuous. By the Borsuk–Ulam theorem, there are antipodal points p and q on the sphere S such that f(p) = f(q). Antipodal points p and q correspond to hyperplanes π(p) and π(q) that are equal except that they have opposite positive sides. Thus, f(p) = f(q) means that the volume of Ai is the same on the positive and negative side of π(p) (or π(q)), for i = 1, 2, ..., n − 1. Thus, π(p) (or π(q)) is the desired ham sandwich cut that simultaneously bisects the volumes of A1, A2, …, An.
Measure theoretic versions 
In measure theory, Stone & Tukey (1942) proved two more general forms of the ham sandwich theorem. Both versions concern the bisection of n subsets X1, X2, …, Xn of a common set X, where X has a Carathéodory outer measure and each Xi has finite outer measure.
Their first general formulation is as follows: for any suitably restricted real function , there is a point p of the n-sphere Sn such that the surface , dividing X into f(s,x) < 0 and f(s,x) > 0, simultaneously bisects the outer measure of X1, X2, …, Xn. The proof is again a reduction to the Borsuk-Ulam theorem. This theorem generalizes the standard ham sandwich theorem by letting f(s,x) = s0 + s1x1 + ... + snxn.
Their second formulation is as follows: for any n+1 measurable functions f0, f1, …, fn over X that are linearly independent over any subset of X of positive measure, there is a linear combination f = a0f0 + a1f1 + ... + anfn such that the surface f(x) = 0, dividing X into f(x) < 0 and f(x) > 0, simultaneously bisects the outer measure of X1, X2, …, Xn. This theorem generalizes the standard ham sandwich theorem by letting f0(x) = 1 and letting fi(x), for i > 0, be the ith coordinate of x.
Discrete and computational geometry versions 
In discrete geometry and computational geometry, the ham sandwich theorem usually refers to the special case in which each of the sets being divided is a finite set of points. Here the relevant measure is the counting measure, which simply counts the number of points on either side of the hyperplane. In two dimensions, the theorem can be stated as follows:
- For a finite set of points in the plane, each colored "red" or "blue", there is a line that simultaneously bisects the red points and bisects the blue points, that is, the number of red points on either side of the line is equal and the number of blue points on either side of the line is equal.
There is an exceptional case when points lie on the line. In this situation, we count each of these points as either being on one side, on the other, or on neither side of the line (possibly depending on the point), i.e. "bisecting" in fact means that each side contains less than half of the total number of points. This exceptional case is actually required for the theorem to hold, of course when the number of red points or the number of blue is odd, but also in specific configurations with even numbers of points, for instance when all the points lie on the same line and the two colors are separated from each other (i.e. colors don't alternate along the line). A situation where the numbers of points on each side cannot match each other is provided by adding an extra point out of the line in the previous configuration.
In computational geometry, this ham sandwich theorem leads to a computational problem, the ham sandwich problem. In two dimensions, the problem is this: given a finite set of n points in the plane, each colored "red" or "blue", find a ham sandwich cut for them. First, Megiddo (1985) described an algorithm for the special, separated case. Here all red points are on one side of some line and all blue points are on the other side, a situation where there is a unique ham sandwich cut, which Megiddo could find in linear time. Later, Edelsbrunner & Waupotitsch (1986) gave an algorithm for the general two-dimensional case; the running time of their algorithm is O(n log n), where the symbol O indicates the use of Big O notation. Finally, Lo & Steiger (1990) found an optimal O(n)-time algorithm. This algorithm was extended to higher dimensions by Lo, Matoušek & Steiger (1994). Given d sets of points in general position in d-dimensional space, the algorithm computes a (d−1)-dimensional hyperplane that has equal numbers of points of each of the sets in each of its half-spaces, i.e., a ham-sandwich cut for the given points.
- Beyer, W. A.; Zardecki, Andrew (2004), "The early history of the ham sandwich theorem", American Mathematical Monthly 111 (1): 58–61, doi:10.2307/4145019, JSTOR 4145019.
- Edelsbrunner, H.; Waupotitsch, R. (1986), "Computing a ham sandwich cut in two dimensions", J. Symbolic Comput. 2: 171–178, doi:10.1016/S0747-7171(86)80020-7.
- Lo, Chi-Yuan; Steiger, W. L. (1990), "An optimal time algorithm for ham-sandwich cuts in the plane", Proceedings of the Second Canadian Conference on Computational Geometry, pp. 5–9.
- Lo, Chi-Yuan; Matoušek, Jiří; Steiger, William L. (1994), "Algorithms for Ham-Sandwich Cuts", Discrete and Computational Geometry 11: 433–452, doi:10.1007/BF02574017.
- Megiddo, Nimrod (1985), "Partitioning with two lines in the plane", Journal of Algorithms 6: 430–433, doi:10.1016/0196-6774(85)90011-2.
- Steinhaus, Hugo (1938), "A note on the ham sandwich theorem", Mathesis Polska 9: 26–28.
- Stone, A. H.; Tukey, J. W. (1942), "Generalized "sandwich" theorems", Duke Mathematical Journal 9: 356–359, doi:10.1215/S0012-7094-42-00925-6.