Find the extremas of $f(x,y)=\frac{x}{a}+\frac{y}{b}$ subject to constraint $x^2 + y^2 = r^2$ using Lagrangian multipliers.
My attempt: We introduce the following function, then use Lagrangian multipliers $$L(x,y,\lambda)=\frac{x}{a}+\frac{y}{b}+\lambda(x^2+y^2-r^2)$$ Computing partial derivatives, $$L_{1}(x,y,\lambda)=\frac{1}{a}+2x\lambda=0$$ $$L_{2}(x,y,\lambda)=\frac{1}{b}+2y\lambda=0$$ $$L_{3}=0 \iff x^2+y^2=r^2$$ We have $$x=\frac{1}{-2a\lambda}, \hspace{2mm} y=\frac{1}{-2b\lambda}$$ Using $x^2+y^2=r^2$, $$\frac{1}{4a^2 \lambda ^2}+\frac{1}{4b^2 \lambda ^2}=r^2 \iff \lambda= \pm \frac{\sqrt{a^2 + b^2}}{2abr}$$ Hence, we have that the values $(x,y)$ which maximizes the function is $$x= \mp \frac{br}{\sqrt{a^2+b^2}}, \hspace{2mm} y= \mp \frac{ar}{\sqrt{a^2+b^2}}$$ Inserting the values into the function, we have that $$f(x,y)_{max}=\frac{2abr}{\sqrt{a^2+b^2}}, \hspace{3mm}f(x,y)_{min}=\frac{-2abr}{\sqrt{a^2+b^2}} $$ However, the answer states that $$f_{max}=\frac{\sqrt{a^2+b^2}}{ab}, \hspace{3mm} f_{min}=-\frac{\sqrt{a^2+b^2}}{ab}$$ Where did I go wrong/ how can I simplify further
As pointed out by @jjagmath, the mistake occurs when entering the obtained values for $x_0$ and $y_0$ which optimizes the function. We have that $$x_0= \mp \frac{br}{\sqrt{a^2+b^2}} \hspace{3mm} y_0=\mp\frac{ar}{\sqrt{a^2+b^2}}$$ Taking the positive values for the maximum, $$f(x_0,y_0)=\frac{1}{a} \left( \frac{br}{\sqrt{a^2+b^2}}\right) + \frac{1}{b}\left(\frac{ar}{\sqrt{a^2+b^2}}\right)=\frac{r(a^2 + b^2)}{(ab)\sqrt{a^2+b^2}}=\frac{r\sqrt{a^2+b^2}}{ab}$$ As pointed out by @J.G. , the suggested answer misses a factor of $r$ and we are done