# 10. Alternating forms on modules¶

This notebook is part of the Introduction to manifolds in SageMath by Andrzej Chrzeszczyk (Jan Kochanowski University of Kielce, Poland).

In [1]:
version()

Out[1]:
'SageMath version 9.6, Release Date: 2022-05-15'

Warning: In this notebook $M$ denotes a module --- not a manifold

### Reminder. Bases and dual bases¶

Le us assume that $e=(e_1,\ldots,e_n)$ is a basis in a finite dimensional vector space $V$ or more generally finite rank free module $M$ over a ring $R$ (defined in notebook 6), so every vector $v$ can be uniquely represented as a linear combination $v=\sum_i\alpha_i e_i=\alpha_i e_i$, $\ \alpha_i\in R$.

Example 10.1

Define a basis in a 3-dimensional module over the symbolic ring SR.

In [2]:
N=3                                         # dim. of the module M
%display latex
M = FiniteRankFreeModule(SR, 3, name='M')   # module M
e = M.basis('e') ;e                         # basis of M

Out[2]:
$\displaystyle \left(e_{0},e_{1},e_{2}\right)$

If $(e_1,\ldots,e_n)$ is a basis we denote by $(e^1,\ldots,e^n)$ the dual basis, i.e. the family of linear forms $M\to R$, such that $e^i(e_j)=\delta_j^i= \begin{cases} 1,& \text{if } i=j,\\ 0, & \text{otherwise.} \end{cases}$

Example 10.2

Let us define the dual basis to the basis from the previous example.

In [3]:
# continuation
d=e.dual_basis()
matrix(N,N,lambda i,j:d[i](e[j]))           # matrix of all e^i(e_j)

Out[3]:
$\displaystyle \left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right)$

### Elements of dual basis are coordinate functions¶

If $(e_1,\ldots,e_n)$ is a basis and $(e^1,\ldots,e^n)$ its dual basis, then for $w=\alpha_je_j$ we have

$$e^i(w)=e^i(\alpha_je_j)=\alpha_je^i(e_j)=\alpha_j\delta^i_j=\alpha_i,$$

so the $i$-th element of the dual basis is the $i$-th coordinate function: $$e^i(\alpha_je_j)=\alpha_i.$$

Example 10.3

For example let us check the values of all elements of the dual basis $d=(e^0,e^1,e^2)$ on the vector $w=\alpha_0e_0+\alpha_1e_1+\alpha_2e_2$.

In [4]:
# continuation
al=var('α',n=N)                        #\alpha+{Tab}
w=sum([al[k]*e[k] for k in range(N)])  # w=al_k*e_k
w.disp()                               # show w

Out[4]:
$\displaystyle α_{0} e_{0} + α_{1} e_{1} + α_{2} e_{2}$
In [5]:
[d[i](w) for i in range(N)] # compute  e^i(w) for i=0,1,2,

Out[5]:
$\displaystyle \left[α_{0}, α_{1}, α_{2}\right]$

### Permutations¶

By a permutation of a set $Y$ we mean a bijection $\sigma: Y\to Y$. In the sequel we will restrict ourselves to finite sets $Y=\{1,2,\ldots,k\}.$ In that case, the permutation is just the reordering $(1,2,\ldots,k)\to(\sigma(1),\sigma(2),\ldots,\sigma(k)).$ To define a permutation, it is sufficient to define the image $(\sigma(1),\sigma(2),\ldots,\sigma(k))$.

Example 10.4

We can define a permutation of the set $(1,2,3)$ by its image $(p(1),p(2),p(3))$.

In [6]:
p = Permutation([2,1,3]);p    # (1,2,3)->(2,1,3)

Out[6]:
$\displaystyle [2, 1, 3]$

The action of $p$ on (1,2,3):

In [7]:
a = [1,2,3]                   # a -sequence to permute
p.action(a)                   # permutation of a

Out[7]:
$\displaystyle \left[2, 1, 3\right]$

### Sign of permutation¶

The permutations form a group if we define the multiplication as the composition: $\sigma\tau=\sigma\circ\tau.$ The group of permutations of the set $\{1,2,\ldots,k\}$ is usually denoted by ${S_k}$.

An inversion of a permutation $\sigma$ is a pair $(i, j)$ such that $i < j$ and $\sigma(i) > \sigma(j)$. A permutation is even or odd depending on whether it is the product of an even or odd number of inversions. The sign of a permutation $\sigma$, denoted by $\mathrm{sign}(\sigma)$ is defined to be +1 or -1 depending on whether the permutation is even or odd. The sign of permutations satisfies

