Solving Equations - Solve.nb

Solving One Equation with the  "Solve" and "NSolve" Commands

Mathematica can try to solve equations for you. Note that the equation has to have two equal signs!

Solve[x^2 == 2]

Include the variable name you want to solve for, if the choice is not obvious. Here is the quadratic formula:

Solve[ a x^2 + b x  + c == 0, x]

Mathematica always includes complex solutions.

Solve[y^3 == -1, y]

If there are problems, the program will let you know. If it does not know what to do, or just can't do it, it will return the input unchanged.

Solve[Sin[x] == 0, x]

Solve[x == (x^2 - 2  x + 5) Log[x], x]

If you are interested in numerical solutions use "NSolve" instead of "Solve".

NSolve[x^2 == 2]

NSolve[y^3 == -1, y]

NSolve[Sin[x] == 0, x]

NSolve[x - 2 == Log[x], x]

Solving Systems of Equations with the  "Solve" and "NSolve" Commands

This works the same as for one equation. Input the system of equations and the variables to solve for as  lists.

Solve[{x^2 + y^2 == 1, x - 2  y == -2}, {x, y}]

Solve[{x + y^2 == 7, x^2 - y^2 + z^2 == 5}, {x, y}]

Solve[{x + y^2 == 7, x^2 - y^2 + z^2 == 5}, {y, z}]

NSolve[{x + y^2 == 7, x^2 - y^2 + z^2 == 5}, {x, y}]

NSolve[{x + y^2 == 7, x^2 - y^2 + z^2 == 5}, {y, z}]

Etc.

Author: H. Knaust (helmut@math.utep.edu)
Created: August 2000
Last Edits: August 16, 2000