> For the complete documentation index, see [llms.txt](https://jona-projects.gitbook.io/kiwicalc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jona-projects.gitbook.io/kiwicalc/systems-of-equations/systems-of-linear-equations.md).

# Systems Of Linear Equations

#### System of linear equations

You can solve a system of linear equations via the `solve_linear_system()` method. The method accepts a collection of strings where each string is a linear equation, and optionally also a collection of the variables that appear in the equation. By entering the variables yourself instead of letting the method to deduce them, you save runtime. Here is the signature of method:

```python
def solve_linear_system(equations, variables=None):
                        
```

The method will return a dictionary with the variables as keys and the solutions as the values. Internally, the [Gaussian Elimination method](https://en.wikipedia.org/wiki/Gaussian_elimination) is used to solve the system. For example:

```python
solutions = solve_linear_system(("3x - 4y + 3 = -z + 9", "-3x + 5 -2z = 2y - 9 + x", "2x + 4y - z = 4"))
print(solutions)
                    
```

**class `LinearSystem`**

You can also use the `LinearSystem` class. Creating a `LinearSystem` object will be a bit slower, but will provide with some helpful features, like converting the equation system to a matrix. For more on the LinearSystem class, go to the [LinearSystem](broken://pages/pTRMHHLCs8F75wD3kRE1) section. For instance, lets declare the `LinearSystem` object.

**Properties**

* `variables_dict` - a list of all of the variables\_dict in the
* `equations` - a list of all of the equations(list of strings) in the system.

```python
 linear_system = LinearSystem(("3x - 4y + 3 = -z + 9", "-3x + 5 -2z = 2y - 9 + x", "2x + 4y - z = 4"))
print(linear_system.get_solutions())
# linear_system.solutions - will also work
            
```