$$\mathrm{sign}(\sigma\tau)=\mathrm{sign}(\sigma)\mathrm{sign}(\tau).$$

Example 10.5

Let us compute for example the sign of the permutation $(4,2,1,3,5)$ of $(1,2,3,4,5)$.

In [8]:
p=Permutation([4,2,1,3,5])
sign(p)

Out[8]:
$\displaystyle 1$
In [9]:
# even number of inversions
p.inversions()

Out[9]:
$\displaystyle \left[\left(1, 2\right), \left(1, 3\right), \left(1, 4\right), \left(2, 3\right)\right]$
In [10]:
p.number_of_inversions()

Out[10]:
$\displaystyle 4$

Example 10.6

Now let us list all permutations from $S_3$ and their signs.

In [11]:
S3=Permutations(3).list()  # S_3
[(p,sign(p)) for p in S3]  # signs of all permutations from S_3

Out[11]:
$\displaystyle \left[\left([1, 2, 3], 1\right), \left([1, 3, 2], -1\right), \left([2, 1, 3], -1\right), \left([2, 3, 1], 1\right), \left([3, 1, 2], 1\right), \left([3, 2, 1], -1\right)\right]$

## Alternating forms¶

Let $M^k=M\times\dots\times M,$ where $M$ is a vector space or a module. Recall that by a $k$-linear form on $M$ (or covariant tensor of type $(0,k)$) we mean a function $t: M^k\to R$ which is linear in each of its arguments, i.e for $i=1,\ldots,k$

$$t(v_1,\ldots,\alpha v_i+\beta w_i,\ldots, v_k)= \alpha t(v_1,\ldots,v_i,\ldots,v_k)+\beta t(v_1,\ldots,w_i,\ldots, v_k),\quad \alpha,\beta\in R,\quad v_i,w_i\in M.$$

A $k$-linear form $t:M^k\to R$ is alternating if it changes sign every time two of its variables are interchanged, that is, if

$$t (v_1 , . . . , v_i , . . . , v_j , . . . , v_k ) = −t (v_1 , . . . , v_j , . . . , v_i , . . . , v_k ).$$

Let us recall that in the notebook 9a the $k$-linear forms on $M$ were called covariant tensors from $T^{(0,k)}M$.

In notations used by SageMath the module of alternating $k$-forms on a module $M$ is denoted by $\Lambda^k(M^*)$ ( it is a submodule of $T^{(0,k)}M$).

Example 10.7

Define a 3-linear form and alternating 3-form on a module M.

In [12]:
M = FiniteRankFreeModule(SR, 3, name='M')  # module M of rank 3 over SR
# SR is a field, so M is vect.sp.
e = M.basis('e')                           # basis of M
t=M.tensor((0,3),name='t');print(t)        # covariant tensor of type (0,3)

Type-(0,3) tensor t on the 3-dimensional vector space M over the Symbolic Ring


For alternating forms we have a special command: alternating_form.

In [13]:
a=M.alternating_form(3);a                  # alternating form on M

Out[13]:
$\displaystyle \mbox{Alternating form of degree 3 on the 3-dimensional vector space M over the Symbolic Ring}$
In [14]:
# the mathematical object of which "a" is an element.
print(a.parent())
show(a.parent())

3rd exterior power of the dual of the 3-dimensional vector space M over the Symbolic Ring

$\displaystyle \Lambda^{3}\left(M^*\right)$

### Antisymmetrization operation¶

If $t$ is a covariant tensor from $T^{(0,k)}M$, then we can define an alternating $k$-form called Alt($t$) in the following way $$\mathrm{Alt}(t)(v_1,\ldots,v_k)=\frac{1}{k!}\sum_{\sigma\in S_k}\mathrm{sign}(\sigma)\;t(v_{\sigma(1)},\ldots,v_{\sigma(k)}), \label{}\tag{10.1}$$ for $v_i\in M$.

The antisymmetrization operation in SageMath Manifolds is accessible by the method antisymmetrize.

Example 10.8

Let us define a tensor of type $(0,2)$ on a 3-dimensional module $M$ and its antisymmetrization.

In [15]:
M = FiniteRankFreeModule(SR, 3, name='M')  # module M of rank 3
e = M.basis('e')                           # basis of M
t = M.tensor((0,2)); print('t:',t)         # tensor of type (0,2)
t[:] = [[1,-2,3], [4,5,6], [7,8,-9]];      # components of t
ta=t.antisymmetrize();print('ta:',ta)      # antisymmetrization of t

