# Link to this section Summary

## Functions

The solution of a system of linear equations by using Cramer’s formula

A value that can be computed from the elements of a square `matrix`. Geometrically, it can be viewed as the scaling factor of the linear transformation described by the `matrix`

The `first_minor` of a `matrix` obtained by removing just the `i`-row and the `j`-column from the `matrix`. It is required for calculating cofactors, which in turn are useful for computing both the determinant and inverse of square matrices. `i` and `j` are zero based

A matrix whose rows are the columns of the original

# Link to this section Functions

Link to this function cramer_solution(coefficients, constants) View Source

The solution of a system of linear equations by using Cramer’s formula.

## Examples

``````iex> Emel.Math.Algebra.cramer_solution([[2.0, 3.0],
...>                                    [4.0, 9.0]],
...>                                   [6.0, 15.0])
{:ok, [1.5, 1.0]}

iex> Emel.Math.Algebra.cramer_solution([[1.0, 3.0,-2.0],
...>                                    [3.0, 5.0, 6.0],
...>                                    [2.0, 4.0, 3.0]],
...>                                   [5.0, 7.0, 8.0])
{:ok, [-15.0, 8.0, 2.0]}

iex> Emel.Math.Algebra.cramer_solution([[0.0, 0.0],
...>                                    [3.0, 5.0]],
...>                                   [0.0, 12.0])
{:error, :no_unique_solution}``````

A value that can be computed from the elements of a square `matrix`. Geometrically, it can be viewed as the scaling factor of the linear transformation described by the `matrix`.

## Examples

``````iex> Emel.Math.Algebra.determinant([[3.0, 8.0],
...>                                [4.0, 6.0]])
-14.0

iex> Emel.Math.Algebra.determinant([[6.0, 1.0, 1.0],
...>                                [4.0,-2.0, 5.0],
...>                                [2.0, 8.0, 7.0]])
-306.0

iex> Emel.Math.Algebra.determinant([[4.0, 3.0, 2.0, 2.0],
...>                                [0.0, 1.0,-3.0, 3.0],
...>                                [0.0,-1.0, 3.0, 3.0],
...>                                [0.0, 3.0, 1.0, 1.0]])
-240.0``````
Link to this function first_minor(matrix, i, j) View Source

The `first_minor` of a `matrix` obtained by removing just the `i`-row and the `j`-column from the `matrix`. It is required for calculating cofactors, which in turn are useful for computing both the determinant and inverse of square matrices. `i` and `j` are zero based.

## Examples

``````iex> Emel.Math.Algebra.first_minor([[ 1.0, 4.0, 7.0],
...>                                [ 3.0, 0.0, 5.0],
...>                                [-1.0, 9.0,11.0]],
...>                                1,
...>                                2)
[[ 1.0, 4.0],
[-1.0, 9.0]]

iex> Emel.Math.Algebra.first_minor([[6.0, 1.0, 1.0],
...>                                [4.0,-2.0, 5.0],
...>                                [2.0, 8.0, 7.0]],
...>                                0,
...>                                0)
[[-2.0, 5.0],
[ 8.0, 7.0]]

iex> Emel.Math.Algebra.first_minor([[ 5.0,-7.0, 2.0, 2.0],
...>                                [ 0.0, 3.0, 0.0,-4.0],
...>                                [-5.0,-8.0, 0.0, 3.0],
...>                                [ 0.0, 5.0, 0.0,-6.0]],
...>                                0,
...>                                2)
[[ 0.0, 3.0,-4.0],
[-5.0,-8.0, 3.0],
[ 0.0, 5.0,-6.0]]``````

A matrix whose rows are the columns of the original.

## Examples

``````iex> Emel.Math.Algebra.transpose([[1.0, 4.0],
...>                              [3.0, 0.0]])
[[1.0, 3.0],
[4.0, 0.0]]

iex> Emel.Math.Algebra.transpose([[6.0, 1.0, 1.0],
...>                              [4.0,-2.0, 5.0],
...>                              [2.0, 8.0, 7.0]])
[[6.0, 4.0, 2.0],
[1.0,-2.0, 8.0],
[1.0, 5.0, 7.0]]``````