I am trying to differentiate a function $f(x,y,\frac{\partial y}{\partial x},\frac{\partial(\frac{\partial y}{\partial x})}{\partial x})$ w.r.t $g(x,y)$ but I am not quite sure how to proceed. I tried following the explanation here- Derivative of $f(x,y)$ with respect to another function of two variables $k(x,y)$ but I am having a difficulty expanding the idea to my case. In the above case, consider $x$ to be the independent variable.
It would be great if you could also suggest a reference book I can follow.
EDIT to show specific problem:
I have a function - F In this n is defined as n = ($cos\theta$$cos\phi$,$cos\theta$$sin\phi$,$sin\theta$). Further, $\theta$ = $\theta(x,y,z)$ and $\phi$ = $\phi(x,y,z)$. I want to evaluate Derivative.
I am presently simulating the flow of nematic liquid crystals using Leslie Ericksen theory. I am adding a screenshot of all the equations of the theory. Essentially, n describes the orientation of a liquid crystal. Depending on the external forces ( may be a flow or magnetic field or an electric field) change orientation to obtain a state with the lowest energy (most stable). Summary of all equations.
In my actual problem, $(x,y,z)$ are the cartesian coordinates and the others are functions that dependent on them.