There's a little trick that will get the answer quickly. Imagine that the x-axis is a mirror, so that the point R is reflected to the point R'=(9,-7). The shortest distance from Q to R' is a straight line, and you can easily find the point P where that meets the x-axis. Then PQ+PR=PQ+PR', and that will give the solution to the problem.