Let Q = (0,7) and R=(9,12) be given points in the plane. Find the point P = (x, 0) so that the sum of distances PQ + PR is as small as possible. To do this what function of x do we need to minimize over the closed interval [0,9]?

I've drawn this out the best I can and I can see that it is all about triangles. Using the Pythagorean theorem I can use the x/y axis to make one triangle and I can create another using the x axis and y = 12. This way I need to find an x value such that:

x^2 + 7^2 = ? and (9-x)^2 + 12^2 = ? so that the sum of the two ?s is minimized.

I feel like this is a big accomplishment for me given my past troubles in understanding word problems, but I am still unsure how to relate these two in a single function to minimize...

any help? please??