Optimization Problem

Drag point A along the curve and see how its distance to point P on the x-axis changes. Find the position where the distance is minimized. Verify using tools of calculus.