You are on page 1of 10

Clifford Algebra with Mathematica

J.L. ARAGÓN G. ARAGON-CAMARASA


Universidad Nacional Autónoma de México University of Glasgow
Centro de Fı́sica Aplicada School of Computing Science
arXiv:0810.2412v2 [math-ph] 22 Jan 2018

y Tecnologı́a Avanzada Sir Alwyn William Building,


Apartado Postal 1-1010, 76000 Querétaro Glasgow, G12 8QQ Scotland
MEXICO UNITED KINGDOM
aragon@fata.unam.mx Gerardo.AragonCamarasa@glasgow.ac.uk

G. ARAGÓN-GONZÁLEZ M.A. RODRÍGUEZ-ANDRADE


Universidad Autónoma Metropolitana Instituto Politécnico Nacional
Unidad Azcapotzalco Departamento de Matemáticas, ESFM
San Pablo 180, Colonia Reynosa-Tamaulipas, UP Adolfo López Mateos,
02200 D.F. México Edificio 9. 07300 D.F. México
MEXICO MEXICO
gag@correo.azc.uam.mx marco@polaris.esfm.ipn.mx

Abstract: The Clifford algebra of a n-dimensional Euclidean vector space provides a general language comprising
vectors, complex numbers, quaternions, Grassman algebra, Pauli and Dirac matrices. In this work, we present an
introduction to the main ideas of Clifford algebra, with the main goal to develop a package for Clifford algebra
calculations for the computer algebra program Mathematica∗. The Clifford algebra package is thus a powerful tool
since it allows the manipulation of all Clifford mathematical objects. The package also provides a visualization
tool for elements of Clifford Algebra in the 3-dimensional space. clifford.m is available from
https://github.com/jlaragonvera/Geometric-Algebra

Key–Words: Clifford Algebras, Geometric Algebra, Mathematica Software.

1 Introduction Mathematica, resulting in a package for doing Clif-


ford algebra computations. There exists some other
The importance of Clifford algebra was recognized packages and specialized programs for doing Clif-
for the first time in quantum field theory. Lately, there ford algebra; CLIFFORD/Bigebra is a Maple package
has been a tendency to exploit their power in many which include additional specialized packages such as
others fields. These fields include projective geome- SchurFkt (for the Hopf Algebra of Symmetric Func-
try [9], electrodynamics [11], analysis on manifolds tions) and GfG - Groebner for Grassmann (for Com-
and differential geometry [8], crystallography [18, 2] puting Groebner Bases for Ideals in Grassmann Alge-
to name a few. A recent account of the applications bra) [1]; TCliffordAlgebra is as add-on application for
of Clifford algebra in fields such as robotics, com- the Mathematica package Tensorial that implements
puter vision, computer graphics, engineering, neural Clifford algebra operations [16]; CLICAL is a stand-
and quantum computing, etc., can be found in [3] and alone calculator-type computer program for MS-DOS
[19]. [15]. While the first two packages requires more spe-
General introductions to Clifford algebra can be cialized knowledge of Clifford algebras, CLICAL and
found in several books (see for instance Refs. [17] the package presented here is easy to use and can be
and [4]). Here, a gently introduction to the Clifford used by non mathematicians. More recently, Clif-
algebra of Rn is presented together with some exam- ford Multivector Toolbox, a toolbox for computing
ples to show the generality of this algebra in order to with Clifford algebras in MATLAB, has been released
provide a general language comprising vectors, com- [6]. A more specialized package is GAViewer pack-
plex numbers and quaternions. The main goal is to age, designed for computation and visualization of ob-
implement the basic operations of Clifford algebras in jects in conformal geometric algebra [5] (for a more
∗ recent account and application see Ref. [12]). We
Mathematica is a registered trademark of Wolfram Research,
Inc. must emphasise that with the exception of the Maple
packages, the other packages and toolboxes only al- where 1 is the identity of the algebra. The product so
low numeric computations. Our Clifford Mathematica defined is associative:
package allow us to carry out numerical and symbolic
computations with complex numbers, quaternions, the a(bc) = (ab)c,
hyperbolic plane, Grassmann algebra and, Dirac and
and we are constructing an algebra A equipped with
Pauli algebras, all defined within the Clifford algebra
an identity 1.
framework. Our package clifford.m is available
With the vector space and the product (1), the re-
for download at:
sulting algebra of all possible sums and products of
https://github.com/jlaragonvera/Geometric-Algebra
vectors in Rn is called the Clifford algebra of Rn and
is denoted by Cln . Note in particular that
2 The Clifford algebra of Rn a2 = ha, ai
The set of n-tuples of the form (x1 , x2 , ..., xn ) with e2i = 1 (2)
the standard operations of addition and multiplication ei ej = −ej ei , i 6= j.
for real numbers is a vector space, over the field of
real numbers, which we denote as Rn . It means that The Clifford
P algebra
 Cln is itself a vector space of
