implements square rooting method