suppose the order of g is k. since g^m = 1, k is a divisor of m.

(to see this: write m = kq + r, where 0 ≤ r < k

then 1 = g^m = g^(kq + r) = (g^(kq))(g^r) = (g^k)^q(g^r) = (1^q)(g^r) = g^r.

since k is the least positive integer with g^k = 1, r = 0, so m = kq).

similarly, k divides n = |G|. since k is a common divisor of m and n, and gcd(m,n) = 1, k = 1,

that is 1 = g^k = g^1 = g.