# Solve equations (solve)

Solve equations for one or more unknowns.

With this function, the solver shows the steps whenever it finds them.

## How to write it

### solve(equations, variables)

Solve for the unknowns.

**equations**

What to solve; a list of equations is a system. Takes an equation, or a list of equations in brackets.

**variables**

A variable, or a list of variables such as \[x, y\]. Takes a variable, or a list of variables.

### solve(equations, variables, domain = real|complex)

Solve over the real or over the complex numbers.

**equations**

What to solve; a list of equations is a system. Takes an equation, or a list of equations in brackets.

**variables**

A variable, or a list of variables such as \[x, y\]. Takes a variable, or a list of variables.

**domain = real|complex**

Where to work: the real or the complex numbers. Takes real or complex.

## Examples

- $\displaystyle x^{2}-4 = 0 \Rightarrow x = -2,\quad x = 2$

  `solve(x^2 - 4 = 0, x)`

  In the solver, `solve(x^2 - 4 = 0, x)` gives `[[x -> -2], [x -> 2]]`.

  [Open in the solver](https://hilberon.com/?q=solve%28x%5E2%20-%204%20%3D%200%2C%20x%29)
- $\displaystyle \begin{cases} x+y = 3 \\ x-y = 1 \end{cases} \Rightarrow (x, y) = (2, 1)$

  `solve([x + y = 3, x - y = 1], [x, y])`

  In the solver, `solve([x + y = 3, x - y = 1], [x, y])` gives `[[x -> 2, y -> 1]]`.

  [Open in the solver](https://hilberon.com/?q=solve%28%5Bx%20%2B%20y%20%3D%203%2C%20x%20-%20y%20%3D%201%5D%2C%20%5Bx%2C%20y%5D%29)
- $\displaystyle x^{2}+1 = 0 \Rightarrow x = -i,\quad x = i$

  `solve(x^2 + 1 = 0, x, domain = complex)`

  In the solver, `solve(x^2 + 1 = 0, x, domain = complex)` gives `[[x -> -i], [x -> i]]`.

  [Open in the solver](https://hilberon.com/?q=solve%28x%5E2%20%2B%201%20%3D%200%2C%20x%2C%20domain%20%3D%20complex%29)

## Related functions

- [solve_all](https://hilberon.com/library/solve_all)

  Describe the complete solution set of equations and inequalities.
- [numeric_solve](https://hilberon.com/library/numeric_solve)

  Solve equations numerically.
- [solve_identity](https://hilberon.com/library/solve_identity)

  Find the values of the parameters that make an equation true for every value of the variable.
- [linear_solve](https://hilberon.com/library/linear_solve)

  Solve a linear system A x = b given by its matrix and right-hand side.
- [eliminate](https://hilberon.com/library/eliminate)

  Eliminate variables from a system of equations, leaving equations in the others.
- [least_squares](https://hilberon.com/library/least_squares)

  The least-squares solution of A x = b.

---
Source: https://hilberon.com/library/solve
