# Solve a linear system (linear_solve)

Solve a linear system A x = b given by its matrix and right-hand side.

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

## How to write it

### linear_solve(matrix, b)

The vector x with A x = b.

**matrix**

The coefficient matrix A. Takes a matrix, written as a list of rows.

**b**

The right-hand side, as a list. Takes a list.

## Examples

- $\displaystyle \begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix} \mathbf{x} = \begin{pmatrix} 3 \\ 5 \end{pmatrix} \Rightarrow \left[ \frac{4}{5}, \frac{7}{5} \right]$

  `linear_solve([[2, 1], [1, 3]], [3, 5])`

  In the solver, `linear_solve([[2, 1], [1, 3]], [3, 5])` gives `[4/5, 7/5]`.

  [Open in the solver](https://hilberon.com/?q=linear_solve%28%5B%5B2%2C%201%5D%2C%20%5B1%2C%203%5D%5D%2C%20%5B3%2C%205%5D%29)

## Related functions

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

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

  Solve equations for one or more unknowns.
- [solve_all](https://hilberon.com/library/solve_all)

  Describe the complete solution set of equations and inequalities.
- [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.
- [least_squares](https://hilberon.com/library/least_squares)

  The least-squares solution of A x = b.
- [find_root](https://hilberon.com/library/find_root)

  Find a root numerically, from a starting value.

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