This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Solve

Solve
attempts to solve the system expr of equations or inequalities for the variables vars.
Solve
solves over the domain dom. Common choices of dom are Reals, Integers, and Complexes.
  • The system expr can be any logical combination of:
lhs==rhsequations
lhs!=rhsinequations
or inequalities
exprdomdomain specifications
ForAll[x,cond,expr]universal quantifiers
Exists[x,cond,expr]existential quantifiers
  • A single variable or a list of variables can be specified.
  • Solve gives solutions in terms of rules of the form .
  • When there are several variables, the solution is given in terms of lists of rules: .
  • When there are several solutions, Solve gives a list of them.
  • When a single variable is specified and a particular root of an equation has multiplicity greater than one, Solve gives several copies of the corresponding solution.
  • Solve assumes by default that quantities appearing algebraically in inequalities are real, while all other quantities are complex.
  • Solve restricts all variables and parameters to belong to the domain dom.
  • If dom is Reals, or a subset such as Integers or Rationals, then all constants and function values are also restricted to be real.
  • Solve[expr&&varsReals, vars, Complexes] solves for real values of variables, but function values are allowed to be complex.
  • Solve[expr, vars, Integers] solves Diophantine equations over the integers.
  • Algebraic variables in expr free of the and of each other are treated as independent parameters.
  • Solve deals primarily with linear and polynomial equations.
  • When expr involves only polynomial equations and inequalities over real or complex domains, then Solve can always in principle solve directly for all the .
  • When expr involves transcendental conditions or integer domains, Solve will often introduce additional parameters in its results.
  • Solve can give explicit representations for solutions to all linear equations and inequalities over the integers, and can solve a large fraction of Diophantine equations described in the literature.
  • When expr involves only polynomial conditions over real or complex domains, Solve will always be able to eliminate quantifiers.
  • The following options can be given:
CubicsFalsewhether to use explicit radicals to solve all cubics
GeneratedParametersChow to name parameters that are generated
InverseFunctionsAutomaticwhether to use symbolic inverse functions
MaxExtraConditions0how many extra equational conditions on continuous parameters to allow
MethodAutomaticwhat method should be used
Modulus0modulus to assume for integers
QuarticsFalsewhether to use explicit radicals to solve all quartics
VerifySolutionsAutomaticwhether to verify solutions obtained using non-equivalent transformations
WorkingPrecisionInfinityprecision to be used in computations
  • Solve gives generic solutions only. Solutions that are valid only when continuous parameters satisfy equations are removed. Other solutions that are only conditionally valid are expressed as ConditionalExpression objects.
  • Conditions included in ConditionalExpression solutions may involve inequalities, Element statements, equations and inequations on non-continuous parameters, and equations with full-dimensional solutions. Inequations and NotElement conditions on continuous parameters and variables are dropped.
  • With MaxExtraConditions->Automatic, only solutions that require the minimal number of equational conditions on continuous parameters are included.
  • With MaxExtraConditions->All, solutions that require arbitrary conditions on parameters are given and all conditions are included.
  • With MaxExtraConditions->k, only solutions that require at most k equational conditions on continuous parameters are included.
  • Solve uses non-equivalent transformations to find solutions of transcendental equations and hence it may not find some solutions and may not establish exact conditions on the validity of the solutions found.
  • With Method->Reduce, Solve uses only equivalent transformations and finds all solutions.
  • Solve gives if there are no possible solutions to the equations.
  • Solve gives if the set of solutions is full-dimensional.
  • Solve solves equations over the integers modulo m. With Modulus->Automatic, Solve will attempt to find the largest modulus for which the equations have solutions.
  • Solve uses special efficient techniques for handling sparse systems of linear equations with approximate numerical coefficients.
Solve a quadratic equation:
Solve simultaneous equations in and :
Solutions are given as lists of replacements:
Replace by solutions:
Replace combinations of and by solutions, and simplify the results:
Plot the real parts of the solutions for as a function of the parameter :
Pick out the third solution:
Solve an equation over the reals:
Replace by solutions and simplify the results:
Solve an equation over the positive integers:
List the first 10 solutions:
Solve a quadratic equation:
In[1]:=
Click for copyable input
Out[1]=
 