t: Type-(0,2) tensor on the 3-dimensional vector space M over the Symbolic Ring
ta: Alternating form of degree 2 on the 3-dimensional vector space M over the Symbolic Ring


In the next series of cells we try to show some details of the antisymmetrization operation Alt.

Example 10.9

If $k=2$ there are only two permutations in $S_k$, with signs +1, -1 so the sum from the antisymmetrization definition (10.1), applied to $\ t=t_{ij}e^i\otimes e^j,\ i,j=0,1\$ computed on the vectors $(v_0,v_1)=(e_0,e_1)$ reduces to $\frac{1}{2!}(t_{01}-t_{10})$.

Define tensor $t$:

In [16]:
%display latex
N=3
Mo = FiniteRankFreeModule(SR, N, name='Mo') # 3-dim module M
e = Mo.basis('e')                           # basis of M
t=Mo.tensor((0,2))                          # (0,2) type tensor
symb_mat=[[var('t'+str(i)+str(j))
for j in range(N)] for i in range(N)]   # matrix of components
t[:]=symb_mat                               # define all components
t.disp()                                    # show t

Out[16]:
$\displaystyle t_{00} e^{0}\otimes e^{0} + t_{01} e^{0}\otimes e^{1} + t_{02} e^{0}\otimes e^{2} + t_{10} e^{1}\otimes e^{0} + t_{11} e^{1}\otimes e^{1} + t_{12} e^{1}\otimes e^{2} + t_{20} e^{2}\otimes e^{0} + t_{21} e^{2}\otimes e^{1} + t_{22} e^{2}\otimes e^{2}$

and list components of $t$ in the sum (10.1):

In [17]:
S2=Permutations(2).list()               # list of perm.from S_2
[t(e[p[0]-1],e[p[1]-1]) for p in S2]    # elements in the sum (10.1)
# permutations p[i] give numbers from {1,..,k},
# we need indices from {0,..,k-1}, therefore we are subtracting 1

Out[17]:
$\displaystyle \left[t_{01}, t_{10}\right]$

Compute the sum from the definition (10.1) of antisymmetrization for $(v_0,v_1)=(e_0,e_1)$:

In [18]:
1/factorial(2)*sum([sign(p)*t(e[p[0]-1],e[p[1]-1]) for p in S2])

Out[18]:
$\displaystyle \frac{1}{2} \, t_{01} - \frac{1}{2} \, t_{10}$

Check if SageMath Manifolds antisymmetrize gives the same result:

In [19]:
ta=t.antisymmetrize()
ta(e[0],e[1])

Out[19]:
$\displaystyle \frac{1}{2} \, t_{01} - \frac{1}{2} \, t_{10}$

Example 10.10

Now let us check how the antisymmetrization works for covariant tensors from $T^{(0,3)}M$. We define symbolic 3-dimensional tables first.

In [20]:
%display latex
N=4                                           # dimension of module
symb_ten3=[[[var('t'+str(i0)+str(i1)+str(i2))
for i2 in range(N)]
for i1 in range(N)]
for i0 in range(N)]           # components of t
symb_ten3                                    # show components

Out[20]:
$\displaystyle \left[\left[\left[t_{000}, t_{001}, t_{002}, t_{003}\right], \left[t_{010}, t_{011}, t_{012}, t_{013}\right], \left[t_{020}, t_{021}, t_{022}, t_{023}\right], \left[t_{030}, t_{031}, t_{032}, t_{033}\right]\right], \left[\left[t_{100}, t_{101}, t_{102}, t_{103}\right], \left[t_{110}, t_{111}, t_{112}, t_{113}\right], \left[t_{120}, t_{121}, t_{122}, t_{123}\right], \left[t_{130}, t_{131}, t_{132}, t_{133}\right]\right], \left[\left[t_{200}, t_{201}, t_{202}, t_{203}\right], \left[t_{210}, t_{211}, t_{212}, t_{213}\right], \left[t_{220}, t_{221}, t_{222}, t_{223}\right], \left[t_{230}, t_{231}, t_{232}, t_{233}\right]\right], \left[\left[t_{300}, t_{301}, t_{302}, t_{303}\right], \left[t_{310}, t_{311}, t_{312}, t_{313}\right], \left[t_{320}, t_{321}, t_{322}, t_{323}\right], \left[t_{330}, t_{331}, t_{332}, t_{333}\right]\right]\right]$

Since $S_3$ contains 3!=6 elements, the sum from antisymmetrization definition (10.1) contains 6 summands.

