Solve
Solve[expr,vars]
attempts to solve the system expr of equations or inequalities for the variables vars.
Details and Options
 The system expr can be any logical combination of:

lhs==rhs equations lhs!=rhs inequations lhs>rhs or lhs>=rhs inequalities expr∈dom domain specifications {x,y,…}∈reg region specification ForAll[x,cond,expr] universal quantifiers Exists[x,cond,expr] existential quantifiers  Solve[{expr_{1},expr_{2},…},vars] is equivalent to Solve[expr_{1}&&expr_{2}&&…,vars].
 A single variable or a list of variables can be specified.
 Solve gives solutions in terms of rules of the form:

{} no solutions {{x>sol_{x},y>sol_{y},…},…} several solutions {{}} solution set is full dimensional  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[expr,vars] assumes by default that quantities appearing algebraically in inequalities are real, while all other quantities are complex.
 Solve[expr,vars,dom] 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&&vars∈Reals,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.
 Solve[…,x∈reg,Reals] constrains x to be in the region reg. The different coordinates for x can be referred to using Indexed[x,i].
 Algebraic variables in expr free of vars 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 vars.
 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[expr,vars] will always be able to eliminate quantifiers.
 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 noncontinuous parameters, and equations with fulldimensional solutions. Inequations and NotElement conditions on continuous parameters and variables are dropped.
 Solve may use nonequivalent 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. If this happens, an error message is issued.
 Solve uses special efficient techniques for handling sparse systems of linear equations with approximate numerical coefficients.
 The following options can be given:

Assumptions $Assumptions assumptions on parameters Cubics Automatic whether to use explicit radicals to solve all cubics GeneratedParameters C how to name parameters that are generated InverseFunctions Automatic whether to use symbolic inverse functions MaxExtraConditions 0 how many extra equational conditions on continuous parameters to allow MaxRoots Infinity maximum number of roots returned Method Automatic what method should be used Modulus 0 modulus to assume for integers Quartics Automatic whether to use explicit radicals to solve all quartics VerifySolutions Automatic whether to verify solutions obtained using nonequivalent transformations WorkingPrecision Infinity precision to be used in computations  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.
 With Method>Reduce, Solve uses only equivalent transformations and finds all solutions.
 Solve[eqns,…,Modulus>m] solves equations over the integers modulo m. With Modulus>Automatic, Solve will attempt to find the largest modulus for which the equations have solutions.
