The base is a square with sides of length m so drawing a diagonal divides the square into two right triangles with leg lengths m. By the Pythagorean theorem, the diagonal has length d given by so that . If you drop a perpendicular from the top of the pyramid to the center of the base you have a right triangle with one leg of length h, one leg of length [tex]m\sqrt{2}/2[/itex] (half of a diagonal) and hypotenuse of length e. Put those into the Pythagorean theorem.