the addition of n-tuples, and multiplication by real dimension np=0 np = 2n , with basis
numbers satisfy certain properties which are those of
a vector space [13]. The canonical basis of Rn is the {1, e1 , . . . , en , e1 e2 , . . . , e1 en , . . . , e1 e2 · · · en } ,
set of n-dimensional vectors {e1 , e2 , ..., en } where
hei , ej i = δij and h , i is a inner product in Rn . An such that an element A in Cln is written as
element v of Rn is written as a linear combination of
A = a0 + a11 e1 + · · · + a1i en + a21 e1 e2 +
this canonical basis:
+ · · · a2i e1 en + · · · + adi e1 e2 · · · en , (3)
v = x1 e1 + x2 e2 + · · · + xn en . 
where d = 2n − 1 and i = np for the real num-
It is said therefore that the n-tuple (x1 , x2 , ..., xn ) bers api . Consequently, the vector space Cln can be
is the coordinate vector of v with respect to the canon- decomposed in n + 1 subspaces as:
ical basis {e1 , e2 , ..., en }.
The vector space Rn has two operations defined: Cln = Λ0 Rn ⊕ Λ1 Rn ⊕ · · · ⊕ Λn Rn . (4)
addition of vectors and multiplication of vectors by 
Each subspace is of dimension np .
scalars. The multiplication by vectors between them-
The elements A (Eqn. 3) of the Clifford alge-
selves is not defined. The algebraic structure which
bra Cln are called multivectors, and those of Λp Rn ,
considers multiplication between vectors is called an
p-vectors. In particular, 0-vectors are real num-
algebra.
bers and dim(Λ0 Rn ) = 1. Λ1 Rn has the ba-
An algebra A is a vector space over a field F to-
sis {e1 , e2 , . . . , en }, so 1-vectors are simply vec-
gether with a binary multiplication ab in A such that
tors and dim(Λ1 Rn ) = n. Λ2 Rn has the ba-
form any a, b, c ∈ A and α ∈ F [10]:
sis {e1 e2 , e1 e3 , . . . , e1 en } and their elements (2-
(a + b)c = ac + bc vectors) are also called bivectors. Finally, Λn Rn has
as basis {e1 e2 · · · en } and since dim(Λn Rn ) = 1, the
a(b + c) = ab + ac n-vectors of Cln are referred as pseudoscalars.
α(ab) = (αa)b = a(αb). In this paper, arbitrary multivectors will be de-
noted by non bold upper case characters without or-
In the case of the vector space Rn , the field F namentation such as A. p-vectors will be denoted by
is the set of real numbers. In order to construct an Ap , with the exception of vectors (1-vectors), that will
algebra from Rn , it is required to define a product ab be denoted by bold lower case characters such as a.
between vectors in Rn . One particular product in Rn Bearing in mind that the decomposition of the
can be defined as follows. vector space Cln as the direct sum of the subspaces
Let us consider the vector space Rn with Λp Rn , 0 ≤ p ≤ n, given in (4), any multivector A can
the inner product ha, bi and an orthonormal basis be written as
{e1 , e2 , ..., en }. We construct an algebra from Rn by
introducing a product between vectors in Rn that sat- A = hAi0 + hAi1 + · · · + hAin , (5)
isfies the condition
where hAip , the p-vector part of A, is the projection of
ab + ba = 2ha, bi1, (1) A ∈ Cln into Λp Rn . h i is called the grade operator.
2.1 Innner and outer products 2.2 Geometric interpretation
Given the decomposition (4), an important property of Bivectors have an interesting geometric interpretation.
a Clifford algebra is the existence of products that al- Just as a vector describes an oriented line segment,
lows us to move from one subspace of Cln to another. with the direction of the vector representing the ori-
Let us first consider the product of two 1-vectors. For ented line and the magnitude of the vector, the length
all u, v ∈ Λ1 Rn , their product uv can be written as of the segment; a bivector a ∧ b describes an ori-
1 1 ented plane segment, with the direction of the bivec-
uv = (uv + vu) + (uv − vu) . tor representing the oriented plane and the magnitude
2 2
of the bivector measuring the area of the plane seg-
Now define the “inner” and “outer” products as fol- ment (Figure 1). The same interpretation is extended
lows to high-order terms: a ∧ b ∧ c represents an oriented
1 volume. In general, multivectors contain information
u·v = (uv + vu) = ha, bi, about orientation of subspaces.
2
1
u∧v = (uv − vu) .
2
2.3 The main involution
The inner product is symmetric and notice that vectors
u and v are orthogonal if an only if uv = −vu. The The magnitude or modulus of a multivector A is de-
outer product u ∧ v is antisymmetric (and associative) fined by the equation
and vanishes whenever the two vectors are collinear,
that is, u and v are collinear (or linearly dependent) D E1/2
e
|A| = AA , (8)
if an only if uv = vu. Thus, the product uv pro- 0
vides information about the relative directions of the
vectors. Anticommutativity means orthogonality and where ∼ denotes the operation reverse defined as
commutativity means collinearity. Notice that for the
bases vectors of Rn , we have (e1 e2 · · · ep )∼ = ep · · · e2 e1 .
ei ej = ei ∧ ej , i 6= j,
ei · ei = e2i = 1. The operation reverse is distributive [8] so that the
reverse of an arbitrary multivector A can be easily cal-
From the following equality culated. If the inverse of a multivector A exists, it is
denoted by A−1 or 1/A, and is defined by the equa-
uv = u · v + u ∧ v,
tion AA−1 = 1.
= huvi0 + huvi2 ,
we can extend the notions of inner and outer product
to the case of p- and q-vectors in the following way. 2.4 General metrics
For a p-vector Ap ∈ Λp Rn and a q-vector Bq ∈ Λq Rn , In many physical applications one considers real vec-
the inner product Ap · Bq is defined by tor spaces Rn with metrics that are not positive defi-
 nite with the bilinear form h , i, in (1), such that
