在這篇論文中,我們會先介紹矩陣的canonical form,並利用它來解決2-by-2整數矩陣的相似問題。除了canonical forms之外,我們也會找出generators of the stabilizers of the canonical forms,目的是為了解決3-by-3整數矩陣的相似問題。在應用方面,相似問題能幫助我們算出ideal class number of a quadratic algebra over rational number field Q。最後,在論文中也提供了計算canonical form、判斷矩陣是否相似以及算出判斷矩陣是否相似以及算出ideal classes numbers of quadratic Z-orders的程式碼。;In this thesis, we first introduce the canonical forms and solve the similarity problem of the case of 2-by-2 integral matrices. One direct application is to compute the ideal class number of a quadratic algebra over Q. We also determine the generators of the stabilizers of the canonical forms for 2-by-2 integral matrices, which enables us to solve the similarity problem of 3-by-3 integral matrices with reducible characteristic polynomials. Furthermore, we provide the codes(using Sagemath) for computing the canonical form of a given matrix, determining whether two given matrices are similar or not, and computing the ideal classes numbers of quadratic Z-orders.