You need to apply the Pythagoras theorem, which is a squared + b squared is c squared. C squared in this formula is the hypotenuse squared. The hypotenuse is the longest side of a triangle, opposite the largest angle of the triangle. Keep in mind that the Pythagoras theorem only applies to right angle triangles.
In this question c squared is the diagonal you are trying to figure out.
A squared is any side of the triangle other than c squared, and b squared is the other side of the triangle. So a squared is 16 inches squared, and b squared is 12 inches squared.
To work this out, we square 16 to give 256.
Then 12 is squared - 144.
Then we square root 256 + 144, or the square root of 400.
The square root of 400 is 20, so the diagonal Luke cut was 20 inches long.