ArgMin
Details and Options
- ArgMin finds the global minimum of f subject to the constraints given.
- ArgMin is typically used to find the smallest possible values given constraints. In different areas, this may be called the best strategy, best fit, best configuration and so on.
- If f and cons are linear or polynomial, ArgMin will always find a global minimum.
- The constraints cons can be any logical combination of:
-
lhs==rhs equations lhs>rhs, lhs≥rhs, lhs<rhs, lhs≤rhs inequalities (LessEqual,…) lhsrhs, lhsrhs, lhsrhs, lhsrhs vector inequalities (VectorLessEqual,…) Exists[…], ForAll[…] quantified conditions {x,y,…}∈rdom region or domain specification - ArgMin[{f,cons},x∈rdom] is effectively equivalent to ArgMin[{f,cons∧x∈rdom},x].
- For x∈rdom, the different coordinates can be referred to using Indexed[x,i].
- Possible domains rdom include:
-
Reals real scalar variable Integers integer scalar variable Vectors[n,dom] vector variable in
Matrices[{m,n},dom] matrix variable in 
ℛ vector variable restricted to the geometric region 
- By default, all variables are assumed to be real.
- ArgMin will return exact results if given exact input. With approximate input, it automatically calls NArgMin.
- If the minimum is achieved only infinitesimally outside the region defined by the constraints, or only asymptotically, ArgMin will return the closest specifiable point.
- Even if the same maximum is achieved at several points, only one is returned.
- If the constraints cannot be satisfied, ArgMin returns {Indeterminate,Indeterminate,…}.
- N[ArgMin[…]] calls NArgMin for optimization problems that cannot be solved symbolically.
Examples
open all close allBasic Examples (5)
Find a minimizer point for a univariate function:
ArgMin[2x ^ 2 - 3x + 5, x]Find a minimizer point for a multivariate function:
ArgMin[(x y - 3) ^ 2 + 1, {x, y}]Find a minimizer point for a function subject to constraints:
ArgMin[{x - 2y, x ^ 2 + y ^ 2 ≤ 1}, {x, y}]Find a minimizer point as a function of parameters:
ArgMin[a x ^ 2 + b x + c, x]Find a minimizer point over a geometric region:
ArgMin[x + y, {x, y}∈Disk[]]Show[ContourPlot[x + y, {x, y}∈Disk[]], Graphics[{Red, PointSize[Large], Point[%]}]]Scope (36)
Basic Uses (7)
Minimize
over the unconstrained reals:
ArgMin[Sin[x] + Cos[x], {x}]If the single variable is not given in a list, the result is a value at which the minimum is attained:
ArgMin[Sin[x] + Cos[x], x]Minimize
subject to constraints
:
ArgMin[{x + 2y, x ^ 2 + 2y ^ 2 ≤ 3 && x + y == 2 && x ≥ 1}, {x, y}]Constraints may involve arbitrary logical combinations:
ArgMin[{x y, x ^ 2 + y ^ 2 ≤ 1 || (x + 1) ^ 2 + (y - 1) ^ 2 ≤ 2}, {x, y}]ArgMin[{x + y, x ≤ y ^ 2}, {x, y}]ArgMin[{x + y, x ^ 2 + y ^ 2 < 0}, {x, y}]The infimum value may not be attained:
ArgMin[Exp[x], x]Use a vector variable and a vector inequality:
ArgMin[{{1, 1}.v, {{1, 2}, {1, 0}}.v{3, -1}}, v]Univariate Problems (7)
Unconstrained univariate polynomial minimization:
ArgMin[x ^ 4 + 2x ^ 3 + 5x - 7, x]Constrained univariate polynomial minimization:
ArgMin[{3x ^ 2 - x + 9, 2x ^ 3 + 5x - 7 ≥ 0}, x]ArgMin[E ^ (2E ^ x) - Log[x ^ 2 + 1] - 20x, x]Analytic functions over bounded constraints:
ArgMin[{AiryAi[x + Sin[x]] + Cos[x ^ 2], -5 ≤ x ≤ 5}, x]Plot[AiryAi[x + Sin[x]] + Cos[x ^ 2], {x, -5, 5}, Epilog -> {Red, Point[{%, AiryAi[x + Sin[x]] + Cos[x ^ 2] /. x -> %}]}]ArgMin[{BesselJ[2, x] / Gamma[x + 1] + (x + 1) ^ Sin[x], 0 ≤ x ≤ 10}, x]Plot[BesselJ[2, x] / Gamma[x + 1] + (x + 1) ^ Sin[x], {x, 0, 10}, Epilog -> {Red, Point[{%, BesselJ[2, x] / Gamma[x + 1] + (x + 1) ^ Sin[x] /. x -> %}]}]ArgMin[{Sin[x], -1 / 2 ≤ Cos[x] ≤ 1 / 2}, x]Combination of trigonometric functions with commensurable periods:
ArgMin[Sin[E ^ (x / 3) - 3 x] + 2 Cos[2 E ^ (x / 3) - 6 x + 1] ^ 2, x]ArgMin[{x - Floor[x + UnitStep[x - 1]], Ceiling[Abs[x]] < 5}, x]Unconstrained problems solvable using function property information:
ArgMin[SinhIntegral[DawsonF[x]], x]ArgMin[BesselJ[7 / 4, x ^ 2 + x + 1], x]Multivariate Problems (9)
Multivariate linear constrained minimization:
ArgMin[{2x + 3y - z, 1 ≤ x + y + z ≤ 2 && 1 ≤ x - y + z ≤ 2 && x - y - z == 3}, {x, y, z}]Linear-fractional constrained minimization:
ArgMin[{(2x + y - z) / (5x - 7y + 3), 0 ≤ x + y + z ≤ 1 && 1 ≤ x - y + z ≤ 2 && x - y - z == 3}, {x, y, z}]Unconstrained polynomial minimization:
ArgMin[(x ^ 2 - 2y) ^ 2 - x ^ 2 + 2y - 1, {x, y}]Constrained polynomial optimization can always be solved:
ArgMin[{x y - 1, x ^ 2 + y ^ 2 ≤ 1}, {x, y}]The minimum value may not be attained:
ArgMin[{x ^ 2 + 1, x y ≥ 1}, {x, y}]The objective function may be unbounded:
ArgMin[{x, x y ≤ 1}, {x, y}]There may be no points satisfying the constraints:
ArgMin[{x, x ^ 2 + y ^ 2 < 0}, {x, y}]Quantified polynomial constraints:
ArgMin[{(x + 7)^2 + (y - 8)^2, Subscript[∀, z]Subscript[∃, w]3 z^2 w + (x + y) z^4 - 1 == (x^3 - x y + y^2 - 1) w^2}, {x, y}]ArgMin[{Sqrt[x + y] + x , x Sqrt[y] ≥ 1}, {x, y}]Bounded transcendental minimization:
ArgMin[{E ^ x + Log[y], x Log[y] == 2 && -10 ≤ x ≤ 10 && 1 / 10 ≤ y ≤ 10}, {x, y}]ArgMin[{Max[x - y, Abs[y]], Min[x - 2, x - y ^ 2] ≥ Abs[x y - 1]}, {x, y}]ArgMin[v.{-1, 1}, {VectorGreaterEqual[{{{1, 0}, {0, 1}, {-1, -2}}.v, {0, 0, -2}}, "ExponentialCone"]}, v]Minimize convex objective function
such that
is positive semidefinite and
:
res = ArgMin[{-Log[x + y], (| | |
| ----- | ----- |
| x + y | 1 |
| 1 | x - y |)Underscript[, {"SemidefiniteCone", 2}]0 && 1 ≤ x ≤ 10 && -1 ≤ y ≤ 1}, {x, y}]Plot the region and the minimizing point:
Show[Plot3D[-Log[x + y], {x, 1, 10}, {y, -1, 1}, ...], Graphics3D[{Red, PointSize[0.05], Point[Append[res, -Log[x + y] /. Thread[{x, y} -> res]]]}]]Parametric Problems (4)
Parametric linear optimization:
ArgMin[{-8x - 7y, -6 x - 4 y ≤ 8 - 5 a - 7 b && 7 x + 5 y ≤ a + 4 b && -x + y ≤ 6 + 4a - 5 b && -4 x + 7 y ≤ -1 - 2 a - 7 b && 5 y ≤ 6 - 9 b}, {x, y}]Coordinates of the minimizer point are continuous functions of parameters:
GraphicsRow[Plot3D[#, {a, -3, 3}, {b, 0, 3}, Axes -> False]& /@ %, ImageSize -> Medium]Parametric quadratic optimization:
ArgMin[{(x - 1) ^ 2 + (2y - 1) ^ 2, x + 2y ≤ a + b && 2x - y ≤ a - b + 1 && x - 2y ≤ 2a - b + 1}, {x, y}]Coordinates of the minimizer point are continuous functions of parameters:
GraphicsRow[Plot3D[#, {a, -3, 3}, {b, 0, 3}, Axes -> False]& /@ %, ImageSize -> Medium]Unconstrained parametric polynomial minimization:
ArgMin[x ^ 4 + a x ^ 2 + b, x]Constrained parametric polynomial minimization:
ArgMin[{x ^ 2 + y ^ 2, x ^ 3 + y ^ 2 == a}, {x, y}]Optimization over Integers (3)
ArgMin[{E ^ x - x ^ 3 Log[x], x > 0}, x, Integers]ArgMin[{2x + 3y - z, 1 ≤ x + y + z ≤ 2 && 1 ≤ x - y + z ≤ 2 && x - y - z == 3}, {x, y, z}, Integers]Polynomial minimization over the integers:
ArgMin[{x ^ 2 + x y + 1, x y ≥ 1}, {x, y}, Integers]Optimization over Regions (6)
ℛ = Cylinder[{{1, 2, 3}, {3, 2, 1}}, 1];ArgMin[z, {x, y, z}∈ℛ]Graphics3D[{{Opacity[0.5], Green, ℛ}, {Red, PointSize[Large], Point[%]}}]Find the minimum distance between two regions:
Subscript[ℛ, 1] = Disk[];
Subscript[ℛ, 2] = InfiniteLine[{{-2, 0}, {0, 2}}];ArgMin[(x - u)^2 + (y - v)^2, {{x, y}∈Subscript[ℛ, 1], {u, v}∈Subscript[ℛ, 2]}]//RootReduceGraphics[{{LightBlue, Subscript[ℛ, 1]}, {Green, Subscript[ℛ, 2]}, {Red, Point[Partition[%, 2]]}}]Find the minimum
such that the triangle and ellipse still intersect:
Subscript[ℛ, 1] = Triangle[{{0, 0}, {1, 0}, {0, 1}}];
Subscript[ℛ, 2] = Disk[{1, 1}, {2r, r}];ArgMin[{r, {x, y}∈Subscript[ℛ, 1] && {x, y}∈Subscript[ℛ, 2]}, {r, x, y}]Graphics[{{LightBlue, Subscript[ℛ, 1], Subscript[ℛ, 2]}, {Red, Point[{x, y}]}} /. Thread[{r, x, y} -> %]]Find the disk of minimum radius that contains the given three points:
Subscript[ℛ, 3] = Disk[{a, b}, r];ArgMin[{r, ({0, 0} | {1, 0} | {0, 1})∈Subscript[ℛ, 3]}, {a, b, r}]Graphics[{{LightBlue, Subscript[ℛ, 3]} /. Thread[{a, b, r} -> %], {Red, Point[{{0, 0}, {1, 0}, {0, 1}}]}}]Using Circumsphere gives the same result directly:
Circumsphere[{{0, 0}, {1, 0}, {0, 1}}]Use
to specify that
is a vector in
:
ℛ = Sphere[];ArgMin[x.{1, 2, 3}, x∈ℛ]Find the minimum distance between two regions:
Subscript[ℛ, 1] = Triangle[{{0, 0}, {1, 0}, {0, 1}}];
Subscript[ℛ, 2] = Disk[{2, 2}, 1];ArgMin[(x - y).(x - y), {x∈Subscript[ℛ, 1], y∈Subscript[ℛ, 2]}]//RootReduceGraphics[{{LightBlue, Subscript[ℛ, 1], Subscript[ℛ, 2]}, {Red, Point[%]}}]Options (2)
Method (1)
Specify that ArgMin should use cylindrical algebraic decomposition:
mincad = ArgMin[{x ^ 2 - y ^ 3 + 2x y, x ^ 2 + y ^ 2 == 1}, {x, y}, Method -> "CAD"]minlm = ArgMin[{x ^ 2 - y ^ 3 + 2x y, x ^ 2 + y ^ 2 == 1}, {x, y}, Method -> "LagrangeMultipliers"]mindef = ArgMin[{x ^ 2 - y ^ 3 + 2x y, x ^ 2 + y ^ 2 == 1}, {x, y}]RootReduce[mincad] === RootReduce[minlm] === RootReduce[mindef]WorkingPrecision (1)
Finding an exact minimum point can take a long time:
TimeConstrained[ArgMin[{x ^ 2 + y ^ 2 + z ^ 2, x ^ 2 - 3 x y z + 9 z ^ 2 + y ^ 2 == E && x y z ≤ Pi}, {x, y, z}], 60]With WorkingPrecision->100, you get an approximate minimum point:
ArgMin[{x ^ 2 + y ^ 2 + z ^ 2, x ^ 2 - 3 x y z + 9 z ^ 2 + y ^ 2 == E && x y z ≤ Pi}, {x, y, z}, WorkingPrecision -> 100]//TimingApplications (10)
Basic Applications (3)
Find the lengths of sides of a unit area rectangle with minimal perimeter:
ArgMin[{2x + 2y, x y == 1 && x > 0 && y > 0}, {x, y}]Find the lengths of sides of a unit area triangle with minimal perimeter:
triangle = a > 0 && b > 0 && c > 0 && a + b > c && a + c > b && b + c > a;
s = 1 / 2(a + b + c);ArgMin[{a + b + c, triangle && Sqrt[s(s - a)(s - b)(s - c)] ^ 2 == 1}, {a, b, c}]The minimal perimeter triangle is equilateral:
%//RootReduceFind a point on a parabola closest to its axis:
ArgMin[{Sqrt[x ^ 2 + (y - c) ^ 2], y == a x ^ 2}, {x, y}]Assuming a particular relationship between the
and
parameters:
Assuming[0 < 1 / (2c) < a, Refine@ ArgMin[{Sqrt[x ^ 2 + (y - c) ^ 2], y == a x ^ 2}, {x, y}]]Geometric Distances (6)
The point q in a region ℛ that is nearest to a given point p is given by ArgMin[Norm[p-q],q∈ℛ]. Find the nearest point in Disk[] to {1,1}:
p = {1, 1};
ℛ = Disk[];q = Simplify@ArgMin[{Norm[p - {q1, q2}], {q1, q2}∈ℛ}, {q1, q2}]Graphics[{{LightBlue, EdgeForm[Gray], ℛ}, {Red, Point[{p, q}]}, {Dashed, Line[{p, q}]}}]Find the nearest point to {1,2} in the standard unit simplex Simplex[2]:
p = {1, 2};
ℛ = Simplex[{{0, 0}, {1, 0}, {0, 1}}];q = Simplify@ArgMin[{Norm[p - {q1, q2}], {q1, q2}∈ℛ}, {q1, q2}]Graphics[{{LightBlue, EdgeForm[Gray], ℛ}, {Red, Point[{p, q}]}, {Dashed, Line[{p, q}]}}]Find the nearest point to {1,1,1} in the standard unit sphere Sphere[]:
p = {1, 1, 1};
ℛ = Sphere[];q = Simplify@ArgMin[{Norm[p - {q1, q2, q3}], {q1, q2, q3}∈ℛ}, {q1, q2, q3}]Graphics3D[{{Opacity[0.5], ℛ}, {Red, Point[{p, q}]}, {Dashed, Line[{p, q}]}}]Find the nearest point to {-1,1,1} in the standard unit simplex Simplex[3]:
p = {-1, 1, 1};
ℛ = Simplex[{{0, 0, 0}, {1, 0, 0}, {0, 1, 0}, {0, 0, 1}}];q = Simplify@ArgMin[{Norm[p - {q1, q2, q3}], {q1, q2, q3}∈ℛ}, {q1, q2, q3}]Graphics3D[{{Opacity[0.5], ℛ}, {Red, Point[{p, q}]}, {Dashed, Line[{p, q}]}}]The the nearest points p∈ and q∈ can be found through ArgMin[Norm[p-q],{p∈,q∈}]. Find the nearest points in Disk[{0,0}] and Rectangle[{3,3}]:
𝒫 = Disk[{0, 0}]; 𝒬 = Rectangle[{3, 3}];{pt, qt} = Simplify@ArgMin[Norm[p - q], {p∈𝒫, q∈𝒬}]Norm[pt - qt]//SimplifyGraphics[{{LightBlue, EdgeForm[Gray], 𝒫, 𝒬}, {Red, Point[{pt, qt}]}, {Dashed, Line[{pt, qt}]}}]Find the nearest points in Line[{{0,0,0},{1,1,1}}] and Ball[{5,5,0},1]:
𝒫 = Line[{{0, 0, 0}, {1, 1, 1}}]; 𝒬 = Ball[{5, 5, 0}, 1];{pt, qt} = Simplify@ArgMin[Norm[p - q], {p∈𝒫, q∈𝒬}]Norm[pt - qt]//SimplifyGraphics3D[{{𝒫, {Opacity[0.5], 𝒬}}, {Red, Point[{pt, qt}]}, {Dashed, Line[{pt, qt}]}}]Geometric Centers (1)
If ℛ⊆n is a region that is full dimensional, then the Chebyshev center is the point p∈ℛ that minimizes SignedRegionDistance[ℛ,p], i.e. the negation of the distance to the complement region. Find the Chebyshev center for Disk[]:
ℛ = Disk[];p = ArgMin[SignedRegionDistance[ℛ, {p1, p2}], {p1, p2}∈ℛ]Graphics[{{LightBlue, EdgeForm[Gray], ℛ}, {Red, Point[p]}}]Find the Chebyshev center for Rectangle[]:
ℛ = Rectangle[];p = ArgMin[SignedRegionDistance[ℛ, {p1, p2}], {p1, p2}∈ℛ]Graphics[{{LightBlue, EdgeForm[Gray], ℛ}, {Red, Point[p]}}]Properties & Relations (6)
Minimize gives both the value of the minimum and the minimizer point:
Minimize[{x - 2y, x ^ 2 + y ^ 2 ≤ 1}, {x, y}]ArgMin gives an exact global minimizer point:
f = Expand[Product[(x - i)(x - 100 - i), {i, 5}]];ArgMin[f, x]Plot[f, {x, 0, 100}, Epilog -> {PointSize[Medium], Green, Point[{%, f /. x -> %}]}]NArgMin attempts to find a global minimizer point numerically, but may find a local minimizer:
NArgMin[f, x]Plot[f, {x, 0.5, 5.5}, Epilog -> {PointSize[Medium], Red, Point[{%, f /. x -> %}]}]FindArgMin finds a local minimizer point depending on the starting point:
FindArgMin[f, {x, #}]& /@ {1, 50}Plot[f, {x, 0, 100}, Epilog -> {PointSize[Medium], {Red, Point[{%[[1, 1]], f /. x -> %[[1, 1]]}]}, {Green, Point[{%[[2, 1]], f /. x -> %[[2, 1]]}]}}]The minimum point satisfies the constraints, unless messages say otherwise:
m = ArgMin[{(x - 2) ^ 2 + (y - 3 / 2) ^ 2, x ^ 2 + y ^ 2 ≤ 1}, {x, y}]x ^ 2 + y ^ 2 ≤ 1 /. Thread[{x, y} -> m]The given point minimizes the distance from the point {2,
}:
RegionPlot[x ^ 2 + y ^ 2 ≤ 1, {x, -1.2, 2.2}, {y, -1.2, 2.2}, Epilog -> {PointSize[Medium], {Red, Point[m]}, {Green, Point[{2, 3 / 2}]}}]When the minimum is not attained, ArgMin may give a point on the boundary:
ArgMin[{(x - 2) ^ 2 + (y - 3 / 2) ^ 2, x ^ 2 + y ^ 2 < 1}, {x, y}]Here the objective function tends to the minimum value when y tends to infinity:
ArgMin[{x, x y == 1 && x > 0}, {x, y}]ArgMin can solve linear optimization problems:
ArgMin[{2x + 3y - z, 1 ≤ x + y + z ≤ 2 && 1 ≤ x - y + z ≤ 2 && x - y - z == 3}, {x, y, z}]LinearOptimization can be used to solve the same problem:
LinearOptimization[2x + 3y - z, {1 ≤ x + y + z ≤ 2 && 1 ≤ x - y + z ≤ 2
&& x - y - z == 3}, {x, y, z}]Use RegionNearest to compute a nearest point in the given region:
ℛ = Cone[{{1, 2, 3}, {4, 5, 6}}, 3];
p = {5, 4, 3};RegionNearest[ℛ, p]//RootReduceIt can be computed using ArgMin:
ArgMin[Norm[{x, y, z} - p], {x, y, z}∈ℛ]//RootReduceGraphics3D[{ℛ, {PointSize[Large], {Green, Point[p]}, {Red, Point[%]}}}]Possible Issues (2)
A finite minimum value may not be attained:
ArgMin[{x ^ 2 + 1, x y ≥ 1}, {x, y}]The objective function may be unbounded:
ArgMin[{x, x y ≤ 1}, {x, y}]There may be no points satisfying the constraints:
ArgMin[{x, x ^ 2 + y ^ 2 < 0}, {x, y}]ArgMin requires that all functions present in the input be real valued:
ArgMin[{x + y, Sqrt[x] - Sqrt[y] == 0}, {x, y}]Values for which the equation is satisfied but the square roots are not real are disallowed:
{Sqrt[x] - Sqrt[y] == 0, Sqrt[x], Sqrt[y]} /. {x -> -1, y -> -1}Related Guides
History
Introduced in 2008 (7.0) | Updated in 2014 (10.0) ▪ 2021 (12.3)
Text
Wolfram Research (2008), ArgMin, Wolfram Language function, https://reference.wolfram.com/language/ref/ArgMin.html (updated 2021).
CMS
Wolfram Language. 2008. "ArgMin." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/ArgMin.html.
APA
Wolfram Language. (2008). ArgMin. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArgMin.html
BibTeX
@misc{reference.wolfram_2026_argmin, author="Wolfram Research", title="{ArgMin}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/ArgMin.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_argmin, organization={Wolfram Research}, title={ArgMin}, year={2021}, url={https://reference.wolfram.com/language/ref/ArgMin.html}, note=[Accessed: 13-June-2026]}