Answer
Each leg is $28.3$ cm.
Work Step by Step
The diagonal of a square will divide the square into two right triangles. The legs of the triangle will be congruent to one another. Let's use the Pythagorean theorem to find the length of the sides of the square since we are already given the length of the hypotenuse, which corresponds to the diagonal of the square:
$a^2 + b^2 = c^2$
Let's plug in what we know:
$x^2 + x^2 = 40^2$
Combine like terms:
$2x^2 = 1600$
Divide both sides by $2$:
$x^2 = 800$
Take the square root to solve:
$x = 28.3$
Each leg is $28.3$ cm.