# Largest set of cocircular points

Given $n$ points with integer coordinates in the plane, determine the maximum number of points that lie on the same circle (on its circumference, not its interior).

This can be done in $O(n^3)$ easily by trying $\binom{n}{3}$ combinations of points and counting the number of occurrences of all circles found with hash tables.

Question: Is there an algorithm with $o(n^3)$ time?

Bonus question: Is there an algorithm which has a better performance than $O(n^3)$ assuming the maximum size of the (individual) coordinates is $c\times w$ where $w$ is the size of a machine Word and $c$ a constant?

• You might want to rethink this as an image processing/computer vision-type problem. IIRC there are scale-invariant versions of the Circle Hough Transform, for example. Commented Nov 11, 2015 at 23:35
• @Pseudonym Hm.. the Wikipedia article mentions that for unknown radius "we can iterate through possible radiuses and for each radius", so the huge downside of that method would be that the complexity is now around $O(NM^2)$ , where $M$ is the maximum magnitude of a coordinate. But maybe there is some way to get something out of image processing. Commented Nov 12, 2015 at 2:19
• Yes, you'd probably want some more current research. By the way, if this is a real-world problem that you're trying to solve, don't forget randomised algorithms, like RANSAC and its variants. Commented Nov 12, 2015 at 2:44
• My guess is no. A lower bound may perhaps be found using the projection here. Project $(x_i,y_i)$ to $(x_i,y_i,x_i^2+y_i^2)$, so that three points are concyclic iff their projections are coplanar. So an $o(n^3)$ test for concylicity reduces to one for coplanarity.
– PKG
Commented Nov 13, 2015 at 1:31
• Commented Aug 9, 2018 at 10:14

About the bonus question: if coordinates are somehow bounded and integer, there is a finite amount of possible coordinates to test. We can create a finite constant set of all the possible useful circles with their respective set of integer points lying in our bounded lattice (this is finite because there are at most $$\text{grid size} \choose 3$$ of them). Now create a matrix of lists, one per coordinate, and map each point to its respective list in the matrix. Iterate now the constant set of circles and their respective set of coordinates, and count how many of the given points are included. This can be implemented in $$O(n)$$.