# 求解线性方程组（Solve a linear system，linear_solve）

求解由矩阵和右端项给出的线性方程组 A x = b。

使用这个函数时，求解器只要找到步骤就会展示。

## 怎么写

### linear_solve(matrix, b)

满足 A x = b 的向量 x。

**matrix**

系数矩阵 A。接受一个矩阵，写作行组成的列表。

**b**

右端项，以列表形式给出。接受一个列表。

## 示例

- $\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])`

  在求解器中，`linear_solve([[2, 1], [1, 3]], [3, 5])` 的结果是 `[4/5, 7/5]`。

  [在求解器中打开](https://zh.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)

## 相关函数

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

  数值求解方程。
- [solve](https://zh.hilberon.com/library/solve)

  对一到多个未知量求解方程。
- [solve_all](https://zh.hilberon.com/library/solve_all)

  描述方程和不等式的完整解集。
- [solve_identity](https://zh.hilberon.com/library/solve_identity)

  找出使方程对变量的每个取值都成立的参数值。
- [least_squares](https://zh.hilberon.com/library/least_squares)

  A x = b 的最小二乘解。
- [find_root](https://zh.hilberon.com/library/find_root)

  从起始值出发，用数值方法求一个根。

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