First off, technically, you cannot represent an ellipse by a single function. That may or may not be relevant, but you cannot be sure whether it is relevant unless you take it into account.

Second, the functions representing an ellipse have bounded domains. Again that may or may not be relevant, but you cannot be sure unless you take it into account.

Third, you do not need to use Lagrangian multipliers for this problem.

The ellipse is described by:

$2x^2 - 4x + y^2 = 16.$ So the real functions that are relevant are:

$a(x) = y = +\ \sqrt{16 + 4x - 2x^2} \text { such that } -\ 2 \le x \le 4 \text { and}$

$b(x) = y = -\ \sqrt{16 + 4x - 2x^2} \text { such that } -\ 2 \le x \le 4.$

Why those bounds?

$\pm \sqrt{16 + 4x - 2x^2} = y \in \mathbb R \implies 16 + 4x - 2x^2 \ge 0 \implies 16 \ge 2x^2 - 4x \implies$

$8 \ge x^2 - 2x \implies 9 \ge x^2 - 2x + 1 \implies 3^2 \ge (x - 1)^2 \implies$

$3 \ge (x - 1) \ge -\ 3 \implies 4 \ge x \ge -\ 2.$

The distance function between the origin and a(x) is:

$c(x) = \sqrt{(x - 0)^2 + \left ( +\ \sqrt{16 + 4x - 2x^2} - 0 \right )^2} = \sqrt{ 16 + 4x - x^2 }.$

$c'(x) = \dfrac{4 - 2x}{2\sqrt{ 16 + 4x - x^2 }} \implies c'(x) = 0 \iff x = 2.$

$x = 2 \implies y = \sqrt{16 + 4(2) - 2(2)^2} = \sqrt{16 + 8 - 8} = 4.$

$distance = c(2) = \sqrt{ 16 + 4(2) - (2)^2 } = \sqrt{16 + 8 - 4} = 2\sqrt{5}.$

So we may have a local extremum at (2, 4).

The distance function between the origin and b(x) is:

$d(x) = \sqrt{(x - 0)^2 + \left ( -\ \sqrt{16 + 4x - 2x^2} - 0 \right )^2} = \sqrt{ 16 + 4x - x^2 }.$

$d'(x) = \dfrac{4 - 2x}{2\sqrt{ 16 + 4x - x^2 }} \implies d'(x) = 0 \iff x = 2.$

$x = 2 \implies y = -\ \sqrt{16 + 4(2) - 2(2)^2} = \sqrt{16 + 8 - 8} = -\ 4.$

$distance = d(2) = \sqrt{ 16 + 4(2) - (2)^2 } = \sqrt{16 + 8 - 4} = 2\sqrt{5}.$

So may have a local extremum at (2, - 4)..

So, the distance may be at an extremum at both (2, 4) and (2, - 4). This would be possible only if the locus was a perfect circle centered on the origin, but it is not. What is wrong?

**WITH A BOUNDED FUNCTION, WE MUST ALSO TESTS THE BOUNDS. **

So what is c(4)?

$c(4) = \sqrt{16 + 4(4) - (4)^2} = \sqrt{16 + 16 - 16} = 4 < 2\sqrt{5}.$

And what is c(- 2)?

$c(-\ 2) = \sqrt{16 + 4(-\ 2) - (-\ 2)^2} = \sqrt{16 - 8 - 4} = \sqrt{4} = 2 < 4 < 2\sqrt{5}.$

$b(- 2) = \sqrt{16 + 4(-2) - 2(-\ 2)^2} = \sqrt{16 - 8 - 8} = 0.$

So we have maximal distance at (2, 4) and (2, - 4) and minimal distance at (- 2, 0).

Derivatives are not enough with bounded functions.