# PDE - Change of variable

1. Jan 4, 2009

### bsdz

Hi

I have a question regarding a PDE and change of variable. I can follow through the algebra but I have a problem deciding what route to take after I use the chain rule at a later point.

I have an expression: -

$$\frac{\partial^2 f}{\partial y^2}$$

and would like to make the variable substitution: -

$$y = k e^x$$

I first note that ,

$$\frac{dy}{dx} = k e^{x}$$

and

$$\frac{d^n y}{dx^n} = k e^{x} \; \forall n \ge 0$$

This is my initial calculation: -

$$\frac{\partial^2 f}{\partial y^2} = \frac{\partial}{\partial y} \frac{\partial f}{\partial y} = \frac{\partial}{\partial y}( \frac{\partial f}{\partial x} \frac{\partial x}{\partial y})$$

$$= \frac{d x}{d y} \frac{d^2 f}{dy d x} + \frac{d f}{d x} \frac{d^2 x}{d y^2}$$

$$= \frac{d x}{d y} \frac{d}{dx}(\frac{df}{dy}) + \frac{d f}{d x} \frac{d^2 x}{d y^2}$$

$$= \frac{d x}{d y} \frac{d}{dx}(\frac{df}{dx} \frac{dx}{dy}) + \frac{d f}{d x} \frac{d^2 x}{d y^2}$$

$$= \frac{d x}{d y} (\frac{d^2f}{dx^2} \frac{dx}{dy} + \frac{df}{dx} \frac{d}{dx} (\frac{dx}{dy}) ) + \frac{d f}{d x} \frac{d^2 x}{d y^2}$$

However at this point I have two options on how I deal with the expression: -

$$\frac{d}{dx} (\frac{dx}{dy})$$

Option 1 is to substitute and deal with it in-line: -

$$= \frac{1}{ke^x} (\frac{d^2f}{dx^2} \frac{1}{ke^x} + \frac{df}{dx} \frac{d}{dx} (\frac{1}{ke^x}) ) + \frac{d f}{d x} \frac{d^2 x}{d y^2}$$

and note that,

$$\frac{dx}{dy} = \frac{1}{y} \Rightarrow \frac{d^2 x}{dy^2} = \frac{-1}{y^2} = \frac{-1}{(k e^x)^2}$$

$$= \frac{1}{ke^x} (\frac{d^2f}{dx^2} \frac{1}{ke^x} + \frac{df}{dx} \frac{d}{dx} (\frac{1}{ke^x}) ) + \frac{d f}{d x} \frac{-1}{(k e^x)^2}$$

$$= \frac{1}{ke^x} (\frac{d^2f}{dx^2} \frac{1}{ke^x} + \frac{df}{dx} (\frac{-1}{ke^x}) ) + \frac{d f}{d x} \frac{-1}{(k e^x)^2}$$

$$= \frac{1}{(ke^x)^2} (\frac{d^2f}{dx^2} - 2 \frac{df}{dx})$$

or Option 2 is to evaluate it to zero: -

$$= \frac{1}{ke^x} (\frac{d^2f}{dx^2} \frac{1}{ke^x} + \frac{df}{dx} \frac{d}{dy} (\frac{dx}{dx}) ) + \frac{d f}{d x} \frac{d^2 x}{d y^2}$$

$$= \frac{1}{ke^x} (\frac{d^2f}{dx^2} \frac{1}{ke^x} + \frac{df}{dx} \frac{d}{dy} (1) ) + \frac{d f}{d x} \frac{d^2 x}{d y^2}$$

$$= \frac{1}{ke^x} (\frac{d^2f}{dx^2} \frac{1}{ke^x} + 0 ) + \frac{d f}{d x} \frac{d^2 x}{d y^2}$$

$$= \frac{1}{(ke^x)^2} (\frac{d^2f}{dx^2} - \frac{df}{dx})$$

How should I consider this? Perhaps I am wrong all the way? Should I take it from first principles and use a limit definition?

Blair

2. Jan 4, 2009

### arildno

Now, quitting the complicating use of partials, let us focus on three functions, f(y), F(x), X(y), so that we have the identity:
$$f(y)=F(x=X(y))$$
Now, we have:
$$\frac{df}{dy}=\frac{dF}{dx}\frac{dX}{dy}$$
We then have:
$$\frac{d^{2}f}{dy^{2}}=\frac{d^{2}F}{dx^{2}}(\frac{dX}{dy})^{2}+\frac{dF}{dx}\frac{d^{2}X}{dy^{2}}$$
Now, from what you wrote, we have:
$$X(y)=\ln(y)-\ln(k)$$
Thus, we have:
$$\frac{dX}{dy}=\frac{1}{y}=\frac{1}{k}e^{-x},\frac{d^{2}X}{dy^{2}}=-\frac{1}{y^{2}}=-\frac{1}{k^{2}}e^{-2x}$$
Thus, having eliminated the y's, and re-defining F(x) as f(x) (a notational abuse, but very convenient!), we get:
$$\frac{d^{2}f}{dy^{2}}=\frac{1}{k^{2}}e^{-2x}(\frac{d^{2}f}{dx^{2}}-\frac{df}{dx})$$ whenever x and y are related through the equation x=X(y)

3. Jan 4, 2009

### bsdz

Thanks. That confirms option 2. I am developing a software library that automates changing of variables so sadly I can't easily quit using partials. However, I would be interested in any other algorithmic way of doing this that will work with most/all PDE/ODEs.

4. Jan 4, 2009

### arildno

Well, it isn't at all difficult to tweak this into partials notation.

5. Jan 4, 2009

### bsdz

In that case, it would look near identical to my original calculation and option 2.

Thanks.