The surface of pyramid is calculated by summing surface of its base and surface of its mantle.
Surface of base is easy to calculate. You have a square and its side is known therefore surface is:
Sb = a^2
Surface of mantle is a bit more complicated to calculate. First you have 4 sides of pyramid and each side is a triangle. To calculate surface of each triangle we need to know its height.
First we calculate side of triangle using Pitagorah's theorem.
s = √((d/2)^2 + H^2) where d is diagonal of base which is square.
d = √2a
Now again we have to use Pitagorah's theorem to calculate height of the triangle.
h = √(s^2 - (a/2)^2)
Now the surface of the triangle is calculated with:
St = (ah)/2 and surface of mentle is:
Sm = 4*St.
Total surface of pyramid is:
Sb + Sm