In mathematics, (sometimes alternatively denoted by ) is the dihedral group of degree 4 and order 8. It is the symmetry group of a square. A square maintains its appearance under 90° rotations about its center (4-fold rotational symmetry), and under reflections across four lines passing through the center – two lines parallel to the sides and its two diagonals (reflection symmetry).

Symmetries of a square Consider a square of a certain thickness with the letter "F" written on it to make the different positions distinguishable. In order to describe its symmetry, one can form the set of all those rigid movements of the square that do not make a visible difference (except the "F"); each of these is a symmetry transformation. For instance, when the square is turned 90° clockwise or reflected across its vertical axis, it still looks the same, so these two movements are symmetry transformations.

Every point inside the square which does not lie on any of its four axes of symmetry will be mapped to 8 distinct points by these transformations, collectively called the point's orbit. An octant of the square (the region between one horizontal or vertical axis and one diagonal axis, an isosceles right triangle) is a fundamental domain of the square's surface under these symmetry transformations, containing one point from each possible orbit. One octant is highlighted in blue in the images above, to show how each symmetry transformation maps it onto a distinct octant.

Generating the group

With composition as the operation, the set of all those movements forms a group: Applying two symmetry transformations in succession yields a symmetry transformation, so the transformations are closed under composition. The symmetries of the square can be fully described by this group's Cayley table, analogous to a multiplication table but using the group operation instead of multiplication. To draw such a table explicitly, each symmetry must be assigned some symbol. In the following table, each symmetry is represented concretely by a curved arrow (rotation), double-ended arrow (reflection), or dot (identity transformation), corresponding to the images above:

Each entry in this table represents the composition of two symmetries: that is, the symmetry transformation resulting from performing first the symmetry transformation for the column and then performing the symmetry transformation for the row. For instance, a reflection in the diagonal NE–SW direction followed by a horizontal reflection is equivalent to a three-quarters-turn rotation anticlockwise which can be written as an equation , using the convention that means applying after . Thus the table entry for row and column is .

Instead of pictorial symbols, mathematicians more commonly use letters. The juxtaposition of two letters represents the composition of their respective symmetries , and an integer superscript represents the composition of the same symmetry multiple times, e.g. represents and represents the inverse of . The letter is commonly used for the identity element. The use of this shorthand reduces the number of distinct symbols required to represent group elements.

Any element which can be written as the composition of a particular set of elements is said to be generated by those elements, for example the element is generated by and ; any set of elements which generates the whole group is called a generating set of the group. Every dihedral group can be generated from two elements, so only three elements of the group (those two and the identity) need be assigned symbols, and the other elements can be expressed by combining them.

The symmetries of the square can be generated in two basic ways: using one diagonal reflection and one horizontal or vertical reflection, or using one quarter-turn rotation and one reflection. For example, letting the letter represent a quarter-turn rotation anticlockwise , letting the letter represent a vertical reflection , and letting the letter represent a diagonal NW–SE reflection , any pair of these elements generates the group, and the rest of the group elements can be written in terms of these. Concretely, each symmetry could be written as any of the following (the various expressions in each row represent the same symmetry):

Even after choosing a pair of generators, these expressions are not unique, e.g. . If for example we use the first column above to name the group elements, the Cayley table could be written as:

Two elements and are conjugate to each-other if there is an element such that . The set of all elements which are pairwise conjugate is called a conjugacy class. These classes are important because two elements which are conjugate to each-other cannot be distinguished using only the group structure. The dihedral group of order 8 has 5 conjugacy classes: , , , , .

In mathematics this group is known as the dihedral group of order 8, and is either denoted Dih4, D4 or D8, depending on the convention. This is an example of a non-abelian group: the operation here is not commutative, which can be seen from the table; the table is not symmetrical about the main diagonal.

There are five different groups of order 8. Three of them are abelian: the cyclic group C8 and the direct products of cyclic groups C4×C2 and C2×C2×C2. The other two, the dihedral group of order 8 and the quaternion group, are not.

Permutation representation

Every symmetry transformation of the square permutes (re-orders) the square's four corners, so each symmetry transformation can be associated to a particular permutation of four elements; therefore is isomorphic to a permutation group, a subgroup of the symmetric group of all permutations of elements.

If the corners of a square are numbered consecutively, starting from 1 in the upper right and proceeding counterclockwise, then the permutation corresponding to each symmetry transformation can be written using cycle notation:

Matrix representation

Symmetry transformations of an axis-aligned square centered at the origin are linear transformations, so can be represented by matrices acting on the plane by multiplication on column vectors of coordinates . Specifically, these transformations correspond to signed permutation matrices.

The identity transformation is represented by the identity matrix . A horizontal reflection is represented by the matrix which negates the coordinate, while a vertical reflection is represented by the matrix which negates the coordinate. The NW–SE diagonal reflection is represented by the matrix which exchanges the two coordinates, while the NE–SW diagonal reflection is represented by its negative A rotation anticlockwise by a quarter turn is represented by the matrix and a rotation by three quarters of a turn by its negative Finally, a rotation by a half-turn , equivalent to a reflection across the center point, is represented by the matrix which negates both coordinates. The group composition operation is represented as matrix multiplication.

