WOLFRAM

FindInstance[expr,vars]

finds an instance of vars that makes the statement expr be True.

FindInstance[expr,vars,dom]

finds an instance over the domain dom. Common choices of dom are Complexes, Reals, Integers, and Booleans.

FindInstance[expr,vars,dom,n]

finds n instances.

Details and Options

  • FindInstance[expr,{x1,x2,}] gives results in the same form as Solve: {{x1->val1,x2->val2,}} if an instance exists, and {} if it does not.
  • expr can contain equations, inequalities, domain specifications and quantifiers, in the same form as in Reduce.
  • The statement expr can be any logical combination of:
  • lhs==rhsequations
    lhs!=rhsinequations
    lhs>rhs or lhs>=rhs inequalities
    exprdomdomain specifications
    {x,y,}regregion specification
    ForAll[x,cond,expr]universal quantifiers
    Exists[x,cond,expr]existential quantifiers
  • With exact symbolic input, FindInstance gives exact results.
  • Even if two inputs define the same mathematical set, FindInstance may still pick different instances to return.
  • The instances returned by FindInstance typically correspond to special or interesting points in the set.
  • FindInstance[expr,vars] assumes by default that quantities appearing algebraically in inequalities are real, while all other quantities are complex.
  • FindInstance[expr,vars,Integers] finds solutions to Diophantine equations.
  • FindInstance[expr,vars,Booleans] solves Boolean satisfiability for expr.
  • FindInstance[expr,vars,Reals] assumes that not only vars but also all function values in expr are real. FindInstance[expr&&varsReals,vars] assumes only that the vars are real.
  • FindInstance[,xreg,Reals] constrains x to be in the region reg. The different coordinates for x can be referred to using Indexed[x,i].
  • FindInstance may be able to find instances even if Reduce cannot give a complete reduction.
  • By default, every time you run FindInstance with a given input, it will return the same output.
  • FindInstance[expr,vars,dom,n] will return a shorter list if the total number of instances is less than n.
  • The following options can be given:
  • MethodAutomaticmethod to use
    Modulus 0modulus to assume for integers
    RandomSeeding 1234how to seed randomness
    WorkingPrecision Infinityprecision to use in internal computations

Examples

open allclose all

Basic Examples  (6)Summary of the most common use cases

Find a solution instance of a system of equations:

Out[1]=1

Find a real solution instance of a system of equations and inequalities:

Out[1]=1

Find an integer solution instance:

Out[1]=1

Find Boolean values of variables that satisfy a formula:

Out[1]=1

Find several instances:

Out[1]=1

Find a point in a geometric region:

Out[1]=1
Out[2]=2

Scope  (57)Survey of the scope of standard use cases

Complex Domain  (11)

A linear system:

Out[1]=1

A univariate polynomial equation:

Out[1]=1

Five roots of a polynomial of a high degree:

Out[1]=1

A multivariate polynomial equation:

Out[1]=1

Systems of polynomial equations and inequations:

Out[1]=1

This gives three solution instances:

Out[2]=2

If there are no solutions FindInstance returns an empty list:

Out[3]=3

If there are fewer solutions than the requested number, FindInstance returns all solutions:

Out[4]=4

Five out of a trillion roots of a polynomial system:

Out[1]=1

Quantified polynomial system:

Out[1]=1

An algebraic system:

Out[1]=1

Transcendental equations:

Out[1]=1
Out[2]=2

In this case there is no solution:

Out[3]=3

A solution in terms of transcendental Root objects:

Out[4]=4

Five roots of an unrestricted equation:

Out[5]=5

Systems of transcendental equations:

Out[3]=3

Three roots of a transcendental system:

Out[1]=1

Real Domain  (13)

A linear system:

Out[1]=1

A univariate polynomial equation:

Out[1]=1

A univariate polynomial inequality:

Out[1]=1

A multivariate polynomial equation:

Out[1]=1

A multivariate polynomial inequality:

Out[1]=1

Systems of polynomial equations and inequalities:

Out[1]=1

Get four solution instances:

Out[2]=2

If there are no solutions FindInstance returns an empty list:

Out[3]=3