In [21]:
# continuation
Mo = FiniteRankFreeModule(SR, N, name='Mo') # module Mo of dimension 4
e = Mo.basis('e')                           # basis of M
t = Mo.tensor((0,3), name='t')              # tensor t of type (0,3)
t[:]=symb_ten3                              # components of t
S3=Permutations(3).list()                   # permutation group S_3


Let us apply the antisymmetrization definition (10.1) for $(v_0,v_1,v_2)=(e_0,e_1,e_2)$.

In [22]:
1/factorial(3)*sum([sign(p)*t(e[p[0]-1],e[p[1]-1],e[p[2]-1]) for p in S3])

Out[22]:
$\displaystyle \frac{1}{6} \, t_{012} - \frac{1}{6} \, t_{021} - \frac{1}{6} \, t_{102} + \frac{1}{6} \, t_{120} + \frac{1}{6} \, t_{201} - \frac{1}{6} \, t_{210}$

Let us check what gives the antisymmetrize method:

In [23]:
ta=t.antisymmetrize()
ta(e[0],e[1],e[2])

Out[23]:
$\displaystyle \frac{1}{6} \, t_{012} - \frac{1}{6} \, t_{021} - \frac{1}{6} \, t_{102} + \frac{1}{6} \, t_{120} + \frac{1}{6} \, t_{201} - \frac{1}{6} \, t_{210}$
In [24]:
#ta.antisymmetrize?


Note that in the above calculations we restricted ourselves to one component of the antisymmetrized tensor.

To display the full result we need the notion of tensor and wedge products.

### Reminder. Tensor product¶

Recall the definition (9.1a) of the tensor product

For $\ t\in T^{(0,k)}M,\,s\in T^{(0,m)}M\$ we define the tensor product $\ \ t\otimes s\in T^{(0,k+m)}M$ by

$$(t ⊗ s )(v_1 ,\ldots , v_{k+m} ) ≡ t (v_1 ,\ldots, v_k ) s (v_{k+1} , . . . , v_{k+m} ), \tag{9.1a}$$

for $v_1,\ldots,v_{k+m}\in M$.

### Wedge product¶

Using the antisymmetrization operation Alt we can define the wedge product between alternating forms $t ∈ \Lambda^k(M^*)$ and $s ∈ \Lambda^m(M^*)$, which gives $t ∧ s ∈ \Lambda^{k+m}(M^*)$ defined by $$t ∧ s =\frac{(k + m)!}{k!m!}\mathrm{Alt}(t ⊗ s). \label{}\tag{10.2}$$

Example 10.11

