# Nullspace in exact arithmetics

**URL:** https://discourse.julialang.org/t/nullspace-in-exact-arithmetics/125471
**Category:** General Usage
**Created:** [February 2, 2025, 12:13pm UTC](https://discourse.julialang.org/t/nullspace-in-exact-arithmetics/125471 "2025-02-02T12:13:32Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![azoviktor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/azoviktor/32/206405_2.png) [@azoviktor](https://discourse.julialang.org/u/azoviktor)
#### Post date: [February 2, 2025, 12:13pm UTC](https://discourse.julialang.org/t/nullspace-in-exact-arithmetics/125471/1 "2025-02-02T12:13:33Z")

</div>

Is there a generic Julia implementation of a nullspace in exact arithmetics? I.e., I am interested in `nullspace(A::AbstractMatrix{T})`, where `T` is _any_ field number datatype. The return type of the method would be again `AbstractMatrix{T}`. Or should I implement it myself through Gaussian elimination?

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [February 2, 2025, 12:36pm UTC](https://discourse.julialang.org/t/nullspace-in-exact-arithmetics/125471/2 "2025-02-02T12:36:20Z")

</div>

Nemo.jl might be able to do this? See e.g. [this stackoverflow answer](https://stackoverflow.com/questions/39255580/exact-integer-nullspace-of-integer-matrix).

Also [GitHub - jmichel7/GenLinearAlgebra.jl: Linear algebra on an arbitrary field or ring](https://github.com/jmichel7/GenLinearAlgebra.jl) has a `nullspace` function and says that it does exact calculations over any field/ring.

---

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [February 2, 2025, 12:53pm UTC](https://discourse.julialang.org/t/nullspace-in-exact-arithmetics/125471/3 "2025-02-02T12:53:31Z")

</div>

also LinearAlgebraX.jl

---

<div class="post-metadata">

### Author: ![azoviktor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/azoviktor/32/206405_2.png) [@azoviktor](https://discourse.julialang.org/u/azoviktor)
#### Post date: [February 2, 2025, 1:02pm UTC](https://discourse.julialang.org/t/nullspace-in-exact-arithmetics/125471/4 "2025-02-02T13:02:53Z")

</div>

Unfortunately, it works only on `ZZMatrix`, a datatype defined by Nemo. It won’t work, for example, on `Rational{Int}` datatype. Otherwise, GenLinearAlgebra.jl might work for me, thanks!

---

<div class="post-metadata">

### Author: ![azoviktor](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/azoviktor/32/206405_2.png) [@azoviktor](https://discourse.julialang.org/u/azoviktor)
#### Post date: [February 2, 2025, 1:03pm UTC](https://discourse.julialang.org/t/nullspace-in-exact-arithmetics/125471/5 "2025-02-02T13:03:19Z")

</div>

Thanks. It seems that this is exactly what I was looking for.
