Area, Perimeter and Diagonal of a Square

Calculates the area of a square as side × side, together with the perimeter and the diagonal (side × √2).

A square has four equal sides and four right angles. A single number, the side length, fixes its area, its perimeter and the length of its diagonal.

S=a2L=4ad=2aS = a^2 \qquad L = 4a \qquad d = \sqrt{2}\,a

Example

With the default side a=5a = 5:

Why the diagonal is about 1.41 times the side

The diagonal is the hypotenuse of a right triangle whose two legs are both aa. By the Pythagorean theorem d2=a2+a2=2a2d^2 = a^2 + a^2 = 2a^2, so d=2ad = \sqrt{2}\,a. Since 21.4142\sqrt{2} \approx 1.4142, the diagonal runs about 1.41 times the length of a side.

Watch out

Area and perimeter do not grow at the same rate. Double the side and the perimeter doubles, but the area quadruples, because area scales with the square of the length. Their units differ too: the perimeter is a length (cm), the area a length squared (cm²). The side must be a positive number.