FindInstance

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 OptionsDetails and Options

  • FindInstance[expr,{x1,x2,}] gives results in the same form as Solve: 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
    or 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.
  • Every time you run FindInstance with a given input, it will return the same output.
  • Different settings for the option RandomSeed->s may yield different collections of instances.
  • FindInstance[expr,vars,dom,n] will return a shorter list if the total number of instances is less than n.

ExamplesExamplesopen allclose all

Basic Examples  (6)Basic Examples  (6)

Find a solution instance of a system of equations:

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=

Find an integer solution instance:

In[1]:=
Click for copyable input
Out[1]=

Find Boolean values of variables that satisfy a formula:

In[1]:=
Click for copyable input
Out[1]=

Find several instances:

In[1]:=
Click for copyable input
Out[1]=

Find a point in a geometric region:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2003
(5.0)
| Updated in 2014
(10.0)