funtion dy (part 1)