Solution for problem 6; sum square difference