Let O be the point (0,0) and Q be (3,2).
OP=x, PQ=√(3-x)²+2²) (Pythagoras).
OP²+PQ²=x²+(3-x)²+4=x²+9-6x+x²+4=2x²-6x+13=2(x²-3x)+13.
This can be written 2(x²-3x+9/4-9/4)+13=2((x-3/2)²-9/4)+13.
This simplifies: 2(x-3/2)²-9/2+13=2(x-3/2)²+17/2.
The expression is minimum when x=3/2=1.5 giving the minimum distance S=17/2=8.5.