Hamilton knew that the complex number provided for rotation in 2-D, so he sought and extension of complex nunbers to model rotation in 3-D. Since the complex number adjoined a new unit, i = √¯1, Hamilton considered adjoining another new unit, j = √¯1. The story of how Hamilton struggled with this for years has been told over and over. Only recently, in A History of Algebra by B. L. van der Waerden, did I learn the difficulty. Hamilton knew that the complex number satisfied a "law of moduli", which van der Waerden states in what I consider a confusing way: "the length of the product equals the product of the lengths of the factors". I believe my definition is better: the binary product of sums of squares equal a sum of squares.
Consider the PRODUCT COEFFICIENTS in the PRODUCT (a + bi)(c + di) = ac + adi + bci - bd = (ac - bd) + (ad + bc)i. Those coefficients are (ac - bd), (ad + bc). Now, consider the SUM OF THEIR SQUARES: (ac - bd)2 + (ad + bc)2 = a2c2 - 2abcd + b2d2 + a2d2 + 2abcd + b2c2 = a2c2 + b2d2 + a2d2 + b2c2 = a2c2 + a2d2 + b2c2 + b2d2 = a2(c2 + d2) + b2(c2 + d2) = (a2 + b2)(c2 + d2). That is, (ac - bd)2 + (ad + bc)2= (a2 + b2)(c2 + d2). This last is "the law of the moduli". What does that mean?
The term (a2 + b2)1/2 is THE MODULUS of the COMPLEX NUMBER, a + bi. And (c2 + d2)1/2 is THE MODULUS of the COMPLEX NUMBER, c + di. So "the law" says "the PRODUCT OF SQUARES OF THE MODULI EQUALS THE SUM OF THE SQUARES OF THE PRODUCT TERMS".
This "law" failed for Hamilton in trying to use a hypercomplex number of the form, u + vi + wj. The problem in MULTIPLYING TWO SUCH NUMBERS had to do with the product term ij. If he set it to zero, the moduli law failed, and he tried various tricks regarding this product. Each morning, his little son would ask: "Well, Papa, can you multiply triplets?" And Hamilton had to reply, "No, I can only add and subtract them." Actually, he could multiply them, but the product did not fit "the law of the moduli" and, wihout this, Hamilton considered "the whole enterprise a failure".
The fundamental formula, i2 = j2 = k2 = ijk = -1 of the theory of quaternions came to Hamilton as he was walking with his wife from Dunsink Observatory to Dublin along the Royal Canal on 16th October, 1843. He carved this formula on a stone of Broome Bridge, where it was seen for decades -- perhaps even today. (Quaternions and the Irish Revolution.)
However, any one reading Hamilton's papers on this might be confused with the fact that Hamilton spent much time -- apart from the ALGEBRA and GEOMETRY of the problem -- playing around with SQUARES OF NUMBERS. Why?
In A History of Algebra, van der Waerden gives us some clues, but does not completely spell out the matter. It happened that the great Swiss mathematician, Leonhard Euler (1707-1783) had, in 1748, found A PATTER SIMILIAR TO THE LAW OF MODULI in finding that VERY INTEGER CAN BE WRITTEN AS THE SUM OF FOUR SQUARES OF INTEGERS. So, this motivated Hamilton's playing around with squares of integers. But the French mathematician, Adrien Marie Legendre (1752-1833) had showed, in 1830, that you cannot, in general, WRITE AN INTEGER AS SUM OF THREE INTEGRAL SQUARES. Had Hamilton known this, he might not have wasted years on the "triplet" problem.
Withal, Hamilton developed inner product, outer product, multiproduct of multivectors, but did little with the latter.