Implicit differentiation help

Hi,

I need some help with some implicit differentiation.

I have a system where in a choice variable that someone gets to pick. For each choice of the following non-linear system of equations gets solved for and .

and spits out a unique . This is then used to evaluate the expression . Now I am writing and but and cannot be expressed in terms of elementary functions of since the above system of equations cannot be solved analytically.

The idea is to find an where . I don't actually want to solve this problem right away in the sense that I don't need the that solves the first order condition, rather I need the expression of the first order condition itself which I need to plug in somewhere else. That's why I am not using Lagrange multipliers here.

Any help understanding the math here at a conceptual level and making progress on this problem will be greatly appreciated.

Thanks

Anshu