hAp Bq i|p−q| if p, q > 0,
Ap · Bq =
0 if p = 0 or q = 0.
hx, xi = x21 + x22 + · · · + x2p − x2p+1 − · · · − x2p+q ,
(6)
Analogously, the outer product Ap ∧Bq is defined
by where n = p + q. In this case, the vector space is de-
Ap ∧ Bq = hAp Bq ip+q . (7) noted as Rp,q , giving rise to the Clifford algebra Clp,q .
Using the orthonormal basis {e1 , e2 , . . . , en } of Rp,q ,
Since arbitrary multivectors can be decomposed the relations (2) are now:
as in (5), inner and outer product can be extended by
linearity to Cln . Then, given A, B ∈ Cln , we have
e2i = 1 1 < i ≤ p
n
X e2i = −1 p < i ≤ n (9)
A·B = hAik · hBil ,
ei ej = −ej ei , i 6= j.
k,l=1
Xn
A∧B = hAik ∧ hBil , The scalar p is called the signature of the bilinear
k,l=1 form h , i.
3 Clifford algebra calculations with ntuple[x_, dim_]:=
ReplacePart[Table[0,{dim}],1,List @@
Mathematica x /. e[k_]->{k}]
According to Eqns. (6), (7) and (8), all that we should
The signature of the bilinear form can be set by
need to manipulate multivectors in a computer alge- using $SetSignature = p. Relations (9) can be
bra program such as Mathematica, would be to define coded as:
the two basic operations: geometric product and grade
operator. In the first case, a simple algorithm for the bilinearform[e[i_],e[i_]]:=
computation of the geometric product between multi- If[i <= $SetSignature, 1, -1]
vectors can be devised by noticing that a general mul-
tivector (3) in Clp,q is formed by a linear combination With some exceptions, it is not necessary to define
of terms in the form the dimension of the vector space since it can be calcu-
lated directly. The maximum dimension of the space
where a blade is embedded can be extracted from the
em1 m2 mn
1 e2 · · · en , (10) list:
where mi = 1, 0, (i = 1, ..., n). Let us call blades to dimensions[x_]:=
multivectors of the form (10). The geometric product List @@ x /. e[k_?Positive] -> k
of two of these blades is:
and, therefore, enables us to perform computa-
(em1 m2
1 e2 · · · em r1 r2 rn
n ) (e1 e2 · · · en ) =
n tions in any dimension with any given signature. For a
general multivector, we need the relations that include
(−1)s e1m1 +r1 e2m2 +r2 · · · em
n
n +rn
, (11) the distributivity of addition:

where the sum mi + ri is evaluated modulus two, and dimensions[x_Plus]:=


