# 8.12 Primary Decomposition of IdealsΒΆ

FriCAS provides a facility for the primary decomposition ideal:primary decomposition of primary decomposition of ideal polynomial ideals over fields of characteristic zero. The algorithm is discussed in \cite{gtz:gbpdpi} and works in essentially two steps:

- the problem is solved for 0-dimensional ideals by generic projection on the last coordinate
- a reduction process uses localization and ideal quotients to reduce the general case to the 0-dimensional one.

The FriCAS constructor PolynomialIdeals represents ideals with coefficients in any field and supports the basic ideal operations, including intersection, sum and quotient. IdealDecompositionPackage contains the specific operations for the primary decomposition and the computation of the radical of an ideal with polynomial coefficients in a field of characteristic 0 with an effective algorithm for factoring polynomials.

The following examples illustrate the capabilities of this facility.

First consider the ideal generated by x2+y2-1 (which defines a circle in the (x,y)-plane) and the ideal generated by x2-y2 (corresponding to the straight lines x=y and x=-y.

```
(n,m) : List DMP([x,y],FRAC INT)
```

_{Type: Void}

```
m := [x^2+y^2-1]
```

[x2+y2-1] |

_{Type: List DistributedMultivariatePolynomial([x,y],Fraction Integer)}

```
n := [x^2-y^2]
```

[x2-y2] |

_{Type: List DistributedMultivariatePolynomial([x,y],Fraction Integer)}

We find the equations defining the intersection of the two loci. This correspond to the sum of the associated ideals.

```
id := ideal m + ideal n
```

[x2-12,y2-12] |

_{Type: PolynomialIdeals(Fraction Integer,}
DirectProduct(2,NonNegativeInteger),OrderedVariableList [x,y],
DistributedMultivariatePolynomial([x,y],Fraction Integer))

We can check if the locus contains only a finite number of points, that is, if the ideal is zero-dimensional.

```
zeroDim? id
```

true |

_{Type: Boolean}

```
zeroDim?(ideal m)
```

false |

_{Type: Boolean}

```
dimension ideal m
```

1 |

_{Type: PositiveInteger}

We can find polynomial relations among the generators ( f and g are the parametric equations of the knot).

```
(f,g):DMP([x,y],FRAC INT)
```

_{Type: Void}

```
f := x^2-1
```

x2-1 |

_{Type: DistributedMultivariatePolynomial([x,y],Fraction Integer)}

```
g := x*(x^2-1)
```

x3-x |

_{Type: DistributedMultivariatePolynomial([x,y],Fraction Integer)}

```
relationsIdeal [f,g]
```

_{Type: SuchThat(List Polynomial Fraction Integer, List Equation}
Polynomial Fraction Integer)

We can compute the primary decomposition of an ideal.

```
l: List DMP([x,y,z],FRAC INT)
```

_{Type: Void}

```
l:=[x^2+2*y^2,x*z^2-y*z,z^2-4]
```

[x2+2y2,xz2-yz,z2-4] |

_{Type: List DistributedMultivariatePolynomial([x,y,z],Fraction Integer)}

```
ld:=primaryDecomp ideal l
```

[[x+12y,y2,z+2],[x-12y,y2,z-2]] |

_{Type: List PolynomialIdeals(Fraction Integer,}
DirectProduct(3,NonNegativeInteger), OrderedVariableList [x,y,z],
DistributedMultivariatePolynomial([x,y,z],Fraction Integer))

We can intersect back.

```
reduce(intersect,ld)
```

[x-14yz,y2,z2-4] |

_{Type: PolynomialIdeals(Fraction Integer,}
DirectProduct(3,NonNegativeInteger), OrderedVariableList [x,y,z],
DistributedMultivariatePolynomial([x,y,z],Fraction Integer))

We can compute the radical of every primary component.

```
reduce(intersect,[radical ld.i for i in 1..2])
```

[x,y,z2-4] |

_{Type: PolynomialIdeals(Fraction Integer,}
DirectProduct(3,NonNegativeInteger), OrderedVariableList [x,y,z],
DistributedMultivariatePolynomial([x,y,z],Fraction Integer))

Their intersection is equal to the radical of the ideal of l.

```
radical ideal l
```

[x,y,z2-4] |

_{Type: PolynomialIdeals(Fraction Integer,}
DirectProduct(3,NonNegativeInteger), OrderedVariableList [x,y,z],
DistributedMultivariatePolynomial([x,y,z],Fraction Integer))