I am trying to solve
$$\begin{array}{ll} \text{extremize} & f(x,y) := x^2+3y\\ \text{subject to} & \dfrac{x^2}{4} + \dfrac{y^2}{9} -1 = 0\end{array}$$
I cannot understand why I am able to find the points $(0,3)$ and $(0,-3)$ as extrema when using Lagrange multipliers, or when solving $g(x,y)$ for y and substituting its value in $f(x,y)$. However, I could not manage to obtain the same results by solving $g(x,y)$ for x and substituting its value in $f(x,y)$, which gives me $y=\frac{27}{8}$.
Is anybody able to clarify?
The Lagrange equations you presumably found are $$ 2x \ = \ \lambda · \frac{x}{2} \ \ , \ \ 3 \ = \ \lambda · \frac{2y}{9} \ \ \ . $$
The first of these would be factored as $ \ x · \left( 2 - \frac12 · \lambda \right) \ = \ 0 \ \ , $ which has the solutions $ \ x = 0 \ $ or $ \ \lambda = 4 \ \ . $ We can use the constraint ellipse equation to find the points $ \ (0 \ , \ \pm 3) \ \ , $ which give us the absolute extrema values for $ \ x^2 + 3y \ $ on the ellipse of $ \ \pm 9 \ . $ The result for $ \ \lambda = 4 \ $ is the source of the result $ \ y = \frac{27}{8} \ \ , $ which we "reject" as that does not correspond to a point on the ellipse.
When you solve the constraint equation to obtain $ \ x^2 \ = \ 4 - \frac49 · y^2 \ \ , $ the function become $ \ f(y) \ = \ -\frac49 · y^2 + 3y + 4 \ \ . $ Note that as this is the description of a "downward-opening" parabola, we will only obtain the absolute maximum for the function, which lies at $ \ -\frac89 · y + 3 \ = \ 0 \ \Rightarrow \ y = \frac{27}{8} \ \ , $ yielding a value of $ \ \frac{145}{16} \ \ . $ Again, this value of $ \ y \ $ does not satisfy the constraint equation, so we would discard it. This choice of substitution has "destroyed" information about the behavior of the function on the ellipse, apparently.
The other coordinate substitution choice is $ \ y^2 \ = \ 9 - \frac94 · x^2 \ \ ; $ here, we must be sure to use both square-roots, since we will need to study the two semi-ellipses "above" and "below" the $ x-$axis. So we need to extremize $ \ f_1(x) \ = \ x^2 \ + \ 3·\sqrt{9 - \frac94 · x^2} \ $ and $ \ f_2(x) \ = \ x^2 \ - \ 3·\sqrt{9 - \frac94 · x^2} \ \ . $ These individually do have a maximal value of $ \ 9 \ $ and a minimal value of $ \ -9 \ \ , $ respectively, at $ \ x = 0 \ . $
So the issue with the "replacement" of $ \ x^2 \ $ in the function is that it is transformed into $$ -\frac49 · \left(y - \frac{27}{8} \right)^2 \ + \ \frac{145}{16} \ \ , $$ which is related to the $ \ \lambda = 4 \ $ case for the Lagrange multipliers. We would interpret this as a "spurious" result not connected with the original problem.
[Below is a graph of the two level-curves $ \ x^2 + 3y \ = \ \pm 9 \ $ and the constraint ellipse.]
ADDENDUM: If we solve the constraint equation for $ \ x \ $ by inserting $ \ y \ = \ \frac{27}{8} \ $ , we obtain $ \ x^2 \ = \ \mathbf{-\frac{17}{16}} \ \ , $ which then gives us the function value $ \ -\frac{17}{16} \ + \ 3 · \frac{27}{8} \ = \ \frac{162 \ - \ 17}{16} \ = \ \frac{145}{16} \ \ . $ So we do have an internally consistent result, but it tells us that the $ \ \lambda = 4 \ $ solution is on the "imaginary" portion of the ellipse.