# Problems with quotient modules (AbstractAlgebra)

**URL:** <https://discourse.julialang.org/t/problems-with-quotient-modules-abstractalgebra/70071>\
**Category:** General Usage\
**Created:** [October 19, 2021, 9:47pm UTC](https://discourse.julialang.org/t/problems-with-quotient-modules-abstractalgebra/70071 "2021-10-19T21:47:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gilles\_Dubois](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gilles_dubois/32/25830_2.png) [@Gilles\_Dubois](https://discourse.julialang.org/u/Gilles_Dubois)\
**Post date:** [October 19, 2021, 9:47pm UTC](https://discourse.julialang.org/t/problems-with-quotient-modules-abstractalgebra/70071/1 "2021-10-19T21:47:28Z")

</div>

Hi everybody !

Here’s the ‘coercions’ paragraph of the ‘modules’ chapter of AbstractAlgebra package doc.  
[https://nemocas.github.io/AbstractAlgebra.jl/dev/module/](https://nemocas.github.io/AbstractAlgebra.jl/dev/module/)

```julia
Coercions

Given a module M and an element n of a module N, it is possible to coerce n into M using the notation M(n) in certain circumstances.

In particular the element n will be automatically coerced along any canonical injection of a submodule map and along any canonical projection of a quotient map. There must be a path from N to M along such maps.

Examples

F = FreeModule(ZZ, 3)

S1, f = sub(F, [rand(F, -10:10)])

S, g = sub(F, [rand(F, -10:10)])
Q, h = quo(F, S)

m = rand(S1, -10:10)
n = Q(m)

```

I cannot say that it is perfectly clear, so I decided to write a few lines of code to make it clear (at least for me…)  
Here is this test code :

```julia
using AbstractAlgebra

F = FreeModule(ZZ, 3)
@show F
v=F([1,2,3])
@show v
S,f=sub(F,[v])
@show S
@show f
w=S([ZZ(2)]) # S([2]) not accepted !!!
@show w
w1=f(w)
@show w1
Q, h = quo(F, S)
@show gens(Q) # shows canonical basis of z^2
v1=F([2,3,4])
n=Q(v1)
@show n

```

here’s the output :

```julia
F = Free module of rank 3 over Integers
v = (1, 2, 3)
S = Submodule over Integers with 1 generator and no relations

f = Module homomorphism with
Domain: Submodule over Integers with 1 generator and no relations

Codomain: F
w = (2)
w1 = (2, 4, 6)
gens(Q) = AbstractAlgebra.Generic.QuotientModuleElem{BigInt}[(1, 0), (0, 1)]
n = (-1, -2)

```

Of course if I take for w1 any multiple of (1,2,3) result for n will be logically (0,0) . Of course a pair is expected since the rank of the quotient is 2 BUT here I took on purpose (1,1,1)+(1,2,3) so that the image by h of w1 is the same as that of (1,1,1).  
How to explain this result (-1,-2). As far as I know the quotient is isomorphic to any supplementary subspace of S, but there’s no canonical basis for this.  
Can anybody explain to me where this (-1,-2) comes from ?  
Thank you.

---

<div class="post-metadata">

**Author:** ![thofma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thofma/32/1691_2.png) [@thofma](https://discourse.julialang.org/u/thofma)\
**Post date:** [October 20, 2021, 7:49pm UTC](https://discourse.julialang.org/t/problems-with-quotient-modules-abstractalgebra/70071/2 "2021-10-20T19:49:49Z")

</div>

```julia
julia> preimage(h, gens(Q)[1])
(0, 1, 0)

julia> preimage(h, gens(Q)[2])
(0, 0, 1)

```

so these two elements (more precisely the images of these two elements) is “the” basis of `Q = F/<s>`. Now if you take the element `(2, 3, 4)` and reduce modulo `s`, you get `(0, -1, -2)`, which has coordinates `(-1, -2)` with respect to the basis of `Q`. (Here reducing means substracting `2*s`).

---

<div class="post-metadata">

**Author:** ![Gilles\_Dubois](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gilles_dubois/32/25830_2.png) [@Gilles\_Dubois](https://discourse.julialang.org/u/Gilles_Dubois)\
**Post date:** [October 20, 2021, 8:44pm UTC](https://discourse.julialang.org/t/problems-with-quotient-modules-abstractalgebra/70071/3 "2021-10-20T20:44:48Z")

</div>

Thanks again for your new contribution. I need some time to read, assimilate and possibly understand it. For now things are not clear.  
I’ll write later, hopefully to say that everything is OK.

---

<div class="post-metadata">

**Author:** ![Gilles\_Dubois](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gilles_dubois/32/25830_2.png) [@Gilles\_Dubois](https://discourse.julialang.org/u/Gilles_Dubois)\
**Post date:** [October 20, 2021, 8:56pm UTC](https://discourse.julialang.org/t/problems-with-quotient-modules-abstractalgebra/70071/4 "2021-10-20T20:56:34Z")

</div>

OK I’ve got it.  
I was blocked by the word ‘preimage’ in French we use instead ‘antecedent’ (which is before).  
I understand your example now I will try with a plane for S, consequently Q should be a straight line.  
I come back to you after achievement

---

<div class="post-metadata">

**Author:** ![Gilles\_Dubois](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gilles_dubois/32/25830_2.png) [@Gilles\_Dubois](https://discourse.julialang.org/u/Gilles_Dubois)\
**Post date:** [October 20, 2021, 9:17pm UTC](https://discourse.julialang.org/t/problems-with-quotient-modules-abstractalgebra/70071/5 "2021-10-20T21:17:06Z")

</div>

I think I have it now here’s a second example :

```julia
using AbstractAlgebra

F = FreeModule(ZZ, 3)
@show F
v=F([1,2,3])
w=F([1,1,0])
@show v
S,f=sub(F,[v,w])
@show S
@show f
Q, h = quo(F, S)
@show gens(Q)
t=F([1,1,1])
n=Q(t)
@show n
u=preimage(h,gen(Q,1))
@show u

```

we get 1 for n given that u=(0,0,1) and reducing t by t-w which incidentally is exactly u.  
The thing is that any strict subspace cannot contain all the canonical base and you can take as preimages a certain number of them (according dimensions and respective positions). Simply the rule of such choice is not explicit.  
Thanks again for your time and attention.
