# Advanced Mathematics for Engineers and Scientists/Change of Variables
## Change of Variables

As with ODEs (ordinary differential equations), a PDE (partial differential equation, or more accurately, the initial-boundary value problem (IBVP) as a whole) may be made more amenable with the help of some kind of modification of variables. So far, we've dealt only with boundary conditions that specify the value of u, which represented fluid velocity, as zero at the boundaries. Though fluid mechanics can get more complicated than that (understatement of the millennium), let's look at heat transfer now for the sake of variety.
As hinted previously, the one dimensional diffusion equation can also describe heat flow in one dimension. Think of how heat could flow in one dimension: one possibility is a rod that's completely laterally insulated, so that the heat will flow only along the rod and not across it (be aware, though, it is possible to consider heat loss/gain along the rod without going two dimensional).
If this rod has finite length, heat could flow in and out of the uninsulated ends. A 1D rod can have at most two ends (it can also have one or zero: the rod could be modeled as "very long"), and the boundary conditions could specify what happens at these ends. For example, the temperature could be specified at a boundary, or maybe the flow of heat, or maybe some combination of the two.
The equation for heat flow is usually given as:
    ${\frac {\partial u}{\partial t}}=\alpha {\frac {\partial ^{2}u}{\partial x^{2}}}\,$
Which is the same as the equation for parallel plate flow, only with ν replaced with α and y replaced with x.

### Fixed Temperatures at Boundaries

Let's consider a rod of length 1, with temperatures specified (fixed) at the boundaries. The IBVP is:
    ${\frac {\partial u}{\partial t}}=\alpha {\frac {\partial ^{2}u}{\partial x^{2}}}\,$
    $u(x,0)=\varphi (x)\,$
    $u(0,t)=u_{0}\,$
    $u(1,t)=u_{1}\,$
φ(x) is the temperature at t = 0. Look at what the BCs say: For all time, the temperature at x = 0 is u$_0$ and at x = 1 is u$_1$. Note that this could be just as well a parallel plate problem: u$_0$ and u$_1$ would represent wall velocities.
The PDE is easily separable, in basically the same way as in previous chapters:
    ${\frac {\partial }{\partial t}}(u(x,t))=\alpha {\frac {\partial ^{2}}{\partial x^{2}}}(u(x,t))\,$
    ${\frac {\partial }{\partial t}}(X(x)T(t))=\alpha {\frac {\partial ^{2}}{\partial x^{2}}}(X(x)T(t))\,$
    $X(x){\frac {\partial }{\partial t}}(T(t))=\alpha T(t){\frac {\partial ^{2}}{\partial x^{2}}}(X(x))\,$
    $X(x)T'(t)=\alpha T(t)X''(x)\,$
    ${\frac {T'(t)}{\alpha T(t)}}={\frac {X''(x)}{X(x)}}\,$
       ${\Big \Downarrow }$
    ${\frac {T'(t)}{\alpha T(t)}}={\frac {X''(x)}{X(x)}}=-k^{2}\,$
       ${\Big \Downarrow }$
    ${\frac {T'(t)}{\alpha T(t)}}=-k^{2}\Rightarrow T'(t)=-k^{2}\alpha T(t)\Rightarrow T(t)=C_{1}e^{-k^{2}\alpha t}\,$
    ${\frac {X''(x)}{X(x)}}=-k^{2}\Rightarrow X''(x)=-k^{2}X(x)\Rightarrow X(x)=C_{2}\cos(kx)+C_{3}\sin(kx)\,$
       ${\Big \Downarrow }$
    $u(x,t)=X(x)T(t)=C_{1}e^{-k^{2}\alpha t}(C_{2}\cos(kx)+C_{3}\sin(kx))$
    $u(x,t)=e^{-k^{2}\alpha t}(A\cos(kx)+B\sin(kx))$
Now, substitute the BCs:
    $u_{0}=u(0,t)\,$
    $u_{0}=e^{-k^{2}\alpha t}(A\cos(k\cdot 0)+B\sin(k\cdot 0))\,$
    $u_{0}=Ae^{-k^{2}\alpha t}\,$
    $u_{1}=u(1,t)\,$
    $u_{1}=e^{-k^{2}\alpha t}(A\cos(k\cdot 1)+B\sin(k\cdot 1))\,$
    $u_{1}=e^{-k^{2}\alpha t}(A\cos(k)+B\sin(k))\,$
We can't proceed. Among other things, the presence of t in the exponential factor (previously divided out) prevents anything from coming out of this.
This is another example of the fact that the assumption that u(x, t) = X(x)T(t) was wrong. The only thing that prevents us from getting a solution would be the non-zero BCs. This is where changing variables will help: a new variable v(x, t) will be defined in terms of u which will be separable.
Think of how v(x, t) could be defined to make its BCs zero ("homogeneous"). One way would be:
    $u(x,t)=v(x,t)+h(x)\,$
This form is inspired from the appearance of the BCs, and it can be readily seen:
    $u(0,t)=u_{0}\,$
    $u(1,t)=u_{1}\,$
       ${\Big \Downarrow }$
    $v(0,t)+h(0)=u_{0}\,$
    $v(1,t)+h(1)=u_{1}\,$
If h(0) = u$_0$ and h(1) = u$_1$, v(x, t) would indeed have zero BCs. Pretty much any choice of h(x) satisfying these conditions would do it, but only one is the best choice. Making the substitution into the PDE:
    ${\frac {\partial }{\partial t}}(u(x,t))=\alpha {\frac {\partial ^{2}}{\partial x^{2}}}(u(x,t))\,$
    ${\frac {\partial }{\partial t}}(v(x,t)+h(x))=\alpha {\frac {\partial ^{2}}{\partial x^{2}}}(v(x,t)+h(x))\,$
    ${\frac {\partial v}{\partial t}}=\alpha {\frac {\partial ^{2}v}{\partial x^{2}}}+\alpha {\frac {\partial ^{2}h}{\partial x^{2}}}\,$
So now the PDE has been messed up by the new term involving h. This will thwart separation...
...unless that last term happens to be zero. Rather then hoping it's zero, we can demand it (the best choice hinted above), and put the other requirements on h(x) next to that:
    ${\frac {d^{2}h}{dx^{2}}}=0\,$
    $h(0)=u_{0}\,$
    $h(1)=u_{1}\,$
Note that the partial derivative became an ordinary derivative since h is a function of x only. The above constitutes a pretty simple boundary value problem, with unique solution:
    $h(x)=(u_{1}-u_{0})x+u_{0}\,$
It's just a straight line. Note that this is what would arise if the steady state (time independent) problem were solved for u(x). In other words, h could've been pulled out of one's ass readily just looking at the physics of the situation.
The problem now reduces to finding v(x, t). The IBVP for this would be:
    ${\frac {\partial v}{\partial t}}=\alpha {\frac {\partial ^{2}v}{\partial x^{2}}}\,$
    $v(x,0)=\varphi (x)-h(x)=\varphi (x)-((u_{1}-u_{0})x+u_{0})\,$
    $v(0,t)=0\,$
    $v(1,t)=0\,$
Note that the IC changed under the transformation. The solution to this IBVP was found in a past chapter through separation of variables and superposition to be:
    $v(x,t)=\sum _{n=1}^{\infty }e^{-(n\pi )^{2}\alpha t}\int _{0}^{1}2\sin(n\pi x)(\varphi (x)-((u_{1}-u_{0})x+u_{0}))\ dx\cdot \sin(n\pi x)\,$
u(x, t) may now be found simply by adding h(x), according to how the variable change was defined:
    $u(x,t)=v(x,t)+h(x)\,$
    $u(x,t)=\sum _{n=1}^{\infty }e^{-(n\pi )^{2}\alpha t}\int _{0}^{1}2\sin(n\pi x)(\varphi (x)-h(x))\ dx\cdot \sin(n\pi x)+(u_{1}-u_{0})x+u_{0}\,$
This solution looks like the sum of a steady state portion (that's h(x)) and a transient portion (that's v(x)):

### Time Varying Temperatures at Boundaries

Note that this wouldn't work so nicely with non-constant BCs. For example, if the IBVP were:
    ${\frac {\partial u}{\partial t}}=\alpha {\frac {\partial ^{2}u}{\partial x^{2}}}\,$
    $u(x,0)=\varphi (x)\,$
    $u(0,t)=u_{0}(t)\,$
    $u(1,t)=u_{1}(t)\,$
Then, transforming it would require h = h(x, t). Reusing u(x, t) = v(x, t) + h(x, t) introduced previously would eventually lead to:
    ${\frac {\partial v}{\partial t}}+{\frac {\partial h}{\partial t}}=\alpha {\frac {\partial ^{2}v}{\partial x^{2}}}+\alpha {\frac {\partial ^{2}h}{\partial x^{2}}}\,$
    $v(x,0)=\varphi (x)-h(x,0)\,$
    $v(0,t)=0\,$
    $v(1,t)=0\,$
Where, to simplify the PDE above:
    ${\frac {\partial h}{\partial t}}=\alpha {\frac {\partial ^{2}h}{\partial x^{2}}}\,$
    $h(x,0)={\mbox{anything}}\,$
    $h(0,t)=u_{0}(t)\,$
    $h(1,t)=u_{1}(t)\,$
Which doesn't really make anything simpler, despite freedom in the choice of IC.
But this isn't completely useless. Note that the PDE for h was chosen to simplify the PDE for v(x, t) (would lead to the terms involving h to cancel out), which may lead to the question: Was this necessary?
The answer is no. If that were the case, the PDE we picked for h would not be satisfied, and that would result in extra terms in the PDE for v(x, t). The no-longer-separable IBVP for v(x, t) could, however, be solved via an eigenfunction expansion, whose full story will be told later. It's worth noting though, that an eigenfunction expansion would require homogenous BCs, so the transformation was necessary.
So this problem has to be put aside without any conclusion for now. I told you that BCs can mess everything up.

### Pressure Driven Transient Parallel Plate Flow

Now back to fluid mechanics. Previously, we dealt with flow that was initially moving but slowing down because of resistance and the absence of a driving force. Maybe, it'd be more interesting if we had a fluid initially at rest (ie, zero IC) but set into motion by some constant pressure difference. The IBVP for such a case would be:
    ${\frac {\partial u}{\partial t}}=\nu {\frac {\partial ^{2}u}{\partial y^{2}}}-{\frac {P_{x}}{\rho }}\,$
    $u(y,0)=0\,$
    $u(0,t)=0\,$
    $u(1,t)=0\,$
This PDE with the pressure term was described previously. That pressure term is what drives the flow; it is assumed constant.
The intent of the change of variables would be to remove the pressure term from the PDE (which prevents separation) while keeping the BCs homogeneous.
One path to take would be to add something to u(x, t), either a function of t or a function of y, so that differentiation would leave behind a constant that could cancel the pressure term out. Adding a function of t would be very unfavorable since it'd result in time dependent BCs, so let's try a function of y:
    $u(y,t)=v(y,t)+f(y)\,$
Substituting this into the PDE:
    ${\frac {\partial }{\partial t}}(v(y,t)+f(y))=\nu {\frac {\partial ^{2}}{\partial y^{2}}}(v(y,t)+f(y))-{\frac {P_{x}}{\rho }}\,$
    ${\frac {\partial v}{\partial t}}=\nu {\frac {\partial ^{2}v}{\partial y^{2}}}+\nu {\frac {\partial ^{2}f}{\partial y^{2}}}-{\frac {P_{x}}{\rho }}\,$
This procedure will simplify the PDE and preserve the BCs only if the following conditions hold:
    $0=\nu {\frac {d^{2}f}{dy^{2}}}-{\frac {P_{x}}{\rho }}\,$
    $f(0)=0\,$
    $f(1)=0\,$
The first condition, an ODE, is required to simplify the PDE for v(y, t), it will result in cancellation of the last two terms. The other two conditions are chosen to preserve the homogeneous BCs of the problem (note that if the BCs of u(y, t) weren't homogeneous, the BCs on f(y) would need to be picked to amend that).
The solution to the BVP above is simply:
    $f(y)={\frac {P_{x}}{2\rho \nu }}(y^{2}-y)\,$
So f(y) was successfully determined. Note that this function is symmetric about y = 1/2. The IBVP for v(y, t) becomes:
    ${\frac {\partial v}{\partial t}}=\nu {\frac {\partial ^{2}v}{\partial y^{2}}}\,$
    $v(y,0)=-f(y)={\frac {P_{x}}{2\rho \nu }}(y-y^{2})\,$
    $v(0,t)=0\,$
    $v(1,t)=0\,$
This is the same IBVP we've been beating to death for some time now. The solution for v(y, t) is:
    $v(y,t)=\sum _{n=1}^{\infty }e^{-(n\pi )^{2}\alpha t}\int _{0}^{1}2\sin(n\pi y)\left({\frac {P_{x}}{2\rho \nu }}(y-y^{2})\right)\ dy\cdot \sin(n\pi y)\,$
And the solution for u(y, t) follows from how the variable change was defined:
    $u(y,t)=v(y,t)+f(y)\,$
    $u(y,t)=\sum _{n=1}^{\infty }e^{-(n\pi )^{2}\nu t}\int _{0}^{1}2\sin(n\pi y)\left({\frac {P_{x}}{2\rho \nu }}(y-y^{2})\right)\ dy\cdot \sin(n\pi y)+{\frac {P_{x}}{2\rho \nu }}(y^{2}-y)\,$
    $u(y,t)={\frac {P_{x}}{2\rho \nu }}(y^{2}-y)-{\frac {P_{x}}{2\rho \nu }}\sum _{n=1}^{\infty }e^{-(n\pi )^{2}\nu t}\cdot {\frac {4(-1)^{n}-4}{n^{3}\pi ^{3}}}\sin(n\pi y)\,$
This solution fits what we expect: it starts flat and approaches the parabolic profile quickly. This is the same parabola derived as the steady state flow in the realistic IC chapter; the integral was evaluated for integer n, simplifying it.
A careful look at the solution reveals something interesting: this is just decaying parallel plate flow "in reverse". Instead of the flow starting parabolic and gradually approaching u = 0, it starts with u = 0 and gradually approaches a parabola.

### Time Dependent Diffusivity

In this example we'll change time, an independent variable, instead of changing the dependent variable. Consider the following IBVP:
    ${\frac {\partial u}{\partial t}}={\frac {1}{1+t^{2}}}{\frac {\partial ^{2}u}{\partial x^{2}}}\,$
    $u(x,0)=\varphi (x)\,$
    $u(0,t)=0\,$
    $u(1,t)=0\,$
Note that this is a separable; a transformation isn't really necessary, however it'll be easier since we can reuse past solutions if it can be transformed into something familiar.
Let's not get involved with the physics of this and just call it a diffusion problem. It could be diffusion of momentum (as in fluid mechanics), diffusion of heat (heat transfer), diffusion of a chemical (chemistry), or simply a mathematician's toy. In other words, a confession: it was purposely made up to serve as an example.
The (time dependent) factor in front of the second derivative is called the diffusivity. Previously, it was a constant α (called "thermal diffusivity") or constant ν ("kinematic viscosity"). Now, it decays with time.
To simplify the PDE via a transformation, we look for ways in which the factor could cancel out. One way would be to define a new time variable, call it τ and leave it's relation to t arbitrary. The chain rule yields:
    ${\frac {\partial u}{\partial t}}={\frac {\partial u}{\partial \tau }}\cdot {\frac {d\tau }{dt}}\,$
Substituting this into the PDE:
    ${\frac {\partial u}{\partial \tau }}\cdot {\frac {d\tau }{dt}}={\frac {1}{1+t^{2}}}{\frac {\partial ^{2}u}{\partial x^{2}}}\,$
Note now that the variable t will completely disappear (divide out in this case) from the equation if:
    ${\frac {d\tau }{dt}}={\frac {1}{1+t^{2}}}\Rightarrow \tau =\arctan(t)+C\,$
C is completely arbitrary. However, the best choice of C is the one that makes τ = 0 when t = 0, since this wouldn't change the IC which is defined at t = 0; so, take C = 0. Note that the BCs wouldn't change either way, unless they were time dependent, in which they would change no matter what C is chosen. The IBVP is turned into:
    ${\frac {\partial u}{\partial \tau }}={\frac {\partial ^{2}u}{\partial x^{2}}}\,$
    $u(x,0)=\varphi (x)\,$
    $u(0,\tau )=0\,$
    $u(1,\tau )=0\,$
Digging up the solution and restoring the original variable:
    $u(x,\tau )=\sum _{n=1}^{\infty }e^{-(n\pi )^{2}\tau }\int _{0}^{1}2\sin(n\pi x)\varphi (x)\ dx\cdot \sin(n\pi x)\,$
       ${\Big \Downarrow }$
    $u(x,t)=\sum _{n=1}^{\infty }e^{-(n\pi )^{2}\arctan(t)}\int _{0}^{1}2\sin(n\pi x)\varphi (x)\ dx\cdot \sin(n\pi x)\,$
Note that, unlike any of the previous examples, the physics of the problem (if there were any) couldn't have helped us. It's also worth mentioning that the solution doesn't limit to u = 0 for long time.

### Concluding Remarks

Changing variables works a little differently for PDEs in the sense that you have a lot of freedom thanks to partial differentiation. In this chapter, we picked what seemed to be a good general form for the transformation (inspired by whatever prevented easy solution), wrote down a bunch of requirements, and defined the transformation to uniquely satisfy the requirements. Doing the same for ODEs can often degrade to a monkey with typewriter situation.
Many simple little changes go without saying. For example, we've so far worked with rods of length "1" or plates separated by a distance of "1". What if the rod was 5 m long? Then space would have to be nondimensionalized using the following transformation:
    $x=5\ {\mbox{m}}\cdot {\hat {x}}\,$
Simple nondimensionalization is, well, simple; however for PDEs with more terms it can lead to scale analysis which can lead to perturbation theory which will all have to be explained in a later chapter.
It's worth noting that the physics of the IBVP very often suggest what kind of transformation needs to be done. Even some nonlinear problems can be solved this way.
This topic isn't nearly over, changes of variables will be dealt with again in future chapters.