Lagrange multipliers: to extremize $f(x,y)$ subject to constraint $g(x,y)=0$, add a variable $\lambda$ and
introduce an auxiliary function $$ {\mathcal {L}}(x,y,\lambda )=f(x,y)-\lambda \cdot g(x,y) $$ and solve [unconstrained!] $$ \nabla _{x,y,\lambda }{\mathcal {L}}(x,y,\lambda )=0. $$ Note that this amounts to solving three equations in three unknowns. This is the method of Lagrange multipliers. Note that $\nabla _{\lambda }{\mathcal {L}}(x,y,\lambda )=0$ implies $g(x, y) = 0$. To summarize $$ {\displaystyle \nabla _{x,y,\lambda }{\mathcal {L}}(x,y,\lambda )=0\iff {\begin{cases}\nabla _{x,y}f(x,y)=\lambda \nabla _{x,y}g(x,y)\\g(x,y)=0.\end{cases}}} $$