New method to obtain periodic solutions of period two and three of a rational difference equation