added pythagoras thrm for right triangle