How can Hamilton's quaternion equation be true? I'm reading Ken Shoemake's explanation of quaternions in David Eberly's book Game Physics.  In it, he describes the $\mathbf{i}, \mathbf{j},  \mathbf{k}$ components of quaternions to all equal $\sqrt{-1}$.  Then it states Hamilton's quaternion equation:
$\mathbf{i}^2 = \mathbf{j}^2 = \mathbf{k}^2 = \mathbf{ijk} = \mathbf{-1}$
If $\mathbf{i} = \mathbf{j} = \mathbf{k} = \sqrt{-1}$, then it makes sense how $\mathbf{i}^2 = \mathbf{-1}$.  But $\mathbf{ijk}$ should equal $\mathbf{i}^3$, not $\mathbf{i}^2$.  How does $\mathbf{ijk} = \mathbf{-1}$?
The book's notation says that lowercase bold letters denote a vector, so I'm thinking of $\mathbf{i}$, $\mathbf{j}$, and $\mathbf{k}$ as the basis of the quaternion, similar to the basis of a vector, and can be written $(\sqrt{-1}, \sqrt{-1}, \sqrt{-1})$.  Having the result of $\mathbf{ijk}$ as a bold $\mathbf{-1}$ to me implies that it is the vector $(-1, -1, -1)$.  Is this understanding correct?  In this context, what does it mean to square vector $\mathbf{i}$?  If it equals another vector, then the only operation that makes sense is the cross product, but the cross product of a vector and itself is the zero vector.
 A: Because $\mathbf{jk} = \mathbf{i}$, so $\mathbf{ijk} = \mathbf{i}\cdot\mathbf{i} = -1$.  That's the way they're defined; $\mathbf{i}, \mathbf{j}, \mathbf{k}$ are all three separate quantities, each of whose square is equal to $-1$.  Multiplication is associative but not commutative.
We have
$$
\mathbf{ij} = \mathbf{k}, \mathbf{ji} = -\mathbf{k}
$$
$$
\mathbf{jk} = \mathbf{i}, \mathbf{kj} = -\mathbf{i}
$$
$$
\mathbf{ki} = \mathbf{j}, \mathbf{ik} = -\mathbf{j}
$$
These rules can be derived from Hamilton's equation.  Provided that multiplication is performed associatively and carefully, adhering to those rules, one avoids the kind of contradiction you describe.
The $-1$ in Hamilton's equation is generally regarded as the ordinary scalar value $-1$, although one can write quaternions in general as $4$-tuples, with $(a, b, c, d)$ representing $a+b\mathbf{i}+c\mathbf{j}+d\mathbf{k}$.
A: 
In it, he describes the $\mathbf{i}, \mathbf{j},  \mathbf{k}$ components of quaternions to all equal $\sqrt{-1}$. 

Unless he is constructing quaternions from complex numbers, there is no $\sqrt{-1}$ available to be equated with anything.   
Instead, these are three independent equations   $i^2 = -1, \quad j^2=-1, \quad k^2=-1$ that are used as part of the definition of a multiplication rule on the 4-dimensional vector space generated by a set of four different vectors that are (arbitrarily) assigned the names $1,i,j,k$.   There are many un-interesting multiplication rules such as $x \ast y = x$ for all vectors $x,y$, but Hamilton found a much more interesting one.

Then it states Hamilton's quaternion equation:
$\mathbf{i}^2 = \mathbf{j}^2 = \mathbf{k}^2 = \mathbf{ijk} = \mathbf{-1}$

The equation $ijk=-1$ is a mnenomic device for reproducing the full set of defining equations, but is not itself part of the definition.
There are 4x4=16 products of ordered pairs of the generators, and all of them need to be specified in order to define multiplication.  Here only 3 products of pairs are given, and one is supposed to infer the rest from $ijk=-1$ by multiplying that equation on the left or the right by $i,j$ and $k$ in all possible ways, assuming associativity, and applying the previous three rules.  
The other rules of quaternion multiplication are $1x = x1 = x$ for all $x$; the $i,j,k$ anticommute when distinct pairs are multiplied (so $ij = -ji$ et cetera); and cyclic permutations of $ij = k$.
This multiplication law is linear in each variable, distributive, associative, noncommutative, and (most unusually) every nonzero element has a multiplicative inverse.

But $\mathbf{ijk}$ should equal $\mathbf{i}^3$, not $\mathbf{i}^2$.
  How does $\mathbf{ijk} = \mathbf{-1}$?

For example, $ijk = i(jk) = i(i) = -1$.

The book's notation says that lowercase bold letters denote a vector, so I'm thinking of $\mathbf{i}$, $\mathbf{j}$, and $\mathbf{k}$ as the basis of the quaternion, similar to the basis of a vector,

They are 3 of the 4 basis vectors.  Every quaternion has a unique expression as a1 + bi + cj + dk for some numbers $a,b,c,d$.

Having the result of $\mathbf{ijk}$ as a bold $\mathbf{-1}$ to me implies that it is the vector $(-1, -1, -1)$.

It is the vector (-1)1 where the -1 is a real number and the boldface 1 is one of the basis elements of the quaternions as a vector space.

In this context, what does it mean to square vector $\mathbf{i}$? 

To use Hamilton's multiplication law to multiply that vector by itself.  The result will, by construction, be equal to some other quaternion.  The quaternion that it equals happens to be (-1)1, also known as -1.
A: It is not true that $i=j=k=\sqrt{-1}$. It is only true that $i^2=j^2=k^2=-1$.
Similarly, it is true that $(-2)^2=2^2=4$, but that does not mean that $-2=2=\sqrt 4$.
In fact, the formulas you have written down are axioms that form the quaternions. You decide that you will look at the division ring (i.e. a ring where you can divide by all numbers but $0$) in which you have $3$ different numbers which all square to $-1$ and which satisfy the equation $ijk=-1$. That's how the quaternions are defined. And no, $ijk$ should not be equal to $i^3$, because in fact, $ij=k$, meaning that $ijk=kk=-1$ which fits with your formulas.