List @@ Distribute[tmp[x]] /.
X
s= ri mj . tmp -> dimensions
dimensions[a_]:=
1≤i<j≤n
{0} /; FreeQ[a,e[_?Positive]]
dimensions[a_ x_]:=
If mi +ri = 2 then, in order to have the right hand side dimensions[x] /; FreeQ[a,e[_?Positive]]
in the form (10) when considering the signature of the
bilinear form, em
i
i +ri
will be replaced with hei , ei ie0i , From (11), the geometric product between two
and in this case we have: blades with a bilinear form of signature p can there-
fore be evaluated with geoprod:
e1m1 +r1 · · · em
i
i +ri
· · · em
n
n +rn
=
geoprod[x_,y_]:= Module[{q=1,s,r={}},
hei , ei ie1m1 +r1 · · · e0i · · · em
n
n +rn
. p1= ntuple[x, Max[dimensions[x],
dimensions[y]]],
Equation (10) enables us to establish an isomor- p2= ntuple[y, Max[dimensions[x],
phism between blades and n-tuples (m1 , m2 , ..., mn ) dimensions[y]]],
that can be manipulated more easily from a computa- s= Sum[p2[[m]]*p1[[n]],
{m,Length[p1]-1},{n,m+1,Length[p2]}];
tional point of view. The grade of a blade such as (10)
r1=p1+p2;
is simply m1 + m2 + · · · + mn . r=Mod[p1+p2,2];
If, in Mathematica code, we denote the j-th basis Do[
vector ej as e[j], a blade such as e1 e3 e4 , ( e11 e02 e13 e14 If[r1[[i]]==2,
using the nomenclature of Eqn. 10) is written as: q*=bilinearform[e[i],e[i]]];
If[r[[i]]==1, q*=e[i]],
e[1]e[3]e[4], (12) {i, Length[r]}];
(-1)ˆs*q ]
and can be internally represented simply by
The latter function evaluates the geometric prod-
(1, 0, 1, 1). Care must be taken in preserving uct of two blades in a Clifford algebra Clp,q . One step
the canonical order of the expression, since for further consists in to calculate the geometric product
instance e[1]e[3] is a geometric product of two of two arbitrary multivectors such as (3). This can be
vectors and e[1]e[3] 6= e[3]e[1]. achieved from geoprod by providing the transforma-
Let us consider the Clifford algebra Clp,q . If dim tion rules which contains the properties of the geo-
= p + q is the dimension of the vector space, the fol- metric product under multiplication of blades by real
lowing Mathematica code implements the transforma- numbers and addition of blades. Here is the behavior
tion of a blade onto a n-tuple: under scalar multiplication:
geoprod[a_,y_]:= 4 Vectors
a y /; FreeQ[a,e[_?Positive]]
geoprod[x_,a_]:= Let us consider the Clifford algebra Clp,0 . n-dimensional
a x /; FreeQ[a,e[_?Positive]] vectors are 1-vectors and lie in the subspace Λ1 Rp,0 . A
geoprod[a_ x_,y_]:= vector a is therefore a = hAi1 , where A is a general multi-
a geoprod[x,y] /; FreeQ[a,e[_?Positive]] vector.
geoprod[x_,a_ y_]:= The inner product defined in (6) becomes now the
a geoprod[x,y] /; FreeQ[a,e[_?Positive]] standard “dot product” between vectors. The “cross prod-
and the distributivity of addition: uct” a × b of vector calculus is defined in R3 and is related
to the outer product of vectors a and b. The vector a × b
geoprod[x_, y_Plus]:= is perpendicular to a ∧ b and with the same magnitude:
Distribute[tmp[x,y,p],Plus] /. |a ∧ b| = |a × b|. The explicit algebraic relation between
tmp -> geoprod
them is [7]:
geoprod[x_Plus, y_]:=
Distribute[tmp [x,y,p],Plus] /. a × b = (−e1 e2 e3 )(a ∧ b), (13)
tmp -> geoprod
Therefore, the function to calculate the geometric where e1 e2 e3 is the pseudoscalar of Cl3,0 . We may actu-
product of arbitrary multivectors is defined as ally take this as a definition of the cross product.
From (13), it is easy to define the function
GeometricProduct[_]:= $Failed crossprod[v,w] that gives the cross product between
GeometricProduct[m1_,m2_,m3__]:= two three-dimensional vectors v and w:
tmp[ GeometricProduct[m1,m2],m3] /.
tmp -> GeometricProduct crossprod[v_,w_]:=
GeometricProduct[m1_,m2_]:= GeometricProduct[-e[1]e[2]e[3],
geoprod[Expand[m1], Expand[m2]] OuterProduct[v,w]]
To complete the basic operations of a Clifford al- The associativity property of the geometric product al-
gebra, we must define and implement the grade oper- lows algebraic manipulations typical of real numbers that
ator. The following auxiliary function calculates the
grade of a blade are not possible in the Gibbs’ vector algebra since the cross
and dot products are not generally associative. For example
gradblade[a_]:=
0 /; FreeQ[a,e[_?Positive]] a × (b × c) 6= (a × b) × c.
gradblade[x_]:=
Plus @@ ntuple[x, Max[dimensions[x]]] Even more, many products such as a · (b · c) are not
gradblade[a_ x_]:= even defined. With Clifford algebra all products are not
gradblade[x] /; FreeQ[a,e[_?Positive]] only well defined but associative making simpler many al-
Now, Grade[x,n] should extract the term of gebraic manipulations and allowing to define derivatives
grade n from the multivector X. Firstly, we consider and integrals just as they are defined for real functions of
the case when the multivector X is a blade of grade r: real variables, provided that we are careful to maintain the
hXin = 0 if r 6= n and hXin = X if r = n. The order of the factors since geometric product is not commu-
code reads: tative.
Grade[x_, n_?NumberQ]:= One specific example that shows the simplicity of
If[gradblade[x]==n,x,0]] some expressions if the geometric product is used, is con-
cerning rotations. Consider a vector v in Rn which is ro-
For a general multivector X, we have: tated by an angle θ in the oriented plane characterized by
Grade[x_Plus, n_?NumberQ]:= the bivector a ∧ b. After the rotation, the vector v is trans-
Distribute[tmp[x,n],Plus] /. tmp -> Grade formed into v′ , given by [7]:
Functions GeometricProduct and Grade e vU,
v=U (14)
enable us to construct all the operations which
can be defined in a Clifford algebra, such as where
outer product (OuterProduct[v,w,..]), inner a∧b
U = cos(θ/2) + sin(θ/2).
product (InnerProduct[v,w,..]), magnitude |a ∧ b|
(Magnitude[v]), reverse (Turn[v]}), inverse The direction of the rotation (clockwise or counter clock-
(MultivectorInverse[v]), dual (Dual[v,dim]), wise) is specified by the orientation of the bivector a ∧ b.
and many others, all included in the package Eqn. 14 gives the rotated vector v′ regardless of the dimen-
Clifford.m. This package works with general sion of the space in which it is embedded. No correspond-
multivectors of the form (3), but particular cases can help ing simple expression exists in vector algebra.
to envisage the power of multivector calculus, as it is made As an example, which can be easily visualized, con-
explicit in what follows. sider the vector v = (1, 1, 1), to be rotated 90o maintaining
invariant the plane xy. To characterize the plane xy, we can Scalar = 0
use a ∧ b where a = (1, 0, 0) and b = (0, 1, 0), in which
case we get a rotation counterclockwise and is easy to see
that v′ = (−1, 1, 1), but if we use b ∧ a then the rotation is
clockwise and v′ = (1, −1, 1). Here is this example solved
with Clifford:

