# How to find generators of right kernel of a matrix

**URL:** https://discourse.julialang.org/t/how-to-find-generators-of-right-kernel-of-a-matrix/71874
**Category:** New to Julia
**Tags:** linearalgebra, matrices, combinatorics
**Created:** [November 22, 2021, 12:38am UTC](https://discourse.julialang.org/t/how-to-find-generators-of-right-kernel-of-a-matrix/71874 "2021-11-22T00:38:35Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![XLVII](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xlvii/32/37099_2.png) [@XLVII](https://discourse.julialang.org/u/XLVII)
#### Post date: [November 22, 2021, 12:38am UTC](https://discourse.julialang.org/t/how-to-find-generators-of-right-kernel-of-a-matrix/71874/1 "2021-11-22T00:38:35Z")

</div>

![ss](https://global.discourse-cdn.com/julialang/original/3X/5/f/5fb35253f5abf4132aeea3a3533542c30ba5a62e.png)

(Matrix R^m x d  
s = subset(1:m,d))

and correspend this math notation.

Is there any funtions for these

---

<div class="post-metadata">

### Author: ![goerch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerch/32/29122_2.png) [@goerch](https://discourse.julialang.org/u/goerch)
#### Post date: [November 22, 2021, 12:46am UTC](https://discourse.julialang.org/t/how-to-find-generators-of-right-kernel-of-a-matrix/71874/2 "2021-11-22T00:46:45Z")

</div>

This is too abstract for me. Could you please translate at least something of it to Julia?

---

<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: [November 22, 2021, 3:52am UTC](https://discourse.julialang.org/t/how-to-find-generators-of-right-kernel-of-a-matrix/71874/3 "2021-11-22T03:52:57Z")

</div>

Do you want a basis (i.e. generating set) for the right nullspace (i.e. right kernel) of a matrix over the reals? You can use the [`nullspace`](https://docs.julialang.org/en/v1/stdlib/LinearAlgebra/#LinearAlgebra.nullspace) function for this.

---

<div class="post-metadata">

### Author: ![XLVII](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xlvii/32/37099_2.png) [@XLVII](https://discourse.julialang.org/u/XLVII)
#### Post date: [December 3, 2021, 10:27am UTC](https://discourse.julialang.org/t/how-to-find-generators-of-right-kernel-of-a-matrix/71874/5 "2021-12-03T10:27:00Z")

</div>

@stevengj

what I expect:

 ![ss](https://global.discourse-cdn.com/julialang/original/3X/b/a/baa8b2029f547e93a167fb4fad9509f244cf4f47.png)

but nulspace give this result:

![ss1](https://global.discourse-cdn.com/julialang/original/3X/c/3/c31e7ea31de4d1f1aeea0a31d223094d21ec8e60.png)

---

<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: [December 3, 2021, 12:36pm UTC](https://discourse.julialang.org/t/how-to-find-generators-of-right-kernel-of-a-matrix/71874/6 "2021-12-03T12:36:52Z")

</div>

The basis is not unique, of course.

Julia is giving an orthonormal basis from the SVD. The Python `right_kernel` function you are calling (from sage?) is giving a non-orthonormal basis that looks like it comes from a reduced row-echelon form algorithm, which is generally not used in numerical calculations (as opposed to symbolic math or hand calculations) because it is not robust to roundoff errors.
