# Apply the chain rule with a binary variable

What is the correct way to apply the chain rule if the independent variable is binary?

Concretely, say you have the expression

$\frac{\partial y}{\partial x} = \frac{\partial y}{\partial z}\frac{\partial z}{\partial x}$

and you want to write an analogous expression where x is a binary variable (y and z are continuous). Would the following be correct?

$\frac{\Delta y}{\Delta x} = \left(\lim_{\Delta z \rightarrow 0}\frac{\Delta y}{\Delta z} \right) \frac{\Delta z}{\Delta x}$

Thanks!

• If you prefix the 'lim' with a backslash, it will become a symbol rather than a product 'l times i times m'. Also it will be rendered with an upright font: \lim → $\lim$. Jan 20, 2016 at 6:25
• @CiaPan Corrected. Thanks for spotting. Jan 21, 2016 at 8:36

I understand $x$ can take only two values and you are interested in $\frac{y(z(x_1))-y(z(x_0))}{x_1-x_0}$. Multiply by $1=\frac{z_1-z_0}{z_1-z_0}$ where we define $z_i=z(x_i)$. Rearrange the terms and you get what you wrote but without the limit to zero operation.