A paper by Hamilton entitled
Researches respecting Quaternions: First Seriesappeared in the Transactions of the Royal Irish Academy, volume 21 (1848), pp. 199-296.
This paper is available in the following formats:
In this paper, Hamilton discusses the algebraic foundations of his theory of quaternions, exhibiting this theory as an particular instance of a general theory of sets, (i.e., ordered n-tuples in today's terminology). There is extensive discussion of the associative law. Applications of quaternions to spherical trigonometry are discussed.
A letter from Hamilton to John T. Graves is appended to this paper. This letter is dated 24th October, 1843 (i.e., six days following Hamilton's discovery of the algebra of quaternions), and discusses quaternions and their relation to spherical trigonometry.