∇ProvenDecisions
Ctrl K

Smallest circle covering points: a convex optimization example, solved and checked

The smallest circle covering points is a classic convex optimization problem. Here it is solved by a real solver (CLARABEL) and checked: every constraint, and the optimality certificate. Change the numbers below and solve your own.

Answer. The smallest objective value is 2.5, at cx = 1.99986, cy = 1.49981, r = 2.5. All 4 constraints are satisfied (largest violation 2e-08, within the solver's tolerance). Optimal, numerically checked.

Solve your own version free, no account needed

The problem

Find the smallest circle that contains the points (0, 0), (4, 0) and (0, 3).

How the model was built

The objective as written from the problem, before the numbers are multiplied out:

The model

Each line has a plain-language note on the right.

make this as small as possible
limit 1: left side cannot exceed the right side
limit 2: left side cannot exceed the right side
limit 3: left side cannot exceed the right side
radius of the circle (length) cannot be negative

What is being decided

There are 3 decision variables.

VariableTypeMeaning
cxreal numberx-coordinate of circle center (length)
cyreal numbery-coordinate of circle center (length)
rreal numberradius of the circle (length)

Goal and limits

Minimize the objective subject to 4 constraints, of which 1 are simple bounds on a single variable.

Problem type

Conic (convex), complexity level 4: convex nonlinear functions such as log, exp, square roots or powers. Solved with CLARABEL at the Medium solver tier.

The answer at a glance

The optimal value of each decision, as the solver returned it.

cx1.99986cy1.49981r2.5

Which constraints hold the answer in place

Binding (no slack left): (2) cy^2 + (cx - 4)^2 <= r^2; (3) cx^2 + (cy - 3)^2 <= r^2. Changing a binding constraint changes the answer; a slack one can move a little without effect.

#ConstraintValueLimitSlackBinding
1cx^2 + cy^2 <= r^26.248866.250.00113687
2cy^2 + (cx - 4)^2 <= r^26.256.25-1.05804e-08yes
3cx^2 + (cy - 3)^2 <= r^26.256.25-8.93396e-08yes
4r >= 02.502.5

Algebraic model (low level)

Decision variables, objective and every constraint written out; this is exactly what the solver receives.

Model code (cvxpy)

The same model in cvxpy, ready to run.

import cvxpy as cp

cx = cp.Variable(name='cx')  # x-coordinate of circle center (length)
cy = cp.Variable(name='cy')  # y-coordinate of circle center (length)
r = cp.Variable(name='r')  # radius of the circle (length)

objective = cp.Minimize(r)
constraints = [
    cx**2 + cy**2 <= r**2,
    cy**2 + (cx - 4)**2 <= r**2,
    cx**2 + (cy - 3)**2 <= r**2,
    r >= 0,
]
problem = cp.Problem(objective, constraints)
problem.solve(solver='CLARABEL')
print(problem.status, problem.value)
print('cx =', cx.value)
print('cy =', cy.value)
print('r =', r.value)

Solve your own

This is the model as the app reads it. Change any number and solve it in the free box on the front page (no account needed).

minimize r
subject to
cx^2 + cy^2 <= r^2
(cx - 4)^2 + cy^2 <= r^2
cx^2 + (cy - 3)^2 <= r^2
r >= 0
# cx = x-coordinate of circle center (length)
# cy = y-coordinate of circle center (length)
# r = radius of the circle (length)

Change the numbers and solve it

Checked: the app's answer matches the reference answer in our test set, which two solvers (CLARABEL, SCS) agree on. Built 2026-11-10.

Related examples

All 50 solved examples

Try ProvenDecisions free: type, photograph or say an optimization problem; every answer is checked by a solver.

What do you want to optimize?

Type the math, describe it in words, snap a photo or say it. ProvenDecisions builds the model, solves it, checks it and walks you through it.

One constraint per line, or separated by commas. Add integer: x, y or binary: z for whole-number decisions. LaTeX works too.

Try: