Hadamard Product of Monomial Ideals and the Hadamard Package

: In this paper, we generalize and study the concept of Hadamard product of ideals of projective varieties to the case of monomial ideals. We have a research direction similar to the one of the join of monomial ideals contained in a paper of Sturmfels and Sullivant. In the second part of the paper, we give a brief tutorial on the Hadamard.m2 package of Macaulay2 .


Introduction
The Hadamard product is a sort of multiplication of matrices and in spite of the usual product, it is commutative.This product of matrices is a classical topic in linear algebra that is useful in statistics and physics and it is also studied and used in combinatorial and probabilistic problems.Its applications can be found not only in mathematics but also, for instance, in cryptography, information theory, and data compression such as jpeg format.
Around 2010, in [1,2], the Hadamard product of matrices was extended to the Hadamard product of varieties in the study of the geometry of binary Boltzmann machine.The Hadamard product of varieties is also related to tropical geometry [3][4][5].
Successively, in the last few years, the Hadamard product of projective varieties has been widely studied from the point of view of projective geometry and tropical geometry.
The paper [3], where Hadamard products of general linear spaces are studied, can be considered the first step in this direction, while other papers, for example, Refs.[6][7][8][9][10][11], study the Hadamard product of varieties in relation with star configurations, Hilbert functions, apolarity, and so on.
The computation of the Hadamard product X ⋆ Y of two varieties X and Y can be conducted in terms of suitable projections of Segre Embedding (Definitions 1 and 2) or working with the ideals of X and Y and using Elimination Theory (Definition 3).This second approach has two main benefits: first, we can use Computer Algebra software, such as Macaulay2 [12], to produce explicit computations and examples; secondly, we can generalize the Hadamard product to any kind of ideal, that is, to ideals which are not associated with varieties (for example, monomial ideals, edge ideals, clutter ideals).
This second fact led us to study carefully the behavior of the Hadamard product of monomial ideals.In Proposition 1, we prove that the Hadamard product of square-free monomial ideals is square-free.The class of square-free monomial ideals is a classical object in commutative algebra, which has a strong connection with combinatorial structures and invariants of hypergraphs.We address our research in the spirit of the paper [13], where another operation between ideals, the so-called join (Definition 4), is taken into consideration and the join of monomial ideals is studied.Moving as in [13], but using the Hadamard product instead of the join, we discover that the Hadamard product of two monomial ideals is nothing more than their sum (Theorem 1), a much easier behavior with respect to the join.
Coming back to the first benefit of the algebraic approach, that is, the use of computer algebra software, it is clear that writing down all the instructions for the computation of the Hadamard product of two ideals is not so difficult, but requires some time.For this reason, the first author created the Hadamard.m2package of Macaulay2 which has been verified for Macaulay2 development and it can be found at https://github.com/imanbj/Hadamard-m2(accessed on 1 September 2021).The second part of this paper is intended to be a tutorial that provides a brief introduction to the use of Hadamard.m2for the Hadamard product of varieties.

Preliminaries
We work over an algebraically closed field K.We start defining the Hadamard product of projective varieties in two different ways.

Definition 1 ([3]
).Given varieties X, Y ⊂ P n , we consider the usual Segre product and we denote with z ij the coordinates in P N .Let π : P N P n be the projection map from the linear space Λ defined by equations z ii = 0, i = 0, . . ., n.The Hadamard product of X and Y is where the closure is taken in the Zariski topology.

Definition 2 ([2]
).Let p, q ∈ P n be two points of coordinates [a 0 : a 1 : . . .: a n ] and [b 0 : b 1 : . . .: b n ], respectively.If a i b i ̸ = 0 for some i, their Hadamard product p ⋆ q of p and q, is defined as If a i b i = 0 for all i = 0, . . ., n then we say p ⋆ q is not defined.
We have that Hence, Definition 1 of the Hadamard product corresponds to Definition 2.
Remark 1.We have that Note that the closure of the map π is necessary unless it is defined on all of X × Y, see ([3], Remark 2.4) and Example 5.
We pass on now to defining the Hadamard product using Elimination Theory.Let S = K[x] = K[x 0 , . . ., x N ] be a polynomial ring over an algebraically closed field.Let I 1 , I 2 , . . .I r be ideals in S. We introduce (N + 1)r new unknowns, grouped in r vectors y j = (y j0 , . . ., y jN ), j = 1, 2, . . ., r and we consider the polynomial ring K[x, y] in all (N + 1)r + N + 1 variables.
Let I j (y j ) be the image of the ideal I j in K[x, y] under the map x → y j .
Definition 3. Given ideals I 1 , I 2 , . . .I r ⊂ S, their Hadamard product Thus, the defining ideal of the Hadamard product X ⋆ Y of two varieties X and Y, that is, the ideal I(X ⋆ Y), equals the Hadamard product of the ideals I(X) ⋆ I(Y) (see ([3], Remark 2.6)).
According to [13], we give the following.
Definition 4. Given ideals I 1 , I 2 , . . .I r ⊂ S, their join We define the r-th secant of an ideal I ⊂ K[x] to be the r-fold join I with itself: Similarly, we define the r-th Hadamard power of an ideal I ⊂ K[x] to be the r-fold Hadamard product of I with itself:

Hadamard Products of Monomial Ideals
We start with a preliminary more general result.
Lemma 1.The Hadamard product distributes over intersections: Proof.The proof is analogous to ([14], Lemma 2.6).A polynomial f belongs to (∩J l ) ⋆ K if and only if f (y Example 1.Let N = 0 and consider the ideals I = x i and J = x j .If i ≤ j; then, I ⋆ J = x i .The proof follows from the definition. A special family of monomial ideals is the class of irreducible monomial ideals.An irreducible monomial ideal is represented by an integer vector u = (u 0 , . . . ,u N ) as follows: Example 1 generalizes to irreducible monomial ideals in N + 1 variables.
Lemma 2. The Hadamard product of two irreducible monomial ideals m u and m v is an irreducible monomial ideal m w = x w i i : w i > 0 where This happens if and only if every term (y 1 y 2 ) a lies in (1).Now, x a lies in m u ⋆ m v if and only if every term of lies in m u (y 1 ) + m v (y 2 ) if and only if w i ≤ a i for some i with u i ̸ = 0 or v i ̸ = 0 if and only if x a lies in m w .
The next result shows that the Hadamard product of ideals maintains some property of the starting ideals.
Proof.It is enough to consider the case r = 2 since, then, the general statement follows by induction on r.If I 1 = m u and I 2 = m v are irreducible ideals then both statements follow from Lemma 2. Otherwise, we decompose I 1 = u m u and I 2 = v m v as intersections of irreducible monomials ideals.Using Lemma 1, we then write Thus, I 1 ⋆ I 2 is a monomial ideal, and its set of standard monomials is the union of the sets of standard monomials of its irreducible components m u ⋆ m v .Assume that I 1 and I 2 are square-free.We can decompose I 1 = u m u and I 2 = v m v with 0 < u i , v i ≤ 1, as intersections of irreducible linear monomials ideals.Again by Lemma 1, we then write We can now prove the main result of this section, showing that the Hadamard product of two monomial ideals is equal to their sum.Theorem 1.Let I and J be monomial ideals in K[x].Then I ⋆ J = I + J.
Proof.First, assume that the given ideals are irreducible, say, I = m u and J = m v .Then the result follows by applying Lemma 2. For the general case, we decompose the two given monomial ideals into their irreducible components: I = ∩ ν I ν and J = ∩ µ J µ .By Lemma 1 and the result for irreducible ideals, we get This completes the proof of Theorem 1.
As a corollary, we get immediately the following result.We end this section with a few results about the join and Hadamard product of irreducible monomial ideals, also in connection with the irrelevant ideal M = ⟨x 0 , . . ., x n ⟩.
Proof.The proof follows from Theorem 1.
Proposition 3. Given two irreducible monomial ideals m u and m v , one has Proof.By Lemma 2.3 in [13], the minimal generators of m u * m v are of the form x u i +v i −1 i when u i > 0 and v i > 0. For the same values of u i and v i , the corresponding generator of m u ⋆ m v is given by

Hadamard.m2
We give now some explanations of the commands in Hadamard.m2together with examples.Looking at the documentation page, we can note that the package contains: The function hadamardProduct is one of the main functions in Hadamard.m2.hadamardProduct is multi-functional and works in different ways: it computes the Hadamard products of two ideals, two sets of points, or a list of ideals or points.Hence, according to the aim of computation, hadamardProduct can have a different number of inputs.
Before showing some examples, we mention the mathematical approach inside hadamard-Product.
Let X and Y be two varieties in P n .Denote by I := I(X) ⊂ R = K[x 0 , . . ., x n ] and J := J(Y) ⊂ T = K[y 0 , . . ., y n ] their corresponding vanishing ideals.We consider Let W = K[w 0 , . . ., w n ].We define the map Hence, we have that X ⋆ Y = ker Φ.
Example 3. Consider the ideals I and J.The Hadamard product p ⋆ X is the line y = 0.However, the point [0 : 0 : 1] cannot be obtained as p ⋆ q, with q ∈ X.Note that the map π is not defined on all L × M since point{0,1} * point{1,0} = point{0,0}.
The Hadamard products of a list of ideals or points are constructed by using the binary function hadamardProduct(Ideal,Ideal), or Point * Point iteratively.So, in this case, hadamardProduct requires in input only one argument given by the list, as shown in the following example.
Example 7. Consider again the ideals I and J of Example 3 and let K be an ideal different from I and J.
Give a homogeneous ideal I or a set of points L, the r-th Hadamard power of I or L is computed via the function hadamardPower.The function computes the r-times Hadamard products of I or L to itself.Since coordinate hyperplanes are defined by monomial ideals (with only one variable), Theorem 1 gives another proof of part of the following Lemma.

Corollary 1 .
Let I be a monomial ideal in K[x].Then I ⋆r = I.
In this package, a point can be constructed in two different and equivalent ways: both from a list {} and both from an array [].