divide and conquer mmethod added for inversion