Sylvester–Gallai theorem
The Sylvester–Gallai theorem in geometry states that, given a finite number of points in the Euclidean plane, either
 all the points lie on a single line; or
 there is at least one line which contains exactly two of the points.
It is named after James Joseph Sylvester, who posed it as a problem in 1893, and Tibor Gallai, who published one of the first proofs of this theorem in 1944.

A line that contains exactly two of a set of points is known as an ordinary line. According to a strengthening of the theorem, every finite point set (not all on a line) has at least a linear number of ordinary lines. There is an algorithm that finds an ordinary line in a set of n points in time proportional to n log n in the worst case.

History
The Sylvester–Gallai theorem was posed as a problem by .   suggests that Sylvester may have been motivated by a related phenomenon in algebraic geometry, in which the inflection points of a cubic curve in the complex projective plane form a configuration of nine points and twelve lines (the Hesse configuration) in which each line determined by two of the points contains a third point. The Sylvester–Gallai theorem implies that it is impossible for all nine of these points to have real coordinates.

 claimed to have a short proof of the Sylvester–Gallai theorem, but it was already noted to be incomplete at the time of publication.  proved the theorem (and actually a slightly stronger result) in an equivalent formulation, its projective dual.  Unaware of Melchior's proof,  again stated the conjecture, which was proved first by Tibor Gallai, and soon afterwards by other authors.

Projective and dual versions 
The question of the existence of an ordinary line can also be posed for points in the real projective plane RP2 instead of the Euclidean plane. The Euclidean plane can be viewed as a subset of the projective plane, but the additional points and lines of the projective plane do not change the problem, as any finite set of projective points can be transformed into a Euclidean point set without changing its set of ordinary lines. Therefore, any pattern of intersecting points and lines that exists in one of these two types of plane also exists in the other. However, the projective viewpoint allows certain configurations to be described more easily.
By projective duality, the existence of an ordinary line for a set of non-collinear points in RP2 is equivalent to the existence of an ordinary point in a nontrivial arrangement of finitely many lines. An arrangement is said to be trivial when all its lines pass through a common point, and nontrivial otherwise; an ordinary point is a point that belongs to exactly two lines.

Proofs
For a description of Gallai's original proof of the theorem, see e.g. .

Kelly's proof

This proof is due to Leroy Milton Kelly.

Suppose that a finite set S of points is not all collinear. Define a connecting line to be a line that contains at least two points in the collection. By finiteness, there must exist a point P and a connecting line ℓ that are a positive distance apart but are closer than all other point-line pairs. We'll prove that ℓ is ordinary, by contradiction.

