A lot of results are available for the following chain-rule problem: 


(**CRP1**) Let $f\colon \mathbb R \to \mathbb R$ be a $C^1$/Lipschitz function and let $g \colon \mathbb R^d \to \mathbb R$ be a weakly differentiable function (e.g. $W\_{\rm loc}^{1,p}$ or $BV\_{\rm loc}$). Then the function $f \circ g$ is weakly differentiable as well and explicit chain rule formulas hold, like for instance in the Sobolev setting 
$$
(f \circ g)'(x) = f'(g(x)) g'(x)
$$
a.e. with respect to Lebesgue measure (with some standards caveat when $f$ is Lipschitz). 


I am wondering for the other way round, i.e. 


(**CRP2**) Let $f\colon \mathbb R \to \mathbb R^d$ be a $C^1$/Lipschitz function and let $g \colon \mathbb R^d \to \mathbb R$ be a weakly differentiable function (e.g. $W\_{\rm loc}^{1,p}$ or $BV\_{\rm loc}$). What can we say about the function $g \circ f \colon \mathbb R \to \mathbb R$? For instance in the Sobolev setting it seems to me that the formula 
$$
(g \circ f)'(x) = \nabla g(f(x)) \cdot f'(x)
$$
(a.e. with respect to Lebesgue measure) makes sense, doesn't it? Are there any references about this topic? 


Thanks. 



Chain-rule and change of variables in BV/Sobolev
Your formula can be wrong even if $f$ and $g$ are both Lipschitz. For criteria when such a result holds (and related results) see e.g. Leoni, Giovanni, Morini, Massimiliano: Necessary and sufficient conditions for the chain rule in $W^{1,1}\_{loc}(ℝ^N;ℝ^d)$ and $BV\_{loc}(ℝ^N;ℝ^d)$. J. Eur. Math. Soc. (JEMS) 9 (2007). <https://mathscinet.ams.org/mathscinet-getitem?mr=2293955>


They give the counterexample $g(y\_1,y\_2)=\max(y\_1,y\_2)$, $f(x)=(x,x)$, where the right hand side is nowhere defined as $f'(x)=(1,1)$ everywhere but $g$ is not differentiable at $y\_1=y\_2$. 


