pythagoras method