If $a,b\in \Lambda^1(M^*),$ then since $S_2$ contains only two permutations of opposite sign we see that Alt$(a\otimes b)$ is equal to $\frac{1}{2!}(t\otimes s -s\otimes t)$ and $t\wedge s=\frac{(1+1)!}{1!1!}\Big(\frac{1}{2!}((t\otimes s -s\otimes t)\Big)=t\otimes s -s\otimes t$.

One can prove that for $t\in \Lambda^k(M^*),s\in\Lambda^m(M^*),r\in\Lambda^l(M^*)$

$$(t ∧ s) ∧ r = t ∧ (s ∧ r),$$

(in notebook 14 we prove this for differential forms).

Since the order of parentheses in that formula is not essential we can replace both sides by $t\wedge s\wedge r$, analogously we can form the wedge products of larger number of forms: $t_1\wedge\ldots\wedge t_i$.

### Bases in the space of alternating forms $\Lambda^k(M^*)$¶

To show concrete examples of alternating forms we will use bases in the spaces of alternating $k$-forms.

If $e^1,\ldots,e^n$ is a basis of $M^*$, then the set

$$\{e^{i_1}\wedge\dots\wedge e^{i_k}: 1\leq i_1<\ldots<i_k\leq n\}$$

is a basis for $\Lambda^k(M^*)$, i.e. elements of this set are linearly independent and every $a\in\Lambda^k(M^*)$ can be uniquely written in the form

$$a=\sum_{1\leq i_1<\ldots<i_k\leq n} a_{i_1\ldots i_k} e^{ i_1} \wedge \ldots \wedge e^{i_k}, \tag{10.3}$$

where $$a_{i_1\ldots i_k}=a(e_{i_1},\ldots,e_{i_k}).$$

Detailed proof of this fact, in the case of differential forms, is given in notebook 14.

Since the indices $i_1,\ldots,i_k$ form a strictly increasing sequences, the number of such sequences for an $n$-dimensional $M$ is $\binom{n}{k}$, so the dimension of $\Lambda^k(M^*)$ for an $n$-dimensional $M$ is $\binom{n}{k}.$

Example 10.12

Take two 1-forms $a$ and $b$:

In [25]:
%display latex
M = FiniteRankFreeModule(SR, 3, name='M') # module M of dimension 3
e = M.basis('e')                          # basis of M
a=M.alternating_form(1)                   # 1-form a
b=M.alternating_form(1)                   # 1-form b
a[:]=var('a',n=3)  # a0,a1,a2             # components of a
b[:]=var('b',n=3)  # b0,b1,b2             # components of b
a.disp()                                  # show a

Out[25]:
$\displaystyle a_{0} e^{0} + a_{1} e^{1} + a_{2} e^{2}$
In [26]:
# the mathematical object of which "a" is an element.
a.parent()

Out[26]:
$\displaystyle M^*$
In [27]:
a[:]                                      # comp. in the basis e

Out[27]:
$\displaystyle \left[a_{0}, a_{1}, a_{2}\right]$
In [28]:
b.disp()                                  # show b

Out[28]:
$\displaystyle b_{0} e^{0} + b_{1} e^{1} + b_{2} e^{2}$

Compute the wedge product $a\wedge b$:

In [29]:
t=a.wedge(b);print(t)                    # wedge prod. a/\b
t.disp()                                 # show wedge prod.

Alternating form of degree 2 on the 3-dimensional vector space M over the Symbolic Ring

Out[29]:
$\displaystyle \left( -a_{1} b_{0} + a_{0} b_{1} \right) e^{0}\wedge e^{1} + \left( -a_{2} b_{0} + a_{0} b_{2} \right) e^{0}\wedge e^{2} + \left( -a_{2} b_{1} + a_{1} b_{2} \right) e^{1}\wedge e^{2}$

Let us check the result using the definition of wedge product.

In [30]:
%display latex
tt=factorial(1+1)/factorial(1)/factorial(1)*(a*b).antisymmetrize()
tt.disp()    # show the result of application of definition of a/\b

Out[30]:
$\displaystyle \left( -a_{1} b_{0} + a_{0} b_{1} \right) e^{0}\wedge e^{1} + \left( -a_{2} b_{0} + a_{0} b_{2} \right) e^{0}\wedge e^{2} + \left( -a_{2} b_{1} + a_{1} b_{2} \right) e^{1}\wedge e^{2}$

Let us note that for 1-forms with components $a_0,a_1,a_2$ and $b_0,b_1,b_2$ the components of $a\wedge b$ are just the minors of $\Big(\begin{matrix} a_0,a_1,a_2\\ b_0,b_1,b_2 \end{matrix}\Big).$

In [31]:
ma=matrix([a[:],b[:]]);ma    # matrix with comp. of a and b as rows

Out[31]:
$\displaystyle \left(\begin{array}{rrr} a_{0} & a_{1} & a_{2} \\ b_{0} & b_{1} & b_{2} \end{array}\right)$
In [32]:
ma.minors(2)                 # 2x2 minors of matrix ma

Out[32]:
$\displaystyle \left[-a_{1} b_{0} + a_{0} b_{1}, -a_{2} b_{0} + a_{0} b_{2}, -a_{2} b_{1} + a_{1} b_{2}\right]$

Example 10.13

Let us compute the wedge product of three 1-forms in a 3-dimensional module.

In [33]:
M = FiniteRankFreeModule(SR, 3, name='M') # module M of dimension 3
e = M.basis('e')                          # basis of M
d=e.dual_basis()                          # dual basis
a=M.alternating_form(1)                   # 1-form a
b=M.alternating_form(1)                   # 1-form b
c=M.alternating_form(1)                   # 1-form c
a[:]=var('a',n=3)                         # components of a
b[:]=var('b',n=3)                         # components of b
c[:]=var('c',n=3)                         # components of c
abc=(a.wedge(b)).wedge(c)                 # a/\b/]c
abc.disp()                                # show abc

Out[33]:
$\displaystyle \left( -{\left(a_{2} b_{1} - a_{1} b_{2}\right)} c_{0} + {\left(a_{2} b_{0} - a_{0} b_{2}\right)} c_{1} - {\left(a_{1} b_{0} - a_{0} b_{1}\right)} c_{2} \right) e^{0}\wedge e^{1}\wedge e^{2}$
In [34]:
# the mathematical object of which "abc" is an element.
abc.parent()

Out[34]:
$\displaystyle \Lambda^{3}\left(M^*\right)$

We can recognize in the result the Laplace expansion of the determinant det $\left(\begin{matrix} a_0,a_1,a_2\\ b_0,b_1,b_2\\ c_0,c_1,c2 \end{matrix}\right),$

so we obtain $\quad a\wedge b\wedge c=$ det $\left(\begin{matrix} a_0,a_1,a_2\\ b_0,b_1,b_2\\ c_0,c_1,c2 \end{matrix}\right) e^0\wedge e^1\wedge e^2.$

SageMath Manifolds also recognizes that equality:

In [35]:
# compare abc and the 3-form with unique component  equal to
# det of the matrix of coefficients of a,b,c
abc==det(matrix([a[:],b[:],c[:]]))*(d[0].wedge(d[1])).wedge(d[2])

Out[35]:
$\displaystyle \mathrm{True}$

Example 10.14

For alternating 2-forms the antisymmetry property $a(v_1,v_2)=-a(v_2,v_1)$ implies, that the corresponding component matrices must be antisymmetric, so only upper or lower triangles of the component matrices must be defined.

In [36]:
M = FiniteRankFreeModule(SR, 3, name='M') # module M of dimension 3
e = M.basis('e')                          # basis of M
c=var('c',n=3)                            # c_0,c_1,c_2
c=M.alternating_form(2)                   # 2-form
c[0,1]=c0; c[0,2]=c1; c[1,2]=c2           # components of 2-form
c[:]                                      # show component matr.

Out[36]:
$\displaystyle \left(\begin{array}{rrr} 0 & c_{0} & c_{1} \\ -c_{0} & 0 & c_{2} \\ -c_{1} & -c_{2} & 0 \end{array}\right)$
In [37]:
a=M.alternating_form(1)                   # 1-form a
a[:]=var('a',n=3)                         # components of a
a.disp()                                  # show a

Out[37]:
$\displaystyle a_{0} e^{0} + a_{1} e^{1} + a_{2} e^{2}$

Compute 1-form times 2-form in 3-dimensional module:

In [38]:
# continuation
ac=a.wedge(c);ac

Out[38]:
$\displaystyle \mbox{Alternating form of degree 3 on the 3-dimensional vector space M over the Symbolic Ring}$
In [39]:
ac.disp()                                # show ac

Out[39]:
$\displaystyle \left( a_{2} c_{0} - a_{1} c_{1} + a_{0} c_{2} \right) e^{0}\wedge e^{1}\wedge e^{2}$

Let us apply the definition of wedge product for comparison.

In [40]:
(factorial(3)/factorial(2)*(a*c).antisymmetrize()).disp()

Out[40]:
$\displaystyle \left( a_{2} c_{0} - a_{1} c_{1} + a_{0} c_{2} \right) e^{0}\wedge e^{1}\wedge e^{2}$

Example 10.15

Clarification of the factor $\mathbf {\frac{1}{k!m!}}$ in the wedge product definition.

Let us perform the wedge product between a 2-form and 3-form in 5-dimensional module.

In [41]:
# 2form times 3form in 5-dimensions
%display latex
var('a12,a24,a35')    # symbolic components of 2-form w1
var('b123,b234,b345') # symbolic components of 3-form w2
V = FiniteRankFreeModule(SR,rank=5, name='V', start_index=1)
e = V.basis('e');                      # basis of V
w1=V.alternating_form(2)               # w1 is 2-form with
w1[1,2],w1[2,4],w1[3,5]=a12,a24,a35;   # components a12,a24,a35
w2=V.alternating_form(3)                      # w2 is 3-form
w2[1,2,3],w2[2,3,4],w2[3,4,5]=b123,b234,b345; # with components
# b123,b234,b345
w1.display()                                  # show w1

Out[41]:
$\displaystyle a_{12} e^{1}\wedge e^{2} + a_{24} e^{2}\wedge e^{4} + a_{35} e^{3}\wedge e^{5}$
In [42]:
w2.display()                              # show w2

Out[42]:
$\displaystyle b_{123} e^{1}\wedge e^{2}\wedge e^{3} + b_{234} e^{2}\wedge e^{3}\wedge e^{4} + b_{345} e^{3}\wedge e^{4}\wedge e^{5}$

Here is the wedge product according to SageMath Manifolds:

In [43]:
w1.wedge(w2).display()                  # show w1/\w2

Out[43]:
$\displaystyle a_{12} b_{345} e^{1}\wedge e^{2}\wedge e^{3}\wedge e^{4}\wedge e^{5}$

Let us apply the definition of wedge product for comparison:

In [44]:
w=w1*w2
w0=factorial(2+3)/factorial(3)/factorial(2)*w.antisymmetrize()
w0.display()

Out[44]:
$\displaystyle a_{12} b_{345} e^{1}\wedge e^{2}\wedge e^{3}\wedge e^{4}\wedge e^{5}$

If we drop the factor $\frac{1}{2!3!}$ and expand the sum from the antisymmetrization definition (cf. (10.1)) we obtain (the factor $(2+3)!$ is canceled by the factor $\frac{1}{(2+3)!}$ from that definition):

In [45]:
S5=Permutations(5).list()
s0=sum([sign(p)*w1(e[p[0]],e[p[1]])*w2(e[p[2]],e[p[3]],e[p[4]])
for p in S5])
s0

Out[45]:
$\displaystyle 12 \, a_{12} b_{345}$

The last sum contains $2!\cdot 3!=12$ repeated elements.

Below we display all permutations from $S_5$ which give nonzero elements in the sum from the definition of wedge product. All mentioned permutations $p$ give the same result of

$${\rm{sign}}(p)\,w_1(e_{p(0)},e_{p(1)})\,w_2(e_{p(2)},e_{p(3)},e_{p(4)})$$

equal to $\ \ a_{12}b_{345}:$

In [46]:
#  (shows only the nonzero elements of the sum of 5!=120 elements)
[[p[0],p[1],p[2],p[3],p[4],'---',
sign(p)*w1(e[p[0]],e[p[1]])*w2(e[p[2]],e[p[3]],e[p[4]])]
for p in S5 if (Set(range(1,3))==Set([p[0],p[1]]) and
Set(range(3,6))==Set([p[2],p[3],p[4]]))]

Out[46]:
$\displaystyle \left[\left[1, 2, 3, 4, 5, \verb|---|, a_{12} b_{345}\right], \left[1, 2, 3, 5, 4, \verb|---|, a_{12} b_{345}\right], \left[1, 2, 4, 3, 5, \verb|---|, a_{12} b_{345}\right], \left[1, 2, 4, 5, 3, \verb|---|, a_{12} b_{345}\right], \left[1, 2, 5, 3, 4, \verb|---|, a_{12} b_{345}\right], \left[1, 2, 5, 4, 3, \verb|---|, a_{12} b_{345}\right], \left[2, 1, 3, 4, 5, \verb|---|, a_{12} b_{345}\right], \left[2, 1, 3, 5, 4, \verb|---|, a_{12} b_{345}\right], \left[2, 1, 4, 3, 5, \verb|---|, a_{12} b_{345}\right], \left[2, 1, 4, 5, 3, \verb|---|, a_{12} b_{345}\right], \left[2, 1, 5, 3, 4, \verb|---|, a_{12} b_{345}\right], \left[2, 1, 5, 4, 3, \verb|---|, a_{12} b_{345}\right]\right]$

Thus the factor $\frac{1}{k!m!}$ in the wedge product definition is reasonable. Some authors use different choices of this factor. We follow the SageMath Manifolds choice.

### Abbreviated notations for $k$-forms¶

For arbitrary $k$-forms in $\Lambda^k(M^*)$ sometimes we would not want to actually write out all the indices from (10.3), so instead we will write $$α =\sum_I a_I dx^I . \label{}\tag{10.4}$$ Here the $I$ stands for the sequence of $k$ increasing indices $i_1 i_2 \ldots i_k$: $1 ≤ i_1 < i_2 < \ldots < i_k ≤ n$. That is, we sum over $I ∈ J_{k,n} = \{(i_1 i_2 \ldots i_k ) : 1 ≤ i_1 < i_2 < \ldots < i_k ≤ n\}$ .

For example, for $k = 3$ and $n = 4$ we have $I\in\{123,124,134,234\}.$

If $I$ and $J$ are disjoint then we have $dx^I ∧ dx^J = ±dx^K$ where $K = I ∪ J$ , but is reordered to be in increasing order. Elements with repeated indices are dropped. Using this notation we can compute the wedge product as follows

$$\Big(\sum_I a_Idx^I\Big)\wedge\Big(\sum_J b_Jdx^J\Big)= \sum_K\Big(\sum_{\substack{I\cup J=K\\I\cap J=\emptyset}}\pm a_Ib_J\Big)dx^K. \label{}\tag{10.5}$$

Example 10.16

Let us demonstrate this method in the case of the wedge product of 2-form times 2-form in a four-dimensional module.

In [47]:
var('f12,f13,f14, f23, f24, f34') # variables for components of w1
var('g12,g13,g14, g23, g24, g34') # variables for components of w2
# module V of dimension 4:
V = FiniteRankFreeModule(SR,rank=4, name='V', start_index=1)
e = V.basis('e');                 # basis of V
w1=V.alternating_form(2)          # 2-form w1
# components of w1
w1[1,2],w1[1,3],w1[1,4],w1[2,3],w1[2,4],w1[3,4]=f12,f13,f14, f23, f24, f34
w2=V.alternating_form(2)          # 2-form w2
# components of w2
w2[1,2],w2[1,3],w2[1,4],w2[2,3],w2[2,4],w2[3,4]=g12,g13,g14, g23, g24, g34
w1.display()                      # show w1

Out[47]:
$\displaystyle f_{12} e^{1}\wedge e^{2} + f_{13} e^{1}\wedge e^{3} + f_{14} e^{1}\wedge e^{4} + f_{23} e^{2}\wedge e^{3} + f_{24} e^{2}\wedge e^{4} + f_{34} e^{3}\wedge e^{4}$
In [48]:
w2.display()                      # show w2

Out[48]:
$\displaystyle g_{12} e^{1}\wedge e^{2} + g_{13} e^{1}\wedge e^{3} + g_{14} e^{1}\wedge e^{4} + g_{23} e^{2}\wedge e^{3} + g_{24} e^{2}\wedge e^{4} + g_{34} e^{3}\wedge e^{4}$

Computing the wedge product we use all possible strictly increasing and disjoint sequences $I=(i_1,i_2),\quad J=(j_1,j_2),\quad$ $dx^K=e^1\wedge e^2\wedge e^3\wedge e^4,\quad$ $K=(1,2,3,4)$ is reordered disjoint union $I\cup J$.

In our example we take all possible 2-element increasing permutations of indices for the first form:

$$I\in \{(1,2), (1,3), (1,4), (2,3), (2,4), (3,4)\}$$

The corresponding increasing $J$ satisfying $I\cup J=\{1,2,3,4\}$ and $I\cap J=\emptyset$ are:

$$J\in \{(3,4), (2,4), (2,3), (1,4), (1,3), (1,2)\}$$

so, the wedge product is $$(f_{12}g_{34}-f_{13}g_{24}+f_{14}g_{23}+f_{23}g_{14}-f_{24}g_{13}+f_{34}g_{12})e^1\wedge e^2\wedge e^3\wedge e^4.$$

The signs in the last result are the signs of the corresponding permutations:

In [49]:
s=[[1,2,3,4],[1,3,2,4],[1,4,2,3],[2,3,1,4],[2,4,1,3],[3,4,1,2]]
[sign(Permutation(x)) for x in s]    # list of signs of permut.

Out[49]:
$\displaystyle \left[1, -1, 1, 1, -1, 1\right]$

SageMath Manifolds gives the sum in parentheses in reverse order:

In [50]:
w=w1.wedge(w2)                      # wedge product w1/\w2
w.display()                         # show wedge product

Out[50]:
$\displaystyle \left( f_{34} g_{12} - f_{24} g_{13} + f_{23} g_{14} + f_{14} g_{23} - f_{13} g_{24} + f_{12} g_{34} \right) e^{1}\wedge e^{2}\wedge e^{3}\wedge e^{4}$

### Basic properties of the wedge product¶

Multilinearity

For $\alpha,\alpha_1,\alpha_2\in \Lambda^k(M^*),\beta,\beta_1,\beta_2\in \Lambda^m(M^*)$ and $a\in R$ $$(\alpha_1+\alpha_2)\wedge\beta=\alpha_1\wedge\beta+\alpha_2\wedge\beta,\\ \alpha\wedge(\beta_1+\beta_2)=\alpha\wedge\beta_1+\alpha\wedge\beta_2,\\ (a\alpha)\wedge\beta=a(\alpha\wedge\beta)=\alpha\wedge(a\beta). \label{}\tag{10.6}$$

Associativity

For $\alpha_i\in \Lambda^{k_i}(M^*)$

$$(\alpha_1\wedge \alpha_2)\wedge \alpha_3=\alpha_1\wedge(\alpha_2\wedge \alpha_3). \tag{10.7}$$

Anticommutativity

If $t ∈ \Lambda^k(M^*)$ and $s ∈ \Lambda^m(M^*)$, then $$t ∧ s = (−1)^{km} s ∧ t. \label{}\tag{10.8}$$

In the notebook 14 we will prove analogous properties in the case of differential forms.

## What's next?¶

Take a look at the notebook Vector fields.