If there are fewer solutions than the requested number, FindInstance returns all solutions:

Out[4]=4

A quantified polynomial system:

Out[1]=1

An algebraic system:

Out[1]=1

Piecewise equations:

Out[1]=1
Out[2]=2

Piecewise inequalities:

Out[1]=1
Out[2]=2

Transcendental equations:

Out[1]=1
Out[2]=2

A solution in terms of transcendental Root objects:

Out[3]=3

Transcendental inequalities:

Out[1]=1
Out[2]=2

Transcendental systems:

Out[1]=1
Out[2]=2
Out[3]=3

Integer Domain  (12)

A linear system of equations:

Out[1]=1

A linear system of equations and inequalities:

Out[1]=1

Find more than one solution:

Out[2]=2

A univariate polynomial equation:

Out[1]=1

A univariate polynomial inequality:

Out[1]=1

Binary quadratic equations:

Out[1]=1
Out[2]=2
Out[3]=3

A Thue equation:

Out[1]=1

If there are fewer solutions than the requested number, FindInstance returns all solutions:

Out[2]=2

A sum of squares equation:

Out[1]=1

The Pythagorean equation:

Out[1]=1

A bounded system of equations and inequalities:

Out[1]=1

A high-degree system with no solution:

Out[1]=1

Transcendental Diophantine systems:

Out[1]=1
Out[2]=2

A polynomial system of congruences:

Out[1]=1

Modular Domains  (5)

A linear system:

Out[1]=1

A univariate polynomial equation:

Out[1]=1

A multivariate polynomial equation:

Out[1]=1

Find seven instances:

Out[2]=2

A system of polynomial equations and inequations:

Out[1]=1

A quantified polynomial system:

Out[1]=1

Finite Field Domains  (4)

Univariate equations:

Out[2]=2
Out[3]=3

Systems of linear equations:

Out[1]=1
Out[2]=2

Systems of polynomial equations:

Out[1]=1

Find three instances:

Out[2]=2

Systems involving quantifiers:

Out[1]=1
Out[2]=2

Mixed Domains  (3)

Mixed real and complex variables:

Out[1]=1

Find a real value of and a complex value of for which is real and less than :

Out[1]=1

An inequality involving Abs[z]:

Out[1]=1
Out[2]=2

Geometric Regions  (9)

Find instances in basic geometric regions in 2D:

Out[3]=3

Plot it:

Out[4]=4

Find instances in basic geometric regions in 3D:

Out[2]=2

Plot it:

Out[3]=3

Find a point in the projection of a region:

Plot it:

Out[3]=3

An implicitly defined region:

Out[2]=2

A parametrically defined region:

Out[2]=2

Derived regions:

Out[2]=2

Plot it:

Out[3]=3

Regions dependent on parameters:

Out[2]=2

Find values of parameters , , and for which the circles contain the given points:

Out[2]=2

Plot it:

Out[3]=3

Use to specify that is a vector in :

Out[2]=2

In this case is a vector in :

Out[4]=4

Options  (3)Common values & functionality for each option

Modulus  (1)

Find a solution over the integers modulo 9:

Out[1]=1

Find three solutions:

Out[2]=2

RandomSeeding  (1)

Finding instances often involves random choice from large solution sets:

Out[1]=1

By default, FindInstance chooses the same solutions each time:

Out[2]=2

Use RandomSeedingAutomatic to generate potentially new instances each time:

Out[3]=3

WorkingPrecision  (1)

Finding an exact solution to this problem is hard:

Out[1]=1

With a finite WorkingPrecision, FindInstance is able to find an approximate solution:

Out[2]=2

Applications  (11)Sample problems that can be solved with this function

Geometric Problems  (6)

The region is a subset of if R\S is empty. Show that Disk[{0,0},{2,1}] is a subset of Rectangle[{-2,-1},{2,1}]:

Out[4]=4

Plot it:

Out[5]=5

Show that Rectangle[] is a not a subset of Disk[{0,0},7/5]:

Out[2]=2

Plot it:

Out[3]=3

Show that Cylinder[]Ball[{0,0,0},2]:

Out[2]=2

Plot it:

