Take into account that you have a right triangle, then, to calculate the length of KH, use the Pithagorean theorem, just as follow:
KG² = HG² + KH²
where:
KG = 31
HG = 23
KH = ?
solve the previous equation for KH:
KH² = KG² - HG²
replace the values of the parameters:
KH² = 31² - 23²
KH² = 961 - 529
KH² = 432
apply square root both sides
KH = √(432)
KH = 12√3