Solve simultaneous equations in and :
In[1]:=
Click for copyable input
Out[1]=
 
Solutions are given as lists of replacements:
In[1]:=
Click for copyable input
Out[1]=
Replace by solutions:
In[2]:=
Click for copyable input
Out[2]=
Replace combinations of and by solutions, and simplify the results:
In[3]:=
Click for copyable input
Out[3]=
Plot the real parts of the solutions for as a function of the parameter :
In[4]:=
Click for copyable input
Out[4]=
 
Pick out the third solution:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Solve an equation over the reals:
In[1]:=
Click for copyable input
Out[1]=
Replace by solutions and simplify the results:
In[2]:=
Click for copyable input
Out[2]=
 
Solve an equation over the positive integers:
In[1]:=
Click for copyable input
Out[1]=
List the first 10 solutions:
In[2]:=
Click for copyable input
Out[2]=
Polynomial equations solvable in radicals:
General polynomial equations:
Polynomial equations with multiple roots:
Polynomial equations with symbolic coefficients:
Algebraic equations:
Transcendental equations:
Univariate elementary function equations over bounded regions:
Univariate holomorphic function equations over bounded regions:
Here Solve finds some solutions but is not able to prove there are no other solutions:
Equation with a purely imaginary period over a vertical stripe in the complex plane:
Symbolic functions:
Systems of linear equations:
Linear equations with symbolic coefficients:
Underdetermined systems of linear equations:
Linear equations with no solutions:
Systems of polynomial equations:
Polynomial equations with symbolic coefficients:
Algebraic equations:
Transcendental equations:
Polynomial equations:
Polynomial equations with multiple roots:
Polynomial equations with symbolic coefficients:
Algebraic equations:
Piecewise equations:
Transcendental equations, solvable using inverse functions:
Transcendental equations, solvable using special function zeros:
Transcendental inequalities, solvable using special function zeros:
Exp-log equations:
High-degree sparse polynomial equations:
Algebraic equations involving high-degree radicals:
Equations involving non-rational real powers:
Equation with a double root:
Tame elementary function equations:
Elementary function equations in bounded intervals:
Holomorphic function equations in bounded intervals:
Periodic elementary function equations over the reals:
Linear systems:
Polynomial systems:
Quantified polynomial systems:
Algebraic systems:
Piecewise systems:
Transcendental systems, solvable using inverse functions:
Systems exp-log in the first variable and polynomial in the other variables:
Quantified system:
Systems elementary and bounded in the first variable and polynomial in the other variables:
Quantified system:
Systems holomorphic and bounded in the first variable and polynomial in the other variables:
Quantified system:
Linear systems of equations:
Linear systems of equations and inequalities:
Univariate polynomial equations:
Binary quadratic equations:
Thue equations:
Sum of squares equations:
The Pythagorean equation:
Bounded systems of equations and inequalities:
High-degree systems with no solutions:
Transcendental Diophantine systems:
Polynomial systems of congruences:
Linear systems:
Univariate polynomial equations:
Systems of polynomial equations and inequations:
Quantified polynomial systems:
Mixed real and complex variables:
Mixed real and integer variables:
All variables are solved for:
By default, Solve uses general formulas for solving cubics in radicals:
With Cubics->False, Solve does not use the formulas:
Solve may introduce new parameters to represent the solution:
Use GeneratedParameters to control how the parameters are generated:
By default, Solve uses inverse functions but prints warning messages:
With InverseFunctions->True, Solve does not print inverse function warning messages:
With InverseFunctions->False, Solve does not use inverse functions:
Solving algebraic equations does not require using inverse functions:
Here, a method based on Reduce is used, as it does not require using inverse functions:
By default, no solutions requiring extra conditions are produced:
Unless the parameters are discrete:
The default setting, MaxExtraConditions, gives no solutions requiring conditions:
MaxExtraConditions gives solutions requiring up to one equation on parameters:
MaxExtraConditions gives solutions requiring up to two equations on parameters:
Give solutions requiring the minimal number of parameter equations:
Give all solutions:
By default, Solve drops inequation conditions on continuous parameters:
With MaxExtraConditions->All, Solve includes all conditions:
By default, Solve uses inverse functions to solve non-polynomial complex equations:
With Method->Reduce, Solve uses Reduce to find the complete solution set:
Solve equations over the integers modulo 9:
Find a modulus for which a system of equations has a solution:
By default, Solve uses the general formulas for solving quartics in radicals:
With Quartics->False, Solve does not use the formulas:
Solve verifies solutions obtained using non-equivalent transformations:
With False, Solve does not verify the solutions:
Some of the solutions returned with False are not correct:
This uses a fast numeric test in an attempt to select correct solutions:
In this case numeric verification gives the correct solution set:
By default, Solve does not verify solutions of equations with inexact coefficients:
In some of the solutions returned, polys are quite far from zero:
With True, Solve increases the precision of computations when needed:
The values of polys at the solutions are now much closer to zero:
By default, Solve finds exact solutions of equations:
Computing the solution using 100-digit numbers is faster:
The result agrees with the exact solution in the first 100 digits:
Computing the solution using machine numbers is much faster:
The result is still quite close to the exact solution:
Solve a quadratic equation:
Find intersection points of a circle and a parabola:
Find conditions for a quartic to have all roots equal:
A method using Subresultants:
A method using quantifier elimination:
Plot a space curve given by an implicit description:
Plot the projection of the space curve on the plane:
Find a Pythagorean triple:
Find a sequence of Pythagorean triples:
Find how to pay $2.27 postage with 10-, 23-, and 37-cent stamps:
The same task can be accomplished with IntegerPartitions:
Solutions satisfy the equations:
Solutions are given as replacement rules and can be directly used for substitution:
Solve uses to represent the empty solution or no solution:
Solve uses to represent the universal solution or all points satisfying the equations:
For univariate equations, Solve repeats solutions according to their multiplicity:
Solutions of algebraic equations are often given in terms of Root objects:
Use N to compute numeric approximations of Root objects:
Root objects may involve parameters:
Use Series to compute series expansions of Root objects:
The series satisfies the equation up to order 11:
Find solutions over specified domains:
Solutions may involve conditions on parameters:
Conditional solutions satisfy the equations, provided the conditions are satisfied:
Solve represents solutions in terms of replacement rules:
Reduce represents solutions in terms of combinations of equations and inequalities:
Solve uses fast heuristics to solve transcendental equations, but may give incomplete solutions:
Reduce uses methods that are often slower, but finds all solutions and gives all necessary conditions:
Use FindInstance to find solution instances:
Like Reduce, FindInstance can be given inequalities and domain specifications:
Use DSolve to solve differential equations:
Use RSolve to solve recurrence equations:
SolveAlways gives the values of parameters for which complex equations are always true:
The same problem can be expressed using ForAll and solved with Solve or Reduce:
Resolve eliminates quantifiers, possibly without solving the resulting quantifier-free system:
Eliminate eliminates variables from systems of complex equations:
This solves the same problem using Resolve:
Reduce and Solve additionally solve the resulting equations:
Solve gives generic solutions; solutions involving equations on parameters are not given:
Reduce gives all solutions, including those that require equations on parameters:
With MaxExtraConditions->All, Solve also gives non-generic solutions:
Solve does not eliminate solutions that are neither generically correct nor generically incorrect:
The solutions are correct for and incorrect for :
For transcendental equations Solve may not give all solutions:
Use Reduce to get all solutions:
Solve with Method uses Reduce to find solutions, but returns replacement rules:
Using inverse functions allows Solve to find some solutions fast:
Finding the complete solution may take much longer and the solution may be large:
This finds the values of n for which x==2 is a solution:
New in 1 | Last modified in 8