Assume that ℓ is not ordinary. Then it goes through at least three points of S. At least two of these are on the same side of P', the perpendicular projection of P on ℓ. Call them B and C, with B being closest to P' (and possibly coinciding with it). Draw the connecting line m passing through P and C, and the perpendicular from B to B' on m . Then BB' is shorter than PP'''. This follows from the facts that PP'C and BB'C are similar triangles, contained inside one another.

However, this contradicts the original definition of P and ℓ as the point-line pair with the smallest positive distance. So the assumption that ℓ is not ordinary cannot be true, QED.

Melchior's proof

In 1941 (thus, prior to Erdős publishing the question and Gallai's subsequent proof) Melchior showed that any nontrivial finite arrangement of lines in the projective plane has at least three ordinary points.  By duality, this results also says that any finite nontrivial set of points on the plane has at least three ordinary lines.

Melchior observed that, for any graph embedded in the real projective plane, the formula V − E + F must equal 1, the Euler characteristic of the projective plane. Here V, E, and F, are the number of vertices, edges, and faces of the graph, respectively. Any  nontrivial line arrangement on the projective plane defines a graph in which each face is bounded by at least three edges, and each edge bounds two faces; so, double counting gives the additional inequality F ≤ 2E/3. Using this inequality to eliminate F from the Euler characteristic leads to the inequality E ≤ 3V − 3. But if every vertex in the arrangement were the crossing point of three or more lines, then the total number of edges would be at least 3V, contradicting this inequality. Therefore, some vertices must be the crossing point of only two lines, and as Melchior's more careful analysis shows, at least three ordinary vertices are needed in order to satisfy the inequality E ≤ 3V − 3.

Melchior's inequality
By a similar argument, Melchior was able to prove a more general result.  For every k ≥ 2, let tk be the number of points to which k lines are incident. Then

or equivalently,

Coxeter's proof
 gave another proof of the Sylvester–Gallai theorem within ordered geometry, an axiomatization of geometry that includes not only Euclidean geometry but several other related geometries. See   for minimal axiom systems inside which the Sylvester–Gallai theorem can be proved.

The number of ordinary lines

While the Sylvester–Gallai theorem states that an arrangement of points, not all collinear, must determine an ordinary line, it does not say how many must be determined.

Let  be the minimum number of ordinary lines determined over every set of n non-collinear points. Melchior's proof showed that   raised the question of whether  approaches infinity with n.  confirmed that it does by proving that .   conjectured that , for all values of n, a conjecture that still stands .  This is often referred to as the Dirac-Motzkin conjecture, see for example .  proved that t2(n) ≥ 3n/7.

Dirac's conjectured lower bound is asymptotically the best possible, since there is a proven matching upper bound  for even n greater than four. The construction, due to Károly Böröczky, that achieves this bound consists of the vertices of a regular m-gon in the real projective plane and another m points (thus, ) on the line at infinity corresponding to each of the directions determined by pairs of vertices; although there are  pairs, they determine only m distinct directions. This arrangement has only m ordinary lines, namely those that connect a vertex v with the point at infinity corresponding to the line determined by v's two neighboring vertices. Note that, as with any finite configuration in the real projective plane, this construction can be perturbed so that all points are finite, without changing the number of ordinary lines.

For odd n, only two examples are known that match Dirac's lower bound conjecture, that is, with  One example, by , consists of the vertices, edge midpoints, and centroid of an equilateral triangle; these seven points determine only three ordinary lines. The configuration in which these three ordinary lines are replaced by a single line cannot be realized in the Euclidean plane, but forms a finite projective space known as the Fano plane. Because of this connection, the Kelly–Moser example has also been called the non-Fano configuration. The other counterexample, due to McKee, consists of two regular pentagons joined edge-to-edge together with the midpoint of the shared edge and four points on the line at infinity in the projective plane; these 13 points have among them 6 ordinary lines. Modifications of Böröczky's construction lead to sets of odd numbers of points with  ordinary lines.

 proved that  except when n is seven. Asymptotically, this formula is already 12/13 ~ 92.3% of the proven n/2 upper bound. The n = 7 case is an exception because otherwise the Kelly–Moser construction would be a counterexample; their construction shows that t2(7) ≤ 3. However, were the Csima–Sawyer bound valid for n = 7, it would claim that t2(7) ≥ 4.

A closely related result is Beck's theorem, stating a tradeoff between the number of lines with few points and the number of points on a single line.

Ben Green and Terence Tao showed that for all sufficiently large point sets, n > n0, the number of ordinary lines is indeed at least n/2. Furthermore, when n is odd, the number of ordinary lines is at least 3n/4 − C, for some constant C. Thus, the constructions of Böröczky for even and odd (discussed above) are best possible.

The number of connecting lines
As Paul Erdős observed, the Sylvester–Gallai theorem immediately implies that any set of n points that are not collinear determines at least n different lines. As a base case, the result is clearly true for n = 3. For any larger value of n, the result can be reduced from n points to n − 1 points, by deleting an ordinary line and one of the two points on it. Thus, it follows by mathematical induction. The example of a near-pencil (a set of n − 1 collinear points together with one additional point that is not on the same line as the other points) shows that this bound is tight.

Generalizations

The Sylvester–Gallai theorem does not directly apply to sets of infinitely many points or to geometries over finite fields. The set of all points in the plane is an infinite set with no ordinary lines, for instance, and the set of all points in a finite geometry also has no ordinary lines.

For geometries defined using complex number or quaternion coordinates, however, the situation is more complicated. For instance, in the complex projective plane there exists a configuration of nine points, Hesse's configuration (the inflection points of a cubic curve), in which every line is non-ordinary, violating the Sylvester–Gallai theorem. Such a configuration is known as a Sylvester–Gallai configuration, and it cannot be realized by points and lines of the Euclidean plane. Another way of stating the Sylvester–Gallai theorem is that whenever the points of a Sylvester–Gallai configuration are embedded into a Euclidean space, preserving colinearities, the points must all lie on a single line, and the example of the Hesse configuration shows that this is false for the complex projective plane. However,  proved a complex-number analogue of the Sylvester–Gallai theorem: whenever the points of a Sylvester–Gallai configuration are embedded into a complex projective space, the points must all lie in a two-dimensional subspace. Similarly,  showed that whenever they are embedded into a space defined over the quaternions, they must lie in a three-dimensional subspace.

Every set of points in the plane, and the lines connecting them, may be abstracted as the elements and flats of a rank-3 oriented matroid. In this context, the result of  lower-bounding the number of ordinary lines can be generalized to oriented matroids: every rank-3 oriented matroid with n elements has at least 3n/7 two-point lines, or equivalently every rank-3 matroid with fewer two-point lines must be non-orientable. A matroid without any two-point lines is called a Sylvester matroid. Relatedly, the Kelly–Moser configuration with seven points and only three ordinary lines forms one of the forbidden minors for GF(4)-representable matroids.