In group theory, the quaternion group is a non-abelian group of order 8 with a number of interesting properties. It is often given the symbol Q8.

The quaternion group is usually written in multiplicative form, with the following 8 elements

Q8 = {1, -1, i, -i, j, -j, k, -k}.
Here 1 is the identity element, (-1) · (-1) = 1, and -1 · a = a · (-1) for all a; we write this latter element as -a. The remaining relations can be obtained from the following multiplication table:

i j k
i -1 k -j
j -k -1 i
k j -i -1

Note that the resulting group is non-commutative; for example ij = -ji.

Q8 has the unusual property of being Hamiltonian: every subgroup of Q8 is a normal subgroup, but the group is non-abelian. Every Hamiltonian group contains a copy of Q8.

In abstract algebra, we can construct a real 4-dimensional vector space with basis {1, i, j, k} and turn it into an associative algebra by using the above multiplication table and distributivity. The result is a skew field called the quaternions.

Conversely, one can start with the quaternions and define the quaternion group as the multiplicative subgroup consisting of the eight elements {1, -1, i, -i, j, -j, k, -k}.

Q8 has a presentation with generators {x,y} and relations x4 = 1, x2 = y2, and y-1xy = x-1. (For example x = i, y = j.) A group is called a generalized quaternion group if it has a presentation, for some integer n > 1, with generators {x,y} and relations x2n = 1, x2n-1 = y2, and y-1xy = x-1. These groups are members of the still larger family of dicyclic groups.