ESR spectra of H (D) atoms, produced in gamma-irradiated solid hydrogen were studied at 4.2 K. The ESR linewidth of the trapped hydrogen atoms depends significantly upon the matrices of hydrogen isotopes. The ESR linewidth has been calculated with the orthogonalized wavefunction on the basis of the model presented. It is concluded from the comparison of the experimental ESR linewidths with theoretical ones that H atoms in solid H-2 are trapped in substitutional sites, while H (D) atoms in solid HD and D2 are trapped in interstitial octahedral sites.