# How to get a linsolve solution in matrix form?

**URL:** <https://discourse.julialang.org/t/how-to-get-a-linsolve-solution-in-matrix-form/39710>\
**Category:** General Usage\
**Created:** [May 18, 2020, 5:53pm UTC](https://discourse.julialang.org/t/how-to-get-a-linsolve-solution-in-matrix-form/39710 "2020-05-18T17:53:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorge\_Silva](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jorge_silva/32/14976_2.png) [@Jorge\_Silva](https://discourse.julialang.org/u/Jorge_Silva)\
**Post date:** [May 18, 2020, 5:53pm UTC](https://discourse.julialang.org/t/how-to-get-a-linsolve-solution-in-matrix-form/39710/1 "2020-05-18T17:53:21Z")

</div>

m using SymPy in Julia. My purpose is to solve a homogeneous system of linear equations (Ax=0) with more unknowns than variables (A is not square). Then, Im using the following code.

```julia
using SymPy

x, y, z, w = symbols("x y z w")

M = sympy.Matrix(((9, 2, 1,- 4, 0), (-4, -3, -1, -5, 0)))

s = linsolve(M, (x, y, z, w))

```

With this code Im able to get the correct solution. However, I´dont known how to manipulate that solution. The final goal is to be able to get the solution in matrix form as lines representing (x and y) and column (z and w). (since x(z, w) and y(z,w)).

Thanks

---

<div class="post-metadata">

**Author:** ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)\
**Post date:** [May 18, 2020, 11:10pm UTC](https://discourse.julialang.org/t/how-to-get-a-linsolve-solution-in-matrix-form/39710/2 "2020-05-18T23:10:57Z")

</div>

`linsolve` returns a `FiniteSet`. The conversion doesn’t happen automatically here, but you can get julia objects through `collect(convert(Set,s))`.

---

<div class="post-metadata">

**Author:** ![ccmejia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccmejia/32/18680_2.png) [@ccmejia](https://discourse.julialang.org/u/ccmejia)\
**Post date:** [November 18, 2024, 1:57am UTC](https://discourse.julialang.org/t/how-to-get-a-linsolve-solution-in-matrix-form/39710/3 "2024-11-18T01:57:30Z")

</div>

Hi there! The instruction `collect(convert(Set,s))`, at least for me, just display as a markdown expression the solution. However, how can I effectively manipulate this expression?
