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.
With the default side :
The diagonal is the hypotenuse of a right triangle whose two legs are both . By the Pythagorean theorem , so . Since , the diagonal runs about 1.41 times the length of a side.
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.