# How to use the chain rule for change of variable

I have asked this questions: Change of variables in differential equation?

...but after thinking about it, I am still a little confused of how to rigorously use the chain rule to calculate the derivative(s) of a function for a change of variable.

I have the following derivative:

$$f(x) = \frac{dw(x)}{dx}$$

Now I introduce the change of variable: $$\hat{x}=\frac{x}{L}$$ and I apply the chain rule:

1. I write: $$g(\hat{x}) = L \hat{x} = x$$
2. I substitute: $$f(g(\hat{x})) = \frac{dw(g(\hat{x}))}{d(g(\hat{x}))}$$

...but this does not help me... I am confusing something.

I would be glad, if someone could show me in detail and step by step how to do this rigorously.

Thanks a lot.

Let's say you want to change $$x$$ for $$y$$, where $$y$$ is a function of $$x$$, i.e., $$y=g(x)$$. I will use $$y$$ for the nondimensional variable because it's way easier to type in my phone. The chain rule tells us that if we want to calculate the derivative $$\frac{df}{dx}$$ in terms of $$y$$, we need to use the formula $$\frac{df}{dx}=\frac{dy}{dx}\frac{df}{dy}.$$ The $$dy/dx$$ part is equal to $$dg(x)/dx$$, therefore, $$\frac{df}{dx}=\frac{dg(x)}{dx}\frac{df}{dy}.$$ See that it works for any possible change of variables. In your particular case, $$g(x)=x/L$$ and $$dg/dx=1/L$$. Therefore, we have $$\frac{df}{dx}=\frac{1}{L}\frac{df}{dy}.$$ It leads to $$\frac{df}{dy}=Lw(g^{-1}(y)),$$ in which $$g^{-1}(y)=Ly$$. Finally: $$\frac{df}{dy}=Lw(Ly).$$ It's up to you to show that this equation is dimensionally consistent. Remember: $$L$$ has the same dimension of $$x$$ and $$y$$ is nondimensional. Let me know if you have any question.
• Many thnaks for your answer. There is one thing that I don't understand, if I take $\frac{df}{dx}=\frac{1}{L}\frac{df}{dy}.$ and I know that $\frac{df}{dy} = Lw(Ly)$, then the final result is: $\frac{df}{dx} = w(Ly)$... ? Dec 15, 2018 at 21:03
• @james You are right, but I can't see how this is useful. In general, one has the dimensional form of an equation and then obtains the nondimensional form of it. It's useful then to have "consistency" the variables, in the sense that you use only $x$ or only $y$; since they mean the same thing (say, the dimensional and nondimensional distance, respectively), you won't want to mix them. Therefore, while $df/dx=w(Ly)$ is true, I think that $df/dy=Lw(Ly)$ is far more useful. Dec 15, 2018 at 23:55
• I see. Okay, so if I apply the change of variable to the following integral $\int _ { - \frac { L } { 2 } } ^ { \frac { L} { 2 } } w ^ { \prime } ( x ) ^ { 2 } d x$, I would get: $\int _ { - \frac { 1 } { 2 } } ^ { \frac { 1} { 2 } } \frac{1}{L^2} w ^ { \prime } ( L\hat{x} ) ^ { 2 } L d \hat{x}$, right ? Dec 16, 2018 at 9:12