DrawCayleyTable - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Mathematics : Group Theory : DrawCayleyTable





draw the Cayley table of a finite group


Calling Sequence






Calling Sequence

DrawCayleyTable(G, opts)




group data structure



(optional) equations of the form keyword = value, as explained below



assignelements = name


Specifying assignelements = x causes Maple to assign the list of elements to the name x, in the order in which the elements occur in the Cayley table. If x already has an assigned value, it will typically be necessary to use quotes to prevent evaluation of x: one can do so by specifying assignelements = 'x'.


collect = truefalse


If collect is false, then the group elements are ordered arbitrarily. If collect is true, then the ordering of the group elements depends on the presence and values of the conjugacy, cosets, and subgroups options. See their descriptions below for details.


If none of the options conjugacy, cosets, and subgroups are given, but collect is true, then a black vertical line and a black horizontal line divide the table into four quadrants. The upper left quadrant forms the Cayley Table for the center subgroup.  In other words, the elements in the center are left of (above) the vertical (horizontal) black line, and elements not in the center are right of (below) the vertical (horizontal) black line.


Specifying just collect is equivalent to specifying collect = true. By default, collect is true.


colors = list or palette


If given as a list, colors must be a list of colors [c1,c2,..] to be used for the group elements. colors can also be given as a ColorTools palette object or palette name.


The presence and values of the conjugacy, cosets, subgroups, and symmetry options determines how exactly the group elements are colored. Each of these options determines a grouping of elements; each group of elements gets a different color. If none of the options is given, the groups are simply all the individual group elements.


The colors specified in colors are used in order for the groups given; if there are more groups of elements than colors, the palette will be extended automatically; see ColorTools/Palette and ColorTools/ExpandPalette for more information. Lists of colors are automatically converted to a palette. Note: extending a palette can be a slow operation; if you need a large palette, it is most efficient to generate sufficient colors yourself.


Individual colors should be specified in a way that ColorTools[Color] recognizes.


The default value is a somewhat lighter version of what plots[setcolors] returns.


conjugacy = truefalse


If conjugacy = true then elements are colored identically if and only if the elements are conjugate. Specifying just conjugacy is equivalent to specifying conjugacy = true. By default, conjugacy = false.


If collect = true and conjugacy = true, then the elements in the same conjugacy class will be collected together. To be precise, if there are conjugacy classes C1,C2,... then the elements in C1 will be first in the list of elements, then the elements in C2 will be next, and so forth.


cosets = subgroup, list or set


If cosets = H, the elements of G are partitioned into cosets using the subgroup defined by H. Elements are then colored identically if and only if they are in the same partition. H can be specified as a group data structure obtained using Subgroup, or with a list or set of generators (which will in turn be passed to Subgroup).


If collect = true and the cosets option is specified, the elements in the same coset will be collected together. To be precise, if there are cosets H1,H2,... then the elements in H1 will be first in the list of elements, then the elements in H2 will be next, and so forth.


cosettype = right or left


If cosettype = right then the cosets formed using cosets option will formed by multiplication on the right by the coset representative, i.e. Hg. Similarly, if cosettype = left, multiplication is on the left by the coset representative, i.e. gH. By default, cosettype = left.


font = list


This option defines the font for all labels on the Cayley table. The font is specified as explained in plot/options.


fontcolor = [color1, color2]


This option defines the color for the labels on the Cayley table. The first color is used for sites where the background is light, the second where the background is dark. color1 and color2 should be specified in a way that ColorTools[Color] recognizes. The default is black,white.


labels = name or proc


If labels is given as a procedure, then that procedure must accept as input an element of G and a positive integer; the integer is the number of the element in the order used. It should return the label to be used for the group element.


If labels is given as a name, the value must be one of literal, words, letters, numbers, or none. Use


literal for any group. Group elements are directly converted to displayable format, using the print operation as returned by the command GroupTheory[Operations].


words for any group where GroupTheory[Labels] returns a list. Group elements are expressed in terms of the labeled generators.


letters only if the number of elements is less than or equal to 26. The elements are labeled with lowercase letters. The identity is labeled 'e'; the other elements are labeled with the remaining letters from 'a' to 'z'.


numbers for any group. The elements are labeled with positive integers, starting with '1' for the identity.


none for any group. No labels are displayed.


For groups of more than 26 elements, the default is labels=none. For groups of 15 to 26 elements, the default is labels=letters. For fewer than 15 elements, if labels=words is valid for a group, that is the default. Otherwise, Maple uses a heuristic to determine if the literal labels would be too wide for the plot with the default size options; if so, it uses labels=letters, otherwise labels=literal.


legend = truefalse


If legend = true, below the Cayley table, a legend of which labels correspond to which elements appears in the plot. Otherwise, if legend = false, nothing appears. Specifying just legend is equivalent to specifying legend = true. By default, legend = false.


order = truefalse


If order = true then on the leftmost side where the elements are labeled by row, the order of each element appears to the left of its label. Otherwise, if order = false, nothing appears. Specifying just order is equivalent to specifying order = true. By default, order = false.


render3d = truefalse


