Advanced maths

Convex quadratic programming calculator with constraints

Minimize a positive-semidefinite rational quadratic objective under linear constraints, returning an exact KKT certificate or a distinct infeasible/unbounded status.

Your numbers

Order 1–4. The objective is one half xᵀQx plus cᵀx. Every principal minor must be nonnegative.
One rational coefficient per original variable. Fractions and decimals up to six places are supported; no variable-name expressions.
One row such as 2,1 <= 4. Use <=, >= or =. Supply one coefficient per variable; leave empty for bounds only.
One row per original variable. Use -inf for no lower bound and inf for no upper bound. A row -inf,inf makes a free variable.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

Convex quadratic programming adds a positive-semidefinite quadratic term to a linear objective while keeping constraints linear. The Hessian convention matters: this page minimizes one half xᵀQx plus cᵀx. It checks every principal minor of the small rational Hessian, then searches active constraint sets for an exact Karush–Kuhn–Tucker certificate. The certificate verifies original feasibility, nonnegative inequality multipliers, stationarity and complementary slackness. Singular Hessians are supported without pretending every KKT matrix is invertible. A separate recession check detects directions in which the objective decreases without bound.

THE FORMULAMinimize (1/2)xᵀQx+cᵀx; require Q⪰0, primal feasibility, λ≥0, Qx+c+A_activeᵀλ=0 and complementary slackness.

A worked example

Let Q=diag(2,2), c=(−2,−4), and impose x+y≤2 with both variables free. The objective is x²+y²−2x−4y. Without the constraint its minimizer is (1,2), which violates the bound. The constrained optimum is (1/2,3/2), with objective −9/2. The gradient there is (−1,−1); adding multiplier one times the active constraint normal (1,1) gives zero. The constraint is tight, its multiplier is nonnegative and the Hessian is positive definite, so this is a global minimum.

Good to know

Rational symmetric Hessians of order 1–4, linear constraints and explicit variable bounds. At most 12 inequality rows remain after equality splitting and adding finite bounds. Nonconvex Hessians are rejected rather than searched heuristically. Exact simplex and fraction-growth limits still apply inside active-set feasibility checks. The tool can return one point on a nonunique optimal face. It does not solve quadratic constraints, nonconvex local minima, general nonlinear programming or integer quadratic optimization.

Positive semidefiniteness turns a stationary certificate into a global result

A symmetric positive-semidefinite Hessian gives no direction of negative curvature. For the supported small matrices, checking every principal minor exactly establishes that property; checking only leading minors would be insufficient for all semidefinite cases. The sign and one-half convention of Q must match the written objective. Entering the coefficients of x² directly on Q’s diagonal without accounting for that half changes the problem.

At a constrained minimum, the gradient need not vanish by itself. Active constraint normals with nonnegative multipliers balance it, while inactive inequalities have zero multipliers. The calculator finds a feasible solution to those linear KKT conditions and substitutes it back into the objective. Because the model is convex, this is an optimality certificate rather than a test that merely classifies one candidate as locally favorable.

A convex quadratic projects its unconstrained center onto an active line boundary(1,2)(1/2,3/2)Active: x+y = 2Minimum: −9/2Multiplier: 1
Minimize x²+y²−2x−4y with x+y≤2. The unconstrained minimizer (1,2) is outside. The constrained point (1/2,3/2) has value −9/2 and multiplier 1 on the active inequality.

Singularity, infeasibility and unboundedness need separate diagnoses

A singular Hessian can leave a flat direction and still have a perfectly valid minimum. It can also allow the linear objective term to decrease indefinitely along a feasible recession direction. The solver tests whether Qd=0, every inequality permits movement along d and cᵀd is negative. A feasible base point and such a direction establish unboundedness; a singular matrix alone does not.

Degenerate active sets can have dependent normals or more tight rows than necessary. The implementation uses exact feasibility of the KKT equations rather than assuming an invertible block system or discarding every singular candidate. The Lagrange multiplier calculator with an equality constraint handles a separate line-or-ellipse family, while the Linear and mixed integer programming calculator from constraints handles zero-curvature objectives and discrete domains. Neither should be advertised as solving this quadratic model merely because their inputs also mention constraints.

A few questions, answered

Must Q be positive definite?

No. Positive semidefinite singular matrices are supported. The result can be nonunique or unbounded, depending on the linear term and feasible directions.

Why are equality constraints counted twice in the row limit?

The active-set representation expresses an equality as both an upper and a lower inequality. Its two nonnegative multipliers can represent an unrestricted equality multiplier.

Find your calculator

Start typing to explore the library.