Examples
open allclose allBasic Examples (5)
Scope (85)
Basic Uses (6)
Solutions are given as lists of replacements:
Use ReplaceAll (/.) to replace by solutions:
Check that solutions satisfy the equations:
Solve uses {} to represent the empty solution or no solution:
Solve uses {{}} to represent the universal solution or all points satisfying the equations:
Find solutions over specified domains:
Solve equations with coefficients involving a symbolic parameter:
Plot the real parts of the solutions for y as a function of the parameter a:
Solution of this equation over the reals requires conditions on the parameters:
Replace x by solutions and simplify the results:
Use Normal to remove the conditions:
Solution of this equation over the positive integers requires introduction of a new parameter:
Complex Equations in One Variable (15)
Polynomial equations solvable in radicals:
To use general formulas for solving cubic equations, set CubicsTrue:
By default, Solve uses Root objects to represent solutions of general cubic equations with numeric coefficients:
Polynomial equations with multiple roots:
Find five roots of a polynomial of a high degree:
Polynomial equations with symbolic coefficients:
Solve cannot find all solutions here:
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:
Find a specified number of roots of an unrestricted complex equation:
Systems of Complex Equations in Several Variables (12)
Linear equations with symbolic coefficients:
Underdetermined systems of linear equations:
Linear equations with no solutions:
Systems of polynomial equations:
Find five out of a trillion roots of a polynomial system:
Polynomial equations with symbolic coefficients:
Find a specified number of solutions of transcendental equations:
Real Equations in One Variable (13)
Polynomial equations with multiple roots:
Polynomial equations with symbolic coefficients:
Transcendental equations, solvable using inverse functions:
Transcendental equations, solvable using special function zeros:
Transcendental inequalities, solvable using special function zeros:
Highdegree sparse polynomial equations:
Algebraic equations involving highdegree radicals:
Equations involving nonrational real powers:
Tame elementary function equations:
Elementary function equations in bounded intervals:
Systems of Real Equations and Inequalities in Several Variables (10)
Quantified polynomial systems:
Transcendental systems, solvable using inverse functions:
Systems explog in the first variable and polynomial in the other variables:
Systems elementary and bounded in the first variable and polynomial in the other variables:
Systems analytic and bounded in the first variable and polynomial in the other variables:
Diophantine Equations (11)
Modular Equations (4)
Equations over Finite Fields (3)
Systems with Mixed Variable Domains (2)
Systems with Geometric Region Constraints (9)
Options (28)
Assumptions (4)
Specify conditions on parameters using Assumptions:
By default, no solutions that require parameters to satisfy equations are produced:
With an equation on parameters given as an assumption, a solution is returned:
Assumptions that contain solve variables are considered to be a part of the system to solve:
Equivalent statement without using Assumptions:
With parameters assumed to belong to a discrete set, solutions involving arbitrary conditions are returned:
Cubics (4)
By default, Solve uses general formulas for solving cubics in radicals only when symbolic parameters are present:
For polynomials with numeric coefficients, Solve does not use the formulas:
With Cubics>False, Solve never uses the formulas:
With Cubics>True, Solve always uses the formulas:
Real roots of irreducible cubics still contain I in their algebraic forms by casus irreducibilis:
Machineprecision numerical evaluation gives a spurious imaginary part:
Arbitraryprecision evaluation still leaves an imaginary part:
With the default setting CubicsAutomatic, explicitly real results are obtained:
GeneratedParameters (1)
Solve may introduce new parameters to represent the solution:
Use GeneratedParameters to control how the parameters are generated:
InverseFunctions (3)
By default, Solve uses inverse functions but prints warning messages:
For symbols with the NumericFunction attribute, symbolic inverses are not used:
With InverseFunctions>True, Solve does not print inverse function warning messages:
Symbolic inverses are used for all symbols:
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:
MaxExtraConditions (4)
By default, no solutions requiring extra conditions are produced:
Unless the parameters are discrete:
The default setting, MaxExtraConditions>0, gives no solutions requiring conditions:
MaxExtraConditions>1 gives solutions requiring up to one equation on parameters:
MaxExtraConditions>2 gives solutions requiring up to two equations on parameters:
Give solutions requiring the minimal number of parameter equations:
By default, Solve drops inequation conditions on continuous parameters:
With MaxExtraConditions>All, Solve includes all conditions:
MaxRoots (4)
Method (1)
Modulus (2)
Quartics (3)
VerifySolutions (1)
Solve verifies solutions obtained using nonequivalent transformations:
With VerifySolutions>False, Solve does not verify the solutions:
Some of the solutions returned with VerifySolutions>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:
WorkingPrecision (1)
By default, Solve finds exact solutions of equations:
Computing the solution using 100digit numbers is faster:
The result agrees with the exact solution in the first 100 digits:
Computing the solution using machine numbers is much faster:
Applications (7)
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 {x,y} plane:
Find a sequence of Pythagorean triples:
Find how to pay $2.27 postage with 10, 23, and 37cent stamps:
The same task can be accomplished with IntegerPartitions:
Properties & Relations (15)
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:
Solve represents solutions in terms of replacement rules:
Reduce represents solutions in terms of Boolean 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 quantifierfree system:
Eliminate eliminates variables from systems of complex equations:
This solves the same problem using Resolve:
Reduce and Solve additionally solve the resulting equations:
is bijective iff the equation has exactly one solution for each :
Use FunctionBijective to test whether a function is bijective:
Use FunctionAnalytic to test whether a function is analytic:
An analytic function can have only finitely many zeros in a closed and bounded region:
Possible Issues (9)
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 nongeneric solutions:
Solve results do not depend on whether some of the input equations contain only parameters. The following two systems are equivalent and have no generic solutions:
Use MaxExtraConditions to specify the number of parameter conditions allowed:
Use the Exists quantifier to find solutions that are valid for some value of parameter :
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>"Reduce" 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:
Interpretation of assumptions depends on their syntactic properties. Here the solution is generic in the parameter space restricted by the assumptions:
This mathematically equivalent assumption contains the solve variable, and hence is treated as a part of the system to solve:
There are no generic solutions, because the input is interpreted as:
The solution is nongeneric, since it requires the parameters to satisfy an equation:
When parameters are restricted to a discrete set, the notion of genericity is not well defined, and all solutions are returned:
Removable singularities of input equations are generally not considered valid solutions:
However, solutions may include removable singularities that are cancelled by automatic simplification:
The removable singularity at is cancelled by evaluation:
Here the removable singularity at is cancelled by Together, which is used to preprocess the equation:
The value of MaxRoots is used only for systems with numeric coefficients:
When symbolic parameters are present, the option value is ignored:
Expressions given as variables are treated as atomic objects and not as functions of their subexpressions:
Effectively, variables are replaced with new symbols before the equations are solved:
Text
Wolfram Research (1988), Solve, Wolfram Language function, https://reference.wolfram.com/language/ref/Solve.html (updated 2024).
CMS
Wolfram Language. 1988. "Solve." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/Solve.html.
APA
Wolfram Language. (1988). Solve. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Solve.html