If render3d = true then the output will be a three-dimensional plot, and each entry in the Cayley table will be a block, instead of a square. Otherwise, if render3d = false, then output will be a two-dimensional plot. Specifying just render3d is equivalent to specifying render3d = true. By default, render3d = false.


subgroups = list


The list must be a list of subgroups of G. Each subgroup will be assigned a color. Elements in the same subgroup are colored according to the subgroup's assigned color. A legend of the subgroup colors automatically appears on the right-hand side. If an element is in none of the specified subgroups, it is assigned the color black in 2-D and a gradient color in 3-D.


If render3d = true, then for elements occurring in multiple subgroups, a stack of blocks is displayed, one block for each subgroup the element is a member of (each block in its corresponding color). This can be seen by rotating the image.


If render3d = false, an element in multiple subgroups is colored by blending each subgroup color.


If collect = true and subgroups is specified, then elements in the same subgroup will be collected together. To be precise, if there are subgroups H1,H2,... then the elements in H1 will be first in the list of elements, then the elements in H2 will be next, and so forth. This will be reflected in the drawing of the Cayley Table itself.


If an element is in multiple subgroups, then it is collected with the first subgroup in which the element is found in the list prescribed by the option subgroups. For example, if an element s is found in subgroups H2,H3, and H5, then s will be collected with elements from H2.


symmetry = truefalse


If symmetry = true, then if two elements a,b in G commute, then the Cayley table entries of ab and ba are colored as the first specified color in colors. If the elements do not commute, then the entries are colored as the second color. Otherwise, if symmetry = false, the elements are colored according to whichever other method of coloring is selected. Specifying just symmetry is equivalent to specifying symmetry = true. By default, symmetry = false.


title = expr


The given expression is typeset as the title above the Cayley table.


titlefont = list


The title is printed with this font.  The font is specified as explained in plot/options.


Any additional options are passed to plotsdisplay.



The command DrawCayleyTable accepts a finite group G and returns a plot of the Cayley table of G.  The element labels are written along the left and top edge of the table. The (i,j) entry of the table represents the product of the element at the left of row i, and the element at the top of column j.  Hence, the entry is the product ij.  Each element of G is assigned a color, so if the element appears anywhere in the table, that entry is colored the element's assigned color. The black horizontal and vertical lines designate the center.  See option center for details.


The returned plot is by default two-dimensional, but can be returned as a 3-D object. In this case, each table entry is a cube, instead of a square.


For the options subgroups and cosets, to specify a subgroup H of G, H must be subgroup data structure, or a list or set of generators of a subgroup that is accepted by the Subgroup command.


At most one of the options conjugacy, cosets, subgroups, and symmetry can be active. (These options all determine the method of coloring of the elements.)


An error will be thrown if this condition is violated.


For an option to be 'active' means to have the value true for the conjugacy, and symmetry options; for the cosets, and subgroups options, it means to be included in the calling sequence.


To label elements without using the labels option, most types of groups allow one to specify labels for the generators in the group constructor, using equations. For example, instead of constructing a permutation group as PermutationGroup1,2,1,2,3, one can label the generators by constructing the group as PermutationGroupa1=1,2,a2=1,2,3. All other elements will be written as products of these generators, and hence of these labels.



We draw the Cayley table of the Symmetric Group on 3 letters.





We can obtain the list of elements as well.








There exist various labelling options. For smaller groups, Maple displays the elements explicitly or expresses them in terms of generator names.

G := CustomGroup({1}, `.` = proc(a,b) a+b mod 2; end proc, `/` = (x -> x));

G < a custom group with 1 generator >



Specifying labels=numbers or labels=letters (the default used below) is useful when there are many elements. If there are far too many elements, try labels=none.


We partition the Symmetric Group on 4 letters by the Klein 4 group. Recall that the collection of resulting cosets form a group isomorphic to Symmetric Group on 3 letters. We specify H as a set of generators.








Since H is a normal subgroup, the entries all form blocks, effectively giving the Cayley table of the quotient group. If we take a non-normal subgroup, we don't have that effect.





We partition the Quaternions into its conjugacy classes.




DrawCayleyTableG&comma;conjugacy=true&comma;title=With Conjugacy Classes collected

Above, the conjugacy classes are collected. If we set this option to be false we instead obtain the original Cayley Table but elements are now colored according to conjugacy class.

DrawCayleyTableG&comma;conjugacy=true&comma;collect=false&comma;title=With Conjugacy Classes NOT collected

DrawCayleyTableG&comma;collect=false&comma;title=Original Cayley table

Now, we draw the direct product of CyclicGroup(4) and CyclicGroup(2) and highlight elements belonging to various subgroups. Elements in the multiple subgroups are blended with the same color. Using the 3-D display can be helpful here.









We can, for example, use the derived series to give us a number of subgroups as well.








For AlternatingGroup(4), we highlight noncommutative and commutative entries in different colors. An entry is noncommutative if in the table, ab is not equal to ba. As we can see, the elements in the center have rows and columns which are entirely filled with the color representing commutative multiplication.





If we want to see the actual permutations, it looks best if we scale the size up somewhat.




The GroupTheory[DrawCayleyTable] command was introduced in Maple 17.


For more information on Maple 17 changes, see Updates in Maple 17.

See Also