Out[3]=3

Show that Cylinder[]Ball[{0,0,0},7/5]:

Out[2]=2

Plot it:

Out[3]=3

Find a point in the intersection of two regions:

Out[1]=1
Out[3]=3

Find a counterexample to a geometric conjecture:

Out[2]=2

Prove the conjecture using stronger assumptions:

Out[4]=4

Boolean Problems  (2)

Prove that a statement is a tautology:

Out[2]=2

This can be proven with TautologyQ as well:

Out[3]=3

Show that a statement is not a tautology; get a counterexample:

Out[2]=2

This can be done with SatisfiabilityInstances as well:

Out[3]=3

Integer Problems  (3)

Find a Pythagorean triple:

Out[1]=1

Find Pythagorean triples when they exist:

Out[2]=2

Two instances are now found when :

Out[3]=3

Find Pythagorean quadruples and visualize the result:

Out[1]=1

Generate all solutions for and visualize the result:

Out[3]=3

Show that there are no 2×2 magic squares with all numbers unequal:

Out[1]=1

Properties & Relations  (10)Properties of the function, and connections to other functions

Solution instances satisfy the input system:

Out[2]=2

Use RootReduce to prove that algebraic numbers satisfy equations:

Out[2]=2
Out[3]=3

When there are no solutions, FindInstance returns an empty list:

Out[1]=1

If there are fewer solutions than the requested number, FindInstance returns all solutions:

Out[1]=1

To get a complete description of the solution set use Reduce:

Out[1]=1
Out[2]=2

To get a generic solution of a system of complex equations use Solve:

Out[1]=1

Solving a sum of squares representation problem:

Out[1]=1

Use SquaresR to find the number of solutions to sum of squares problems:

Out[2]=2

Solving a sum of powers representation problem:

Out[1]=1

Use PowersRepresentations to enumerate all solutions:

Out[2]=2

Find instances satisfying a Boolean statement:

Out[2]=2

Use SatisfiabilityInstances to obtain solutions represented as Boolean vectors:

Out[3]=3

FindInstance shows that the polynomial is non-negative:

Out[2]=2

Use PolynomialSumOfSquaresList to represent as a sum of squares:

Out[3]=3
Out[4]=4

The Motzkin polynomial is non-negative, but is not a sum of squares:

Out[6]=6
Out[7]=7

Neat Examples  (1)Surprising or curious use cases

Integer solutions for a Thue equation:

Out[1]=1
Out[2]=2
Wolfram Research (2003), FindInstance, Wolfram Language function, https://reference.wolfram.com/language/ref/FindInstance.html (updated 2024).
Wolfram Research (2003), FindInstance, Wolfram Language function, https://reference.wolfram.com/language/ref/FindInstance.html (updated 2024).

Text

Wolfram Research (2003), FindInstance, Wolfram Language function, https://reference.wolfram.com/language/ref/FindInstance.html (updated 2024).

Wolfram Research (2003), FindInstance, Wolfram Language function, https://reference.wolfram.com/language/ref/FindInstance.html (updated 2024).

CMS

Wolfram Language. 2003. "FindInstance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/FindInstance.html.

Wolfram Language. 2003. "FindInstance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/FindInstance.html.

APA

Wolfram Language. (2003). FindInstance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindInstance.html

Wolfram Language. (2003). FindInstance. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindInstance.html

BibTeX

@misc{reference.wolfram_2025_findinstance, author="Wolfram Research", title="{FindInstance}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/FindInstance.html}", note=[Accessed: 27-March-2025 ]}

@misc{reference.wolfram_2025_findinstance, author="Wolfram Research", title="{FindInstance}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/FindInstance.html}", note=[Accessed: 27-March-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_findinstance, organization={Wolfram Research}, title={FindInstance}, year={2024}, url={https://reference.wolfram.com/language/ref/FindInstance.html}, note=[Accessed: 27-March-2025 ]}

@online{reference.wolfram_2025_findinstance, organization={Wolfram Research}, title={FindInstance}, year={2024}, url={https://reference.wolfram.com/language/ref/FindInstance.html}, note=[Accessed: 27-March-2025 ]}