It may be instructive to point out that the
queen positions
in
a
regular
solution are
part
of a lattice
that
extends to
the
entire
plane.
This can be seen
algebraically by
first
observing
that the
mapping
k:
Z
x
Z
->
Z
x
Zn
defined
by ((x, y))4
=
([x], [y])
is a
group homomorphism.
Let H
be the
cyclic
subgroup
of
Z x Z
generated by
(u, v).
Then the elements of
(HO)4f`
may
be
interpreted
geometrically
as the
positions
of the
queens
obtained
by tiling
the entire
plane
with
copies
of
the
chessboard having queens
located
on
the
squares
Ho.
However,
(HO)O`
is a
subgroup of Z
x
Z, and
therefore it
is a lattice of dimension
two, having
a fundamental
region
of area
equal
to the
absolute
value of the determinant of the matrix
gotten by expressing the lattice basis in terms of
the canonical
basis
of Z
x
Z. Now
an
arbitrary regular
solution
to the
n-queens problem
is
a
translation
of
Ho
for
some cyclic group
H
of
Z
x
Z,
and
this
corresponds
to
the
same
translation
in Z
x
Z
of the
subgroup
(H4)f
'.
Fermat's Two Square
Theorem
In
order to prove Fermat's
result,
we need to show that there
is
a
regular,
doubly symmetric
solution
to
the p-queens problem
whenever
p
is
a
prime
of the form
4k
+
1. To do
this,
we
will
count
the
total
number
of
regular
solutions
for the
p
x
p
board
in
two different
ways.
LEMMA. The number of regular solutions
to
the
p-queens problem,
where
p
is a
prime,
is
p(p
-
3).
Proof. We know that regular solutions have the form
(p, c)
+
((1, d)). Clearly
we do not
get
a
solution
when d
is
p, p
-
1,
or 1. But
any
of
the
other
p
-
3
possibilities
for
d,
in
Zp,
will
produce
regular solutions,
since in these cases
d
-
1, d,
and
d
+
1 will
each be
relatively prime
to
p.
Since
c can
take
on
any
of
p values,
the total number of
regular
solutions
is
p(p
-
3).
A
second
way
of
counting
the
regular
solutions
is
to
partition
them into three
classes, depending
upon
their
symmetry
-
doubly
symmetric, symmetric (invariant
under
a
1800 rotation but not a 900
rotation),
or
nonsymmetric (no
symmetry).
The
symmetries
of the
square
consist of
four reflections
and four
rotations,
and these form
a
group G,
under
composition.
If x
denotes a
regular
solution and
U
E G,
the
regular
solution which results from
x
by applying
the
transformation
U will be denoted
by
xU.
Two
regular
solutions
x
and
y
are
essentially
the
same
if and
only
if
there exists
a
U
E
G such that
xU
=
y.
This is an
equivalence
relation
on the set of all
regular
solutions. The
equivalence
class
of a
solution x consists of all those
solutions
that can be
obtained
from
x
by
rotation
and
reflection. For
each
regular
solution
x,
let
HI-
denote the set of
all
symmetries
of
x;
that
is,
HI
=
{U
E
G
I
xU
=
x}.
HI-
is a
subgroup
of
G.
Furthermore,
if
U,
V
E
G,
xU
=
xV
if
and
only
if
xUV-
=
x,
and
this
happens
if and
only
if
UV-
E
HI-.
It
follows that the number of elements in the
equivalence
class
of
x is
equal
to the index of
HI-
in
G,
and
this
is
2, 4,
or 8
depending upon
whether
x
is
doubly symmetric,
symmetric,
or
nonsymmetric
respectively.
Thus
we
have
the
following
lemma:
LEMMA. The number of regular
solutions to the n-queens problem is 2x
+
4y
+
8z,
where x, y, z are,
respectively,
the number
of essentially
different doubly symmetric, symmetric, and nonsymmetric
regular
solutions to the
n-queens problem.
Now
suppose
that
p
is a
prime
of the
form
4k
+
1.
Combining
the results
of the
preceding
two
lemmas,
we know
that
p(p -3)
=
2x
+
4y
+
8z.
Since,
in this
equation, p
1
(mod
4),
it
becomes
2
2x
(mod 4).
But
this
completes the
proof,
since
this
last
equation implies that x, the number of
essentially
different
regular, doubly
symmetric solutions,
is
not zero.
Finally, we can show that the
positive integers u and v in Fermat's result are unique.
To do this, it
is
sufficient to
prove that
there
are
only two regular, doubly symmetric solutions to the
p-queens
problem
-
a
single solution, and its
horizontal reflection, both of which induce the
same positive
integers
u
and v
for
which
u2
+
v2
=
p.
So, suppose
that
(p, c)
+
((1, d))
is
a
regular,
doubly symmetric
solution
to the
p-queens problem. Since
a
queen
is
located
on
the square (1, [c
+
d]), there must also
be
(by
rotational
symmetry)
a
queen
on the square ([c
+
d], p). This means that
VOL. 50, NO. 2, MARCH 1977
73
This content downloaded from 129.128.216.34 on Wed, 13 Nov 2013 15:26:47 PM
All use subject to JSTOR Terms and Conditions