Enter your values
Set up a quadratic objective
Find the global minimum of a convex quadratic over a closed rectangular region.
Quadratic coefficients
Convexity requires a ≥ 0, c ≥ 0, and ac − b² ≥ 0. The calculator checks the Hessian before optimizing.
Search region
Set the minimum and maximum values for x and y.
The objective uses analytic stationary-point and boundary checks, not a coarse grid search.
What is a convex optimization calculator?
Convex optimization minimizes a convex objective over a convex feasible set. For a quadratic objective and a closed rectangle, this calculator checks the Hessian and compares analytically generated interior, edge, and corner candidates.
Important terms
- Convex objective
- A function whose value along any line segment is no greater than the corresponding linear interpolation of its endpoint values. A positive-semidefinite Hessian certifies convexity for a quadratic.
- Hessian matrix
- The matrix of second partial derivatives. For this quadratic it is constant and symmetric: [[a,b],[b,c]].
- Feasible region
- The closed rectangle defined by the minimum and maximum bounds for x and y.
- Global minimum
- The smallest objective value over every point in the specified feasible region.
When this method is useful
- Study how a quadratic cost changes with two bounded decision variables.
- Check whether a quadratic objective is convex from its Hessian matrix.
- Compare an unconstrained stationary point with minima on the region boundary.
Formula and variables
- a, b, c
- Quadratic coefficients; they determine the Hessian and curvature.
- d, e
- Linear coefficients in x and y.
- k
- Constant term, which shifts every objective value equally.
- x, y
- Decision variables constrained to the entered rectangle.
- H
- The Hessian matrix [[a,b],[b,c]]; convexity requires H to be positive semidefinite.
For a symmetric 2 by 2 Hessian, positive semidefiniteness requires a ≥ 0, c ≥ 0, and ac − b² ≥ 0. The calculator evaluates the interior stationary point when it exists, minimizes the quadratic along each edge, includes all four corners, and selects the smallest feasible value. A continuous function on a closed bounded rectangle attains a minimum, so this candidate comparison gives the global minimum for the accepted convex quadratic model.
Domain note: This calculator handles real-valued quadratic objectives in two variables over an axis-aligned, closed rectangle. It does not accept additional linear constraints, integer restrictions, or nonquadratic terms. Coefficients and bounds must be finite, and each lower bound must be smaller than its upper bound.
How to use this calculator
- 1
Enter a, b, c, d, e, and k for f(x,y) = 1/2 ax² + bxy + 1/2 cy² + dx + ey + k.
- 2
Set lower and upper bounds for x and y. These four values define the feasible rectangle.
- 3
The calculator forms H = [[a,b],[b,c]] and checks a ≥ 0, c ≥ 0, and ac − b² ≥ 0.
- 4
It checks the stationary point inside the rectangle, stationary points on all four edges, and the corners. Boundary points outside the rectangle are clipped to the relevant edge endpoints.
- 5
It evaluates the objective at each distinct feasible candidate and reports the smallest value, its coordinates, and the candidate comparison table.
Step-by-step examples
Example 1
Problem: Minimize f(x,y) = x² + y² − 4x + 2y over −2 ≤ x ≤ 6 and −4 ≤ y ≤ 4.
Substitution: Here a = 2, b = 0, c = 2, d = −4, e = 2, and k = 0. The Hessian is [[2,0],[0,2]], which is positive definite. Setting the gradient (2x−4, 2y+2) equal to zero gives (x,y) = (2,−1), which lies inside the rectangle.
Result: The global minimum is f(2,−1) = −5.
The strictly convex objective has one stationary point, and it is feasible. Therefore that point is the unique global minimum on the rectangle.
Example 2
Problem: Minimize f(x,y) = x² + y² − 12x over 0 ≤ x ≤ 3 and −2 ≤ y ≤ 2.
Substitution: The unconstrained minimum in x would be x = 6, outside the region. On the right edge x = 3, the best y is 0, giving f(3,0) = 9 − 36 = −27.
Result: The constrained global minimum is −27 at (3,0).
A convex objective can attain its constrained minimum on the boundary when its unconstrained minimizer is infeasible.
Rules, edge cases, and related ideas
Convexity makes local minima global
For a convex objective on a convex region, any local minimum is also global. The Hessian check verifies convexity for this quadratic.
Bounds change the optimum
An unconstrained stationary point may lie outside the rectangle. In that case an edge or corner can contain the constrained minimum.
The map is a visual aid
The colored surface shows sampled objective values across the region. Candidate calculations, rather than pixel sampling, determine the answer.
Edge cases and limitations
- A singular positive-semidefinite Hessian can produce a whole line or region of minimizers; the calculator reports one minimum candidate among them.
- If the Hessian fails the positive-semidefinite conditions, the objective is rejected because this tool is specifically for convex optimization.
- If a variable has zero quadratic curvature, a minimum along that direction occurs at a boundary unless the objective is constant in that direction; corner and edge checks cover these cases.
- Very large coefficients or bounds can lose precision and are rejected by the input limits.
How this differs from a related concept
Linear programming uses linear objectives and constraints and often finds optima at polygon vertices. Convex optimization includes curved objectives and feasible sets; here the objective is quadratic while the feasible region is a rectangle. General nonlinear programming may be nonconvex and can have local minima that are not global.
Understand the result
The reported result is the global minimum of the entered convex quadratic on the entered closed rectangle. The objective map is sampled only for visualization; the numerical answer comes from Hessian and candidate calculations, not from choosing the darkest plot cell.
Common mistakes
- Entering a, b, and c as if the formula were ax² + bxy + cy²; this calculator includes one-half factors on the x² and y² terms.
- Assuming the unconstrained stationary point is feasible without checking the entered bounds.
- Ignoring the mixed term bxy when checking convexity; the determinant condition is ac − b² ≥ 0.
- Treating a colored map cell as the exact answer. The map is sampled for display, while the answer is computed from analytic candidates.
Frequently asked questions
What does this convex optimization calculator solve?
It finds the global minimum of a two-variable convex quadratic objective over a closed rectangular region.
How is convexity checked?
The Hessian [[a,b],[b,c]] must be positive semidefinite: a ≥ 0, c ≥ 0, and ac − b² ≥ 0, within numerical tolerance.
Can the minimum occur on a boundary?
Yes. If the unconstrained stationary point lies outside the bounds, the constrained minimum can occur along an edge or at a corner. The solver checks all of these candidates.
Is the objective map used to calculate the answer?
No. It samples the actual entered quadratic to visualize the region. The reported minimum is selected from analytically computed interior, edge, and corner candidates.
Can there be more than one minimum?
Yes. If the Hessian is positive semidefinite but singular, the objective can be flat along a direction. The calculator reports one minimizing point and value.
Does it support extra constraints or integer variables?
No. This version uses only rectangular bounds and continuous real variables. Use a linear, integer, or nonlinear programming tool for other model types.