Here's why:
* Potassium (K) is a metal and has a tendency to lose one electron to achieve a stable electron configuration. This results in a +1 charge, forming a potassium ion (K+).
* Hydrogen (H) is a nonmetal and has a tendency to gain one electron to achieve a stable electron configuration. This results in a -1 charge, forming a hydride ion (H-).
Since one atom readily loses an electron and the other readily gains one, they attract each other electrostatically, forming an ionic bond. The resulting compound would be potassium hydride (KH).