Four of these matrices, representing for example the identity transformation, a vertical reflection, a diagonal reflection, and a quarter-turn rotation, form a basis for the matrix algebra of real matrices.

Larger signed permutation matrices represent in the same way the hyperoctahedral groups, the groups of symmetries of higher dimensional cubes, octahedra, hypercubes, and cross polytopes.

Split-quaternions

The split-quaternions are a number-like algebraic structure with four dimensions, similar to the quaternions. Like the quaternions, their multiplication is associative but not commutative.

They can be written in terms of four basis elements which satisfy the basic identities:

The group of these basis elements and their negatives, with multiplication as the group operation, is isomorphic to the dihedral group , where corresponds to the identity transformation , corresponds to a quarter-turn rotation , corresponds to a vertical reflection , and corresponds to a diagonal reflection . Using these symbols, the Cayley table can be written as:

Subgroups

A subgroup of a group is a subset of the elements which also form a group. has three subgroups of order four: one consisting of the four rotations of the square by quarter turns which is a cyclic group of order 4, and two others generated by pairs of perpendicular reflections and each of which is a dihedral group (also known as the Klein four-group). Each of the four reflections generates a cyclic subgroup of order 2 . One final cyclic subgroup of order 2 consists of the rotations by half-turns

For every subgroup in , the group can be split into a collection of disjoint subsets of the same size (cardinality) as , called cosets. There are both left cosets, of the form and right cosets, sets of the form For example, the subgroup has four left cosets,

and four right cosets,

Normal subgroups A subgroup is called normal if it contains all of the conjugates of its elements. Both of the groups of rotations, as well as the dihedral groups of order 4, are normal subgroups. The four subgroups generated by a single reflection are not normal.

For a normal subgroup, the left and right cosets coincide, and the cosets themselves form a quotient group.

This version of the Cayley table shows one of these normal subgroups, shown with a red background. In this table r means rotations, and f means flips. Because this subgroup is normal, the left coset is the same as the right coset.

{| class="wikitable" style="float:left; text-align:center; margin:.5em 0 .5em 1em; width:40ex; height:40ex;" |+ Group table of D4 |- ! style="width:12%; background:#fdd; border-top:solid black 2px; border-left:solid black 2px;"| ! style="background:#fdd; border-top:solid black 2px; width:11%;"| e ! style="background:#fdd; border-top:solid black 2px; width:11%;"| r1 ! style="background:#fdd; border-top:solid black 2px; width:11%;"| r2 ! style="background:#fdd; border-right:solid black 2px; border-top:solid black 2px; width:11%;"| r3 ! style="width:11%;"| fv !! style="width:11%;"| fh !! style="width:11%;"| fd !! style="width:11%;"| fc |- !style="background:#FDD; border-left:solid black 2px;" | e |style="background:#FDD;"| e |style="background:#FDD;"| r1 |style="background:#FDD;" | r2 |style="background:#FDD; border-right:solid black 2px;"| r3 || fv || fh || fd |style="background:#FFFC93; border-right:solid black 2px; border-left:solid black 2px; border-top:solid black 2px;"| fc |- !style="background:#FDD; border-left:solid black 2px;" | r1 |style="background:#FDD;"| r1 |style="background:#FDD;"| r2 |style="background:#FDD;"| r3 |style="background:#FDD; border-right:solid black 2px;"| e || fc || fd || fv |style="background:#FFFC93; border-right: solid black 2px; border-left: solid black 2px;"| fh |- style="height:10%" !style="background:#FDD; border-left:solid black 2px;" | r2 |style="background:#FDD;"| r2 |style="background:#FDD;"| r3 |style="background:#FDD;"| e |style="background:#FDD; border-right:solid black 2px;"| r1 || fh || fv || fc |style="background:#FFFC93; border-right: solid black 2px; border-left: solid black 2px;"| fd |- style="height:10%" !style="background:#FDD; border-bottom:solid black 2px; border-left:solid black 2px;" | r3 |style="background:#FDD; border-bottom:solid black 2px;"| r3 |style="background:#FDD; border-bottom:solid black 2px;"| e |style="background:#FDD; border-bottom:solid black 2px;"| r1 |style="background:#FDD; border-right:solid black 2px; border-bottom:solid black 2px;"| r2 || fd || fc || fh |style="background:#FFFC93; border-right:solid black 2px; border-left:solid black 2px; border-bottom:solid black 2px;"| fv |- style="height:10%" ! fv | fv || fd || fh || fc|| e || r2 || r1 || r3 |- style="height:10%" ! fh | fh || fc || fv || fd || r2 || e || r3 || r1 |- style="height:10%" ! fd | fd || fh || fc || fv || r3 || r1 || e || r2 |- style="height:10%" ! fc