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

Advanced Topic: Algebraic NumbersEquations Involving Functions

3.4.4 Simultaneous Equations

You can give Solve a list of simultaneous equations to solve. Solve can find explicit solutions for a large class of simultaneous polynomial equations.

Here is a simple linear equation with two unknowns.

In[1]:= Solve[ { a x + b y == 1, x - y == 2 } , {x, y} ]


Here is a more complicated example. The result is a list of solutions, with each solution consisting of a list of transformation rules for the variables.

In[2]:= Solve[{x^2 + y^2 == 1, x + y == a}, {x, y}]


You can use the list of solutions with the /. operator.

In[3]:= x^3 + y^4 /. % /. a -> 0.7


Even when Solve cannot find explicit solutions, it often can "unwind" simultaneous equations to produce a symbolic result in terms of Root objects.

In[4]:= First[ Solve[{x^2 + y^3 == x y, x + y + x y == 1},

{x, y}] ]


You can then use N to get a numerical result.

In[5]:= N[ % ]


The variables that you use in Solve do not need to be single symbols. Often when you set up large collections of simultaneous equations, you will want to use expressions like a[i] as variables.

Here is a list of three equations for the a[i].

In[6]:= Table[ 2 a[i] + a[i-1] == a[i+1], {i, 3} ]


This solves for some of the a[i].

In[7]:= Solve[ % , {a[1], a[2], a[3]} ]


Solving simultaneous equations.

If you do not explicitly specify objects to solve for, Solve will try to solve for all the variables.

In[8]:= Solve[ { x + y == 1, x - 3 y == 2 } ]


Ways to present simultaneous equations to Solve.

If you construct simultaneous equations from matrices, you typically get equations between lists of expressions.

In[9]:= {{3,1},{2,-5}}.{x,y}=={7,8}


Solve converts equations involving lists to lists of equations.

In[10]:= Solve[%, {x, y}]


You can use LogicalExpand to do the conversion explicitly.

In[11]:= LogicalExpand[%%]


Advanced Topic: Algebraic NumbersEquations Involving Functions