Farthest and Nearest Point in the ellipse from a focus using Derivatives Suppose I have an ellipse with major axis lying on the x- axis and center on origin $$\frac{x^2}{a^2} + \frac{y^2}{b^2}=1$$ and two foci at $(-c,0)$ and $(c,0)$.
How can I show that the farthest and nearest points from the right focus are $(-a,0)$ and $(a,0)$ respectively using derivatives?
I tried to differentiate this with respect to x,
$$\frac{1}{a^2}2x + \frac{1}{b^2}2yy' = 0\quad (1)$$
I used the distance formula to compute the distance $d$ of every point $(x,y)$ to the focus by $$d^2 = (x-c)^2 +y^2$$. Differentiating, $$2dd' =2(x-c) +2yy'$$ Since $d'=0$ for the two points,$$0 =2(x-c) +2yy'\quad (2)$$
Combining $(1)$ and $(2)$
$$\frac{1}{a^2}x-\frac{1}{b^2}(x-c)=0$$, Then $$x=\frac{-a^2c}{b^2-a^2}$$. This is impossible because if it would, then $x\ge a$, i.e.,
$$\frac{-a^2c}{b^2-a^2}\ge a$$ $${-a^2c}\le -ac^2$$ since $(b^2-a^2)=-c^2<0$ and $a>c$. Why is this so?

As pointed out in the comments, $y'$ becomes infinite at the points you are looking for, causing your problems.
Instead, I would suggest you to to parameterize your ellipse as
$$\begin{cases}
x(t) = a\cos t \\
y(t) = b\sin t
\end{cases}, \quad 0 \leq t < 2\pi.$$
In this way you avoid any problems with differentiation.
Then you want to minimize
$$ d(t)^2 = (a\cos t - c)^2 + (b\sin t)^2. $$
Differentiate with respect to $t$ to get
\begin{align}
0=2d(t)d'(t) &= 2(a\cos t - c)\cdot(-a\sin t) + 2b\sin t \cdot b\cos t\\
&= -2a^2\sin t \cos t +2ac\sin t + 2b^2\sin t \cos t\\
&= 2\sin t\,(ac-(b^2-a^2)\cos t ).
\end{align}
Now there are two cases to consider, namely $\sin t = 0,$ so that $t = 0$ or $t = \pi$, or
$$ \cos t = \frac{ac}{b^2-a^2} = \frac{ac}{c^2} = \frac{a}{c} > 1, $$
which is impossible.
Finally, to decide whether the minimum is attained at $t=0$ or $t=\pi$, note that since both $a$ and $c$ are positive, we have
$$ d(0)^2 = (a\cos 0 - c)^2 + (b\sin 0)^2 = (a-c)^2 < (a+c)^2 = (a\cos \pi - c)^2 + (b\sin \pi)^2 = d(\pi)^2,  $$
so that the minimum is attained at $t=0$, i.e. at $(x,y) = (a,0).$
