Solving Equations

Introduction

Multiple Solutions

It is not unusual for an equation to have more than one solution. For example,


\send{solve(x\^2 + x = 7);}{MathematicaV}{solve(x^2 + x = 7);[Return]}


gives us two answers in complete detail. You can use assignment to save the
answer even when there is more than one solution. For example,


answers = Solve[x^2 + x == 7, x]


Now the variable answers contains both solutions, as you can verify
by asking Mathematica for its value:


answers


If you want to extract, say, the second solution, you can do so by
indexing the variable:


answers[[2]]


It is not hard to come up with an equation that has an infinite number of
solutions:


Solve[Cos[x] == 0, x]


Mathematica recognizes that fact and gives only one of the solutions. It is not hard
to come up with an equation that Mathematica can't solve. We'll shortly see one,
and discuss what to do about it.

As you have just seen, Mathematica can find none, some, or all of the solutions to
an equation, but it doesn't tell you how many it didn't find. What this
means is that there's no substitute for having a bit of mathematical sense.
You need to have an idea of how many answers you're expecting so that you can
properly interpret Mathematica's solutions.