What you have discovered on your own was known to the Egyptians and Babylonians over 4000 years ago!
In algebraic form, we write this as
This relationship is known as the Pythagorean Theorem.
Caution! This relationship only holds for right triangles.