# Finding points of a function's graph that are closest to a given point

A question from my calculus book states,

Which points on the graph $y=4-x^2$ are the closest to the point (0,2)?

Using some of my notes, I have a formula as follows (not sure what it's actually called):

$$d=\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$$

So I plugged in $(0,2)$ as my $x_1/y_1$ values:

$$d=\sqrt{(x_2-0)^2 + (y_2-2)^2}$$ $$d^2 = (x-0)^2 + (y-2)^2$$

I know $y=4-x^2$ so I plug it in:

$$d^2 = (x-0)^2 + ((4-x^2)-2)^2$$ $$F(x) = (x-0)^2 + (2-x^2)^2$$

Finding the derivative using the chain rule I get:

$$F'(x) = 2(x-0)(1) + 2(2-x^2)(-1)$$ $$0 = 2(x-0)- 2(2-x^2)$$ $$0 = 2x-0-4+2x^2$$ $$0 = 2x^2+2x-4$$

Thus I have a polynomial, so I tried using the quadratic equation to solve for $[x]$ and ended up with $$x=(-2 + 6)/(4) | x=(-2 - 6)/(4)$$, so $x=1/x=-2$?

Can someone help me out with what I'm missing or doing wrong in trying to find the points of the graph to point $(0,2)$?

• I'm not following. The outer $^2$ moves down in front forming $2(2-x^2)$. – Analytic Lunatic Nov 16 '15 at 2:18
• For another method, try creating a circle centered at $(0,2)$ with a radius of zero, and increase the radius until the intersects the parabola $4-x^2$. The radius that gives you your first Real solutions is the one that you're looking for. – John Joy Nov 16 '15 at 17:50
• The formula $d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$ is called the distance formula since it gives the distance between the points $(x_1, y_1)$ and $(x_2, y_2)$. You can derive it using the Pythagorean Theorem. – N. F. Taussig Nov 17 '15 at 0:56

This is a classic optimization problem where you are trying to minimize the distance from the point $(0, 2)$. Given the function $$f(x) = 4 - x^2$$, we can represent all of the points on that curve as, $(x, 4 - x^2)$. Now, we can use the distance formula: $$d = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$$. When we plug in $(x, 4 - x^2)$ and $(0, 2)$ for $(x_1, y_1)$ and $(x_2, y_2)$, respectively, we obtain, $$d = \sqrt{x^4-3x^2+4}$$ We want to minimize the distance function, so we should find when the derivative is equal to $0$. Since the square root will always increase with the inside function, we can disregard the square root and call $$f(x)=x^4-3x^2+4$$. Taking the derivative yields $$f'(x)=4x^3-6x$$ Which when factored is $$f'(x)=2x(2x^2-3)$$. We can see that the critical numbers of the function $f(x)$ are $x = 0$ and $x = \pm\sqrt{\frac{3}{2}}$ Applying the first derivative test shows that $x = \pm\sqrt{\frac{3}{2}}$ are minimums. Therefore the points that are a minimum distance from $(0, 2)$ and are on $y=4-x^2$ are $(\sqrt{\frac{3}{2}}, \frac{5}{2})$ and $(-\sqrt{\frac{3}{2}}, \frac{5}{2})$.

That formula is just called the "Distance formula", or sometimes the "Euclidean distance formula". It is just an application of the Pythagorean theorem.

$$F'(x) = 2(x-0)(1) + 2(2-x^2)(-1)$$
(But first of all, surely you know $x - 0 = x$. Why did you keep that $-\ 0$ around?)
The chain rule applied to the second term of $F(x)$ is:
$$\frac{d(2-x^2)^2}{dx} = \frac{d(u^2)}{du}\frac{du}{dx}$$ where $u = 2 - x^2$
$$\frac{d(u^2)}{du} = 2u$$ $$\frac{du}{dx}= \frac{d}{dx}(2 - x^2) = 0-2x=-2x$$ Therefore $$\frac{d(2-x^2)^2}{dx} = 2u(-2x)= -4ux = -4(2 - x^2)x$$ So $$F'(x) = 2x -4x(2 - x^2)$$