# solve_triangular#

ivy.solve_triangular(x1, x2, /, *, upper=True, adjoint=False, unit_diagonal=False, out=None)[source]#

Return the unique solution to the triangular system of linear equations AX = B.

Parameters:
• x1 (`Union`[`Array`, `NativeArray`]) – Triangular coefficient array A of shape (…, N, N), with no zeros on diagonal.

• x2 (`Union`[`Array`, `NativeArray`]) – Right-hand side array B of shape (…, N, K).

• upper (`bool`, default: `True`) – Whether the input x1 is upper triangular.

• adjoint (`bool`, default: `False`) – Whether to take the adjoint (conjugate transpose) of x1 as the matrix A.

• unit_diagonal (`bool`, default: `False`) – Whether to ignore the diagonal entries of A and assume them all equal to 1.

• out (`Optional`[`Array`], default: `None`) – Optional output array. If provided, the output array to store the result.

Return type:

`Array`

Returns:

ret – The solution X, which has the same shape as B.

Examples

With `ivy.Array` inputs:

```>>> a = ivy.array([[3, 0, 0, 0],
...                [2, 1, 0, 0],
...                [1, 0, 1, 0],
...                [1, 1, 1, 1]], dtype=ivy.float32)
>>> b = ivy.array([[4],
...                [2],
...                [4],
...                [2]], dtype=ivy.float32)
>>> x = ivy.solve_triangular(a, b, upper=False)
>>> ivy.matmul(a, x)
ivy.array([[4.],
[2.],
[4.],
[2.]])
```