In[1]:= << Clifford.m


In[2]:= v = e[1]+e[2]+e[3]; 1
e1 e2 + e2 e3
In[3]:= plane = OuterProduct[e[1],e[2]]/
Magnitude[OuterProduct[e[1],e[2]]] 0.5
Out[3]= e[1]e[2]
e3
e is the reverse of U ): 0
The operator U is now defined (U 1
-0.5
In[4]:= u = Cos[Pi/4] + plane Sin[Pi/4];
In[5]:= vprime = GeometricProduct[Turn[u], 0
GeometricProduct[v,u]]
-1 e2
Out[5]= -e[1]+e[2]+e[3] -1
-0.5
0 -1
So we get a counterclockwise rotation where the vec-
e1 0.5
tor v = (1, 1, 1) becomes v′ = (−1, 1, 1). The imple-
1
mentation in Mathematica of this rotation is the function
Rotation[v,a,b].
Figure 1: A vector, a bivector (plane) and the pseu-
5 Drawing multivectors in the 3- doscalar (cube) drawn with the aid of the function
GADraw.
dimensional space.
The elements of the Clifford algebra Cl3,0 can be visualized
If[OuterProduct[ToBasis[p], e[3]] === 0,
in the 3-dimensional space, providing geometrical insights. cone =
The package include a function to draw multivectors be- Table[Array[ToVector[mat[#],3] &,3] +
longing to Cl3,0 , called GADraw, that will be described in p-ToVector[mat[3],3],{t,0.25,2*Pi,0.25}],
what follows. elms =
GADraw includes embedded functions to draw vec- Array[sc*ToVector[Grade[Rotation[
tors, bivectors and the pseudoscalar of Cl3,0 . For example mat[#],e[3], ToBasis[p]],1],3]&,3];
let us draw the multivector e3 + e1 e2 + e2 e3 + e1 e2 e3 : cone=
Table[elms+p-res[[3]],{t,0.25,2*Pi,0.25}]];
In[1]:= << Clifford.m
In[2]:= A = e[3] + e[1]e[2] + arrow = Graphics3D[{FaceForm[color],
e[2]e[3]+e[1]e[2]e[3]; EdgeForm[], Polygon /@ cone}]
In[3]:= GADraw[A];
Out[3]= Where ToBasis and ToVector are functions, de-
fined on the same package Clifford; the former changes
The result is shown in Fig. 1. The bivector is repre- from the coordinates of a vector to the basis notation (12)
sented by an area and the pseudoscalar as a scalable cube. and the last one does the opposite.
In the particular case of the vector (0, 0, 1), the arrow in its We must emphasize that the above code was included
tip was generated by the following code [22]:
with the aim to show that symmetry operations, rotations
mat[1] = Sin[t]*(e[1]/14)+Cos[t]*(e[2]/14),
in this case, can be carried out by using the elements of
mat[2] = Sin[t+0.25]*(e[1]/14) + the Clifford algebra without requiring matrices. This al-
Cos[t+0.25]*(e[2]/14), gebra provides a consistent computational framework with
mat[3] = e[3]/5, significant applications in computer graphics, vision and
robotics [5].
This arrow is then translated and rotated (in
this case to the tip of the vector (0, 0, 1)) with
the aid of the function Rotation[mat,w,p], 6 Complex numbers
where w = e3 and p is the vector that points the
site where the tip of the arrow must be located. If Let us consider the Clifford algebra of the most simple
sc=Sqrt[p[[1]]ˆ2 +p[[2]]ˆ2 +p[[3]]ˆ2]/2 space that has a geometrical structure: the plane R2,0 . Tak-
is a scale factor then all this procedure can be encoded as: ing the canonical basis {e1 , e2 }, a basis for the Clifford
algebra Cl2,0 is {1, e1 , e2 , e1 e2 } and a general multivector In[10]:= MultivectorInverse[transform[w]]
A ∈ Cl2,0 has the form /. e[1]e[2] -> i

A = k0 + k1 e1 + k2 e2 + k3 e1 e2 . a - bi
Out[10]= ----------
We can decompose Cl2,0 as Cl2,0 = Cl+ −
2,0 ⊕Cl2,0 , such 2 2
+ −
that Cl2,0 contains even grade elements and Cl2,0 contains a + b
odd grade elements. Therefore, A can be expressed as the
sum of two multivectors: A = A+ +A− , where A+ ∈ Cl+ 2,0
and A− ∈ Cl− 2,0 . That is
7 Quaternions
Extending from the previous section, we now develop
A = A+ + A− ,
the Clifford algebra of R3,0 , equipped with the canon-
A+ = k0 + k3 e1 e2 , ical basis {e1 , e2 , e3 }. The Clifford algebra Cl3,0
A− = k1 e1 + k2 e2 . is an eighth-dimensional vector space with the basis
{1, e1 , e2 , e3 , e1 e2 , e2 e3 , e1 e3 , e1 e2 e3 }. A general mul-
We focus our attention into Cl+ 2,0 ; it is itself an algebra tivector A ∈ Cl3,0 is written as
so that it is called the even subalgebra of Cl2,0 . By taking
A = k0 + k1 e1 + k2 e2 + k3 e3 + k4 e1 e2 +
i = e1 e2 , (15) k5 e2 e3 + k6 e1 e3 + k7 e1 e2 e3 ,
an element of Cl+
2,0 can be written as which can be also expressed as A = A+ + A− , where
z = k0 + k3 i. A+ = k0 + k4 e1 e2 + k5 e2 e3 + k6 e1 e3
A− = k1 e1 + k2 e2 + k3 e3 + k7 e1 e2 e3 .
Since i2 = (e1 e2 )(e1 e2 ) = −(e1 e2 e2 e1 ) = −1, and i
is itself a generator of rotations [7], we see that Cl+
2,0 is The even-grade elements A+ form the subalgebra
equivalent to the algebra of complex numbers. Cl+
3,0of Cl3,0 , equivalent to the algebra of quaternions.
The algebraic operations of complex numbers can Hence, we have:
therefore be worked out with Clifford. In order to get a
more standard notation we firstly define the function i = −e2 e3 ,
j = e1 e3 (16)
In[6]:= transform[x]:= x /. i -> e[1]e[2]
k = −e1 e2 ,
which makes the identification (15). Here we have two
complex numbers: leading to the famous equations

In[7]:= w = a + b i; i2 = j2 = k2 = −1, (17)


In[8]:= z = c + d i; ijk = −1.
The product (a + bi)(c + di) becomes With the identifications given in (16), an element of
Cl+
3,0 can be written now as
In[9]:= GeometricProduct[transform[w],
transform[z]] /. e[1]e[2] -> i Q = q0 + q1 i + q2 j + q3 k,
Out[9]:= a c - b c + b c i + a d i
which, in view of the properties (17), is a quaternion.
The equivalence between some built-in basic opera- The algebra of quaternions is therefore comprised in
tions of complex numbers in Mathematica and those of a the same package. The basic operations of this algebra
Clifford algebra defined the package is shown in the fol- are carried out by the function already defined, such
lowing table: as GeometricProduct, MultivectorInverse,
Magnitude and Turn. To simplify the operations,
we have incorporated the definitions (16) and redefined
Built-in Objects Clifford.m Objects
some functions to work only with quaternions and
complex numbers. The new functions begin with the
Re[z] Grade[z,0] word Quaternion, namely, QuaternionProduct,
Im[z] GeometricProduct[ QuaternionInverse, QuaternionMagnitude
Grade[z,2],-e[1]e[2]] and QuaternionTurn. So, for instance the inverse of
the quaternion q = a + 3i + 6j − 10k is
Conjugate[z] Turn[z]
In[11]:= q = a + 3 i + 6 j - 10 k;
Abs[z] Magnitude[z]
In[12]:= QuaternionInverse[q]

a - 3 i - 6 j + 10 k
Out[12]= ---------------------
The inverse of the complex number w can be calcu- 2
lated with MultivectorInverse: 145 + a
8 Grassmann algebra of Cl2,1 . In three dimensions, the Gaussian curvature of a
surface f (x1 , x2 , x3 ) = 0 can be written as [21]:
The outer product (OuterProduct) defined in (7) is as-
sociative and the identity 1, in a Clifford algebra Cln,0 , is 1h 2
i
k= n · ∇2 n + (∇ · n) ,
also the identity for the outer product. Consequently, the 2
vector space Rp,0 with the outer product already defined is where n = ∇f (x1 , x2 , x3 )/ |∇f (x1 , x2 , x3 )| is the normal
an algebra of dimension 2n , which is called the Grassmann to the surface. In a three-dimensional space with metrics
algebra of Rp,0 . Notice that it does not depend on the inner non positive definite, the gradient of a scalar function φ
product of the vector space, but just on the alternation of and the divergence and Laplacian of a vector function f =
the outer product. (f1 , f2 , f3 ) are defined as
Grassmann algebra has relevance in modern theoreti-
cal physics [14] and has the right structure for the theory ∂φ ∂φ
∇φ = (e1 · e1 ) e1 + (e2 · e2 ) e2 +
of determinants. The structure of this algebra contained in ∂x1 ∂x2
Clifford algebra allows us to reformulate Grassmann calcu- ∂φ
(e3 · e3 ) e3 ,
lus [14], and to give an extensive treatment of determinants ∂x3
[8], both in terms of Clifford algebra. ∂f1 ∂f2
∇·f = (e1 · e1 )2 + (e2 · e2 )2 +
∂x1 ∂x2
∂f3
9 The hyperbolic plane (e3 · e3 )2 ,
∂x3
Perhaps the simplest example of a problem involving non 
∂2 ∂2
positive definite metrics is the Minkowsky model of the hy- ∇2 f = (e1 · e1 )3 2 + (e2 · e2 )3 3 +
∂x1 ∂x2
perbolic plane. Here we shall develop some basic ideas and 2

calculations just to give a flavor of this kind of application ∂
(e3 · e3 )3 2 (f1 e1 + f2 e2 + f3 e3 ) .
of Clifford algebra and the use of the package Clifford ∂x3
for non positive definite metrics. In the next section, one We can use Clifford to evaluate all these expres-
extra dimension is introduced and the resulting algebras sions:
have great relevance in relativity theory and quantum me-
In[1]:= << Clifford.m
chanics.
One can always visualize a surface of constant positive The adequate metrics is defined
Gaussian curvature 1/R2 (see for instance [20] for con-
In[2]:= $SetSignature = 2
cepts related to differential geometry) as a sphere, with ra-
dius R, embedded in a three dimensional Euclidean space. Here are the differential operators:
The surface is described by the equation x21 +x22 +x23 = R2 . In[3]:= var = {x1,x2,x3};
A surface of constant negative curvature, however, cannot In[4]:= GeoGrad[g_]:=
be embedded in a Euclidean space, so alternative possibili- Sum[InnerProduct[e[k],e[k]]
ties must be developed to visualize such surfaces. The sim- *D[g,var[[k]]]*e[k],{k,3}]
plest surface of constant negative curvature is often called In[5]:= GeoDiv[v_]:=
the hyperbolic plane, the Bolyai-Lobachevsky plane, or the Sum[InnerProduct[e[k],e[k]]ˆ2
pseudosphere. This surface can be globally embedded in a D[Coeff[v,e[k]],var[[k]]],{k,3}]
space equipped with the Minkowsky metrics instead of the In[6]:= GeoLap[v_]:=
Euclidean one. A three-dimensional Minkowsky space can Sum[(InnerProduct[e[k],e[k]]ˆ3)*
D[v,{var[[k]],2}],{k,3}]
be identified by the fact that if (x1 , x2 , x3 ) are the coordi-
nates of a vector x in this space, then the distance to the The function Coeff[m,b], extracts the coefficient
2
origin is |x| = x21 + x22 − x23 . of the blade b in the multivector m. The surface and their
The equation normal are:
In[7]:= f := x1ˆ2 + x2ˆ2 - x3ˆ2 + Rˆ2;
x21 + x22 − x23 = −R2 , (18)
In[8]:= norm = GeoGrad[f] /
defines a hyperboloid of two sheets intersecting the x3 axis Magnitude[GeoGrad[f]];
at the points ±1. Either sheet (upper or lower) models an and, finally, the Gaussian curvature is:
infinite surface without a boundary (the Minkowsky metric
In[9]:= kGauss =
becomes positive definite upon it) that, as we shall see, has
(InnerProduct[norm,GeoLap[norm]]+
constant Gaussian curvature −1/R2.
(GeoDiv[norm])ˆ2)/2 // Simplify
We can easily convince ourselves that Cl2,1 is indeed
the three-dimensional Minkowsky space (the signature of 1
the bilinear form is 2). We shall proceed to calculate the Out[9]= --------------------
Gaussian curvature of the hyperboloid (18) with the stan- 2 2 2
dard formulas of differential geometry but with the metrics x1 + x2 - x3
Points in the surface fulfills: which are the familiar Pauli matrix relations. Cl+
3,1 is also
In[10]:= x3 = Sqrt[x1ˆ2 + x2ˆ2 + Rˆ2], called the Pauli algebra.
Following the same reasoning, we can prove that the
and therefore: even subalgebra of the Pauli algebra is isomorphic to the
In[11]:= kGauss quaternions. The even subalgebra of the quaternions is iso-
morphic to the complex numbers. The even subalgebra of
-2 the complex numbers is R.
Out[11]= -R
which is the Gaussian curvature of the hyperboloid.
Some considerations concerning the isometries 11 Conclusion
(distance-preserving transformations) of the hyperbolic The basic ideas of the Clifford algebra of a vector space
plane are pertinent before leaving this section. Like the Eu- are presented and a Mathematica package for calculations
clidean ones, the isometries of the hyperbolic plane can be within this algebra is developed and demonstrated for com-
described in terms of reflections about given axes. All these plex numbers, quaternions, the hyperbolic plane, Grass-
isometries have simple expressions in terms of Clifford al- mann algebra and, Dirac and Pauli algebras. The relevance
gebra. For instance, Eqn. (14) for rotations in a given plane of Clifford algebra in physics and mathematics lies in the
remains valid in Cl2,1 but now is called a Lorentz trans- fact that it provides a complete algebraic framework of ge-
formation. In general, given the vectors u1 , u2 , . . . , uk in ometric concepts such as directed lines, areas, volumes,
Clp,q , such that (u1 , u2 , . . . , uk )(uk , uk−1 , . . . , u1 ) = 1, etc. (For this reason, Clifford algebra is also referred as
the transformation Geometric algebra [8]). Quantities such as vectors, com-
v 7−→ (−1)k (uk uk−1 · · · u1 )v(u1 u2 · · · uk ) plex numbers, quaternions, Pauli and Dirac matrices, have
been normally described by physicists with a mixture of
e vU,
= (−1)k U disjoint mathematical systems. All of them are naturally
is an isometry [8]. If k is even, the isometry is a rotation, contained in a Clifford algebra. It becomes therefore an ef-
if k is odd, it is a reflection [2]. Now, if q = 0 (∈ Clp,q ), ficient mathematical language in a vast domain of physics.
transformations such as the previous one are orthogonal. Future work comprises extending our Mathematica pack-
For q = 1 (as the case of the Minkoswky space) they are age to other high-level programming languages in order to
Lorentz transformations. facilitate its adoption within the community.

Acknowledgements: JLA wishes to thank UNAM-


10 Dirac and Pauli algebras DGAPA-PAPIIT for financially support this research
through grant IN106115.
Now let us add one extra dimension to the space of the
previous example and consider Cl3,1 . This vector space is
fifteen-dimensional with basis References:
{1, e1 , e2 , e3 , e4 , e1 e2 , e1 e3 , e1 e4 , e2 e3 , e2 e4 , e3 e4 , [1] R. Abłamowicz and B. Fauser. Clifford/bigebra,
e1 e2 e3 , e1 e3 e4 , e2 e3 e4 , e1 e2 e3 e4 } . a maple package for clifford (co)algebra computa-
tions, 2007. c 1996-2007, RA&BF. Available at
The basis vectors ei satisfy the relations:
www.math.tntech.edu/rafal/.
e21 = e22 = e23 = 1, e24 = −1, [2] G. Aragón-González, J.L. Aragón, and M.A.
Rodrı́guez. The decomposition of an orthogonal
which is the algebra of the Dirac matrices in relativistic
transformation as a product of reflections. J. Math.
quantum theory. Due to this isomorphism, Cl3,1 is often
Phys. 47, 2006, Art. No. 013509 (10 pages).
referred as the Dirac algebra. [3] E. Bayro-Corrochano and G. Sobczyk. Geometric Al-
The even subalgebra Cl+ 3,1 has a basis gebra with Applications in Science and Engineering.
{1, e1 e2 , e1 e3 , e1 e4 , e2 e3 , e2 e4 , e3 e4 , e1 e2 e3 e4 } Birkhauser, Boston 2001.
and is equivalent to the algebra of the Pauli matrices used [4] R. Delanghe, F. Sommen, and V. Soucek. Clifford Al-
in quantum mechanics of spin- 21 particles. This can be gebra and Spinor-Valued Functions. D. Reidel Pub-
seen with the identifications lishing Co., Holland 1992.
σ1 = e1 e4 , σ2 = e2 e4 , σ3 = e3 e4 . [5] L. Dorst, D. Fontijne, and S. Mann. Geometric Alge-
bra for Computer Science: An Object-Oriented Ap-
By taking i = e1 e2 e3 e4 = σ1 σ2 σ3 , we get proach to Geometry. Morgan Kauffman, San Fran-
σi2 = 1, i = 1, 2, 3 cisco, CA 2007.
[6] S. Sangwine, and E. Hitzer. Clifford
σ1 σ2 = iσ3
Multivector Toolbox: A toolbox for com-
σ2 σ3 = iσ1 puting with Clifford algebras in Matlab.
σ3 σ1 = iσ2 , http://clifford-multivector-toolbox.sourceforge.net.
Created June 22, 1025. Last accessed December 1,
2015.
[7] D. Hestenes. New Fundations for Classical Mechan-
ics. D. Reidel Publishing Co., Holland 1987.
[8] D. Hestenes and G. Sobczyk. Clifford Algebra to Ge-
ometric Calculus. A unified Language for Mathemat-
ics and Physics. D. Reidel Publishing Co., Holland
1985.
[9] D. Hestenes and R. Ziegler. Projective geometry with
clifford algebra. Acta Appl. Math., 23, 1991, 25–63.
[10] N. Jacobson. Lectures in Abstract Algebra II: Linear
Algebra. Springer, New York 1984.
[11] B. Jancewicz. Multivectors and Clifford Algebra in
Electrodynamics. World Scientific, Singapore 1988.
[12] K. Kanatani. Understanding Geometric Algebra:
Hamilton, Grassmann, and Clifford for Computer Vi-
sion and Graphics. A K Peters/CRC Press, Florida
2015.
[13] S. Lang. Linear Algebra. Addison-Wesley, New York
1969.
[14] A. Lasenby, C. Doran, and S. Gull. Grassmann cal-
culus, pseudoclassical mechanics, and geometric al-
gebra. J. Math. Phys. 34, 1993, pp. 3683–3712.
[15] P. Lounesto. Clifford Algebras and Spinors. Cam-
bridge University Press, Cambridge, 2001.
[16] D. Park, R. Cabrera, and J.-F. Gouyet. Tensorial 4.0 -
a mathematica package for tensor calculus. MiER 12,
2097, pp. 109–122.
[17] Ian Porteous. Clifford Algebras and the Classical
Groups. Cambridge University Press, Cambridge,
1995.
[18] M.A. Rodrı́guez, J.L. Aragón, and L. Verde-Star.
Clifford algebra approach to the coincidence prob-
lem for planar lattices. Acta Crystallogr. A 61, 2005,
pp. 173–184.
[19] G. Sommer. Geometric Computing with Clifford Al-
gebras Theoretical Foundations and Applications in
Computer Vision and Robotics. Springer, Heidelberg
2001.
[20] D.J. Struik. Differential Geometry. Addison-Wesley,
New York 1961.
[21] C.E. Weatherburn. Differential Geometry of Three
Dimensions. Vol. 1. Cambridge University Press,
Cambridge 1965.
[22] T. Wickam-Jones. Mathematica Graphics: Tech-
niques & Applications. Springer –Verlag, New York
1994.

You might also like