Problem

In the game, N points are arranged on a circle. Students take turns drawing chords that connect two points. Once a chord is drawn, it cannot be drawn again by either player. The first player to “draw a triangle,” meaning they draw the third side of a triangle whose three vertices are among the N points, loses. (Note: There may be triangles whose vertices are intersections of chords inside the circle. Drawing any of these triangles doesn’t count as losing.)

This got some of the kids wondering: For N = 10, what is the greatest number of chords that can be drawn such that there are no triangles?

Solution spoiler

We can split the circle into two sets with one labelled white and the other black.

All of the white ones connect to all of the black ones but there are no connections within each set. This gives us 5 * 5 = 25 edges. More generally this is floor(N/2) * ceil(N/2) which simplifies to floor(N^2 / 4).

This cannot make a triangle as a triangle would involve a series of three connections which end back at the original point. By parity we see that we end up in the other color (white -> black -> white -> black) so that can’t happen.

To show that this has to be maximal let’s consider induction.

Suppose it doesn’t hold N and we’re looking at that connection structure (which must have no triangles) which has >floor(N^2 / 4) edges. We can remove any connection and its corresponding nodes (and their edges). This also cannot have any triangles. At most we could have removed N-1 edges as if we had removed >= N edges we would have had a triangle (both nodes would have a shared neighbor).

This implies that we have a solution for N-2 vertices which has >= floor(N^2 / 4) + 1 - (N - 1) > floor((N-2)^2 / 4) which is a contradiction.

We know this holds for N=1 and 2 so it must hold in general.

We can also verify it with the following code:

using JuMP
using HiGHS

model = Model(HiGHS.Optimizer)
set_silent(model)

N = 10

# Introduce the edges (only record ii < jj)
@variable(model, edges[ii=1:N, jj=(ii+1):N], Bin)

# We want to maximize the number of edges
@objective(model, Max, sum(edges))

# Subject to not having any three cycles
for aa = 1:N, bb = (aa+1):N, cc = (bb+1):N
    @constraint(model, edges[aa, bb] + edges[bb, cc] + edges[aa, cc] <= 2)
end

optimize!(model)
objective_value(model)

Next step

We already said a player loses who first draws a triangle, which is a loop of three chords. Suppose instead that a player loses when they are the first to draw a loop of three distinct chords (i.e., a triangle) or four distinct chords.

For N = 10, what is the greatest number of chords that can be drawn such that there are no loops of three chords or four chords?

Solution spoiler

I don’t have a clean construction for this one: I gave up and just solved it using integer programming (which will use branch-and-bound so I’m not just straight-up bruteforcing it). The answer is 15 using the following code:

using JuMP
using HiGHS

model = Model(HiGHS.Optimizer)
set_silent(model)

N = 10

# Introduce the edges (only record ii < jj)
@variable(model, edges[ii=1:N, jj=(ii+1):N], Bin)

# We want to maximize the number of edges
@objective(model, Max, sum(edges))

# Subject to not having any three cycles
for aa = 1:N, bb = (aa+1):N, cc = (bb+1):N
    @constraint(model, edges[aa, bb] + edges[bb, cc] + edges[aa, cc] <= 2)
end

# and subject to not having any four cycles
for aa = 1:N, bb = (aa+1):N, cc = (bb+1):N, dd = (cc+1):N
    # note we can arrange in multiple cycles (but keep ii < jj)
    @constraint(model, edges[aa, bb] + edges[bb, cc] + edges[cc, dd] + edges[aa, dd] <= 3)
    @constraint(model, edges[aa, bb] + edges[bb, dd] + edges[cc, dd] + edges[aa, cc] <= 3)
    @constraint(model, edges[aa, cc] + edges[bb, cc] + edges[bb, dd] + edges[aa, dd] <= 3)
end

optimize!(model)
objective_value(model)