SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons
      1. 6.3.1 What a partial differential equation isConcept · 30 min
      2. 6.3.2 Initial, boundary and terminal conditionsConcept · 30 min
      3. 6.3.3 Practice set: partial differential equationsPractice set · 20 min
      4. 6.3.4 Case study: an option value fixed by its payoffCase study · 35 min

Level 6, Differential equations 6.3 PDE basics Lesson 2 of 4

ConceptLesson 6.3.2 in Level 6, Differential equations. About 30 minutes.

Initial, boundary and terminal conditions

Why a PDE needs extra conditions

Lesson 6.3.1 found many solutions of each equation. The heat equation ut=uxxu_t = u_{xx} is solved by e−tsin⁡xe^{-t}\sin x, by e−4tsin⁡2xe^{-4t}\sin 2x, by x2+2tx^2 + 2t and by any sum of these. The transport equation ut+2ux=0u_t + 2u_x = 0 is solved by f(x−2t)f(x - 2t) for every function ff.

An ODE has the same problem on a smaller scale. In lesson 6.1.1, dydt=−2y\frac{dy}{dt} = -2y has the solutions Ce−2tCe^{-2t}, and one number, the starting value y(0)y(0), picks out one of them. A second-order ODE needs two numbers (lesson 6.2.2).

A PDE has a whole function's worth of freedom, like the ff in f(x−2t)f(x - 2t). So its extra conditions are functions too, each given along an edge of the region. The region is the set of points (x,t)(x, t) where the equation must hold.

The initial condition

An initial condition gives the whole profile at the start: u(x,0)=f(x)u(x, 0) = f(x) for every xx in the region. It is the PDE version of y(0)y(0).

On the whole line, an initial condition is enough for both of lesson 6.3.1's time-dependent equations. For the transport equation, u(x,0)=f(x)u(x, 0) = f(x) fixes the shape, so the solution is f(x−ct)f(x - ct). For the heat equation it fixes the solution too, among solutions that stay bounded (stated here without proof).

Example. Start the heat equation from u(x,0)=sin⁡2xu(x, 0) = \sin 2x. Lesson 6.3.1 found that e−4tsin⁡2xe^{-4t}\sin 2x is a solution, and at t=0t = 0 it equals sin⁡2x\sin 2x. So it is the solution: at (π4,0.25)(\frac{\pi}{4}, 0.25) it is e−1=0.3679e^{-1} = 0.3679.

Rule: Initial condition

u(x,0)=f(x)u(x, 0) = f(x)

The profile at t=0t = 0, given at every xx of the region. The equation then says how it changes as tt grows.

Try it

The residual of the heat equation, then the candidate at t=0t = 0: it must equal the initial profile. The last line is its value at (π4,0.25)(\frac{\pi}{4}, 0.25).

⌘/Ctrl + Enter runs the cell

Boundary conditions

On a finite stretch 0≤x≤L0 \le x \le L, such as a rod of length LL, heat can flow in or out through the ends. So the problem must also say what happens there, at every time. These are boundary conditions: u(0,t)=a(t)u(0, t) = a(t) and u(L,t)=b(t)u(L, t) = b(t), two given functions of time.

A boundary condition can give a slope instead of a value. An insulated end, through which no heat flows, has ux=0u_x = 0 there.

Example 1. On 0≤x≤π0 \le x \le \pi, start from u(x,0)=sin⁡xu(x, 0) = \sin x and hold both ends at 0. Then u=e−tsin⁡xu = e^{-t}\sin x fits all three conditions: it is 0 at x=0x = 0 and x=πx = \pi for every tt, and sin⁡x\sin x at t=0t = 0.

Each region with its conditions on its edges: a forward problem starts from the bottom edge and moves up. A backward problem starts from the top edge, the final time, and moves down.

Example 2. Now hold the ends of a rod 0≤x≤10 \le x \le 1 at 20 and 80. Start it at u(x,0)=20+60x+10sin⁡πxu(x, 0) = 20 + 60x + 10\sin \pi x: a straight line with a bump. The solution is

u=20+60x+10e−π2tsin⁡πxu = 20 + 60x + 10e^{-\pi^2 t}\sin \pi x

The line solves the heat equation, since its utu_t and uxxu_{xx} are both 0. The bump is a solution of lesson 6.3.1's kind, e−k2tsin⁡kxe^{-k^2t}\sin kx with k=πk = \pi, and it is 0 at both ends. The sum solves the equation (lesson 6.3.1) and fits every condition.

time tt00.10.250.5
uu at the middle, x=0.5x = 0.56053.7350.8550.07

The bump dies away and the rod settles on the straight line from 20 to 80, its steady state. A steady state does not change, so ut=0u_t = 0 and the equation becomes uxx=0u_{xx} = 0. That ODE's solutions are straight lines, fixed by the two end values as in lesson 6.2.2.

Try it

The first line checks Example 1: the residual, the two ends and the profile at t=0t = 0. The second does the same for Example 2.

The loop is the table: the middle of the rod settling on 50.

⌘/Ctrl + Enter runs the cell

Which ends need a condition

The heat equation is second order in xx, like the ODE uxx=0u_{xx} = 0, so it needs a condition at each end. The transport equation is first order in xx, and it needs a condition at one end only: the end where the shape comes in.

Take ut+ux=0u_t + u_x = 0 on x≥0x \ge 0, a shape moving right at speed 1. Start with an empty stream, u(x,0)=0u(x, 0) = 0, and feed in u(0,t)=tu(0, t) = t at the left end. Whatever enters at time ss reaches xx at time s+xs + x, so

u(x,t)={t−xx<t0x≥tu(x, t) = \begin{cases} t - x & x < t \\ 0 & x \ge t \end{cases}

At t=2t = 2: u(0.5,2)=1.5u(0.5, 2) = 1.5, u(1.5,2)=0.5u(1.5, 2) = 0.5 and u(3,2)=0u(3, 2) = 0. Feeding in 1−e−t1 - e^{-t} instead gives 0.7769, 0.3935 and 0: a different solution with the same initial condition. So the condition at the inflow end is needed.

At the far end of a stretch 0≤x≤L0 \le x \le L, the values arriving are already fixed by what came in. A second condition there would usually contradict them, and then there is no solution at all.

Rule: Boundary conditions

u(0,t)=a(t),u(L,t)=b(t)u(0, t) = a(t), \quad u(L, t) = b(t)

Values (or slopes) at the ends of the region, for every time. An equation of second order in xx, such as the heat equation, needs one at each end. The transport equation needs one only where the shape comes in.

Conditions that disagree at a corner

The initial and boundary conditions meet at the corners of the region, such as (0,0)(0, 0). If they disagree there, the solution inherits the clash.

Feed u(0,t)=1u(0, t) = 1 into the empty stream above, where u(x,0)=0u(x, 0) = 0. The transport equation carries a jump from 0 to 1 along the line x=tx = t. The heat equation instead smooths such a clash at once (module 6.4).

Try it

stream is the solution above for any inflow g, at speed 1. Each line prints a point and the solution for the two inflows.

The last line feeds in a constant 1, which clashes with the empty start: at t=2t = 2 the jump sits at x=2x = 2.

⌘/Ctrl + Enter runs the cell

Terminal conditions: solving backwards

Some problems fix the end instead of the start. A terminal condition gives the profile at a final time TT: u(x,T)=g(x)u(x, T) = g(x). The task is then to find uu at earlier times, down to t=0t = 0, by solving backwards.

The natural equation for this is the heat equation with the sign of utu_t flipped: ut+uxx=0u_t + u_{xx} = 0, that is, ut=−uxxu_t = -u_{xx}. Run backwards from TT, it spreads and smooths just as the heat equation does forwards.

Example. On 0≤x≤π0 \le x \le \pi with both ends at 0, take T=1T = 1 and u(x,1)=sin⁡xu(x, 1) = \sin x. The solution is u=e−(1−t)sin⁡xu = e^{-(1 - t)}\sin x: it equals sin⁡x\sin x at t=1t = 1, and ut=e−(1−t)sin⁡x=−uxxu_t = e^{-(1 - t)}\sin x = -u_{xx}.

time tt10.750.50
uu at x=π2x = \frac{\pi}{2}10.77880.60650.3679

Read the table from left to right. The profile shrinks as you go back from the final time, as the heat equation's does going forward.

Time to go

The link is exact. Measure time backwards from the end, with τ=T−t\tau = T - t, the time to go. By the chain rule (lesson 2.3.3), ut=−uτu_t = -u_\tau, since τ\tau falls by 1 when tt rises by 1.

So ut+uxx=0u_t + u_{xx} = 0 becomes uτ=uxxu_\tau = u_{xx}: the heat equation in τ\tau. The terminal condition at t=Tt = T is its initial condition at τ=0\tau = 0. In the example, u=e−τsin⁡xu = e^{-\tau}\sin x, the solution of Example 1 with τ\tau for tt.

Rule: Terminal condition

u(x,T)=g(x)τ=T−t,ut=−uτ\begin{gathered} u(x, T) = g(x) \\[4pt] \tau = T - t, \quad u_t = -u_\tau \end{gathered}

The profile at a final time TT, from which the equation is solved backwards. With the time to go τ\tau, a backward problem becomes a forward one, with gg as its initial condition.

Case study 6.3.4 meets an equation of this kind: an option's value, fixed by its payoff at expiry.

Try it

The residual of ut+uxx=0u_t + u_{xx} = 0 and the profile at t=1t = 1; then the table. The last line writes the same solution in τ\tau and checks the heat equation uτ=uxxu_\tau = u_{xx}.

⌘/Ctrl + Enter runs the cell

Well-posed problems

A problem made of an equation, a region and its conditions is well-posed when three things hold. A solution exists; there is only one; and a small change in the conditions changes the solution only a little. The last matters because real data are measured, and measurements are never exact.

The wrong direction

The heat equation run backwards fails the third test. Suppose ut=uxxu_t = u_{xx} and the profile at t=1t = 1 is sin⁡x\sin x, or sin⁡x+0.001sin⁡10x\sin x + 0.001\sin 10x: two profiles that differ by at most 0.001.

Going back, the sin⁡x\sin x part grows by e1−te^{1 - t}, only 1.1052 by t=0.9t = 0.9. But the ripple 0.001sin⁡10x0.001\sin 10x came from 0.001e100(1−t)sin⁡10x0.001e^{100(1 - t)}\sin 10x, since sharp wiggles die fast going forward. So going back, it explodes:

how far back, 1−t1 - t0.010.10.5
ripple size, heat equation backwards0.002722.035.2×10185.2 \times 10^{18}
ripple size, ut+uxx=0u_t + u_{xx} = 0 backwards0.000374.5×10−84.5 \times 10^{-8}1.9×10−251.9 \times 10^{-25}

An invisible change in the data changes the answer by 22 a tenth of a unit earlier. The same ripple in a terminal condition for ut+uxx=0u_t + u_{xx} = 0 shrinks instead: that problem is well-posed.

Rule: Which way an equation runs

ut=k uxxinitial condition, forwardsut=−k uxxterminal condition, backwards\begin{gathered} u_t = k\,u_{xx} \\ \text{initial condition, forwards} \\[8pt] u_t = -k\,u_{xx} \\ \text{terminal condition, backwards} \end{gathered}

For k>0k > 0. Give each equation the condition at the end it runs from. The other way round, tiny errors in the data grow without limit.

Try it

The loop prints the ripple's size going back by 0.01, 0.1 and 0.5 under each equation. The last line is the growth of the sin⁡x\sin x part over 0.1.

⌘/Ctrl + Enter runs the cell

Common mistakes

  1. The equation alone does not fix the solution. Without conditions, the heat equation has e−k2tsin⁡kxe^{-k^2t}\sin kx for every kk, and more.
  2. Give the condition at the end the equation runs from. Initial for ut=uxxu_t = u_{xx}, terminal for ut=−uxxu_t = -u_{xx}. The wrong way round is not well-posed.
  3. Count the ends. The heat equation needs a condition at both ends, the transport equation only at the inflow end. A condition at the outflow end too usually leaves no solution.
  4. Keep the sign in ut=−uτu_t = -u_\tau. Time to go falls as time rises.
  5. A condition holds along a whole edge. u(0,t)=0u(0, t) = 0 means for every tt, not only at t=0t = 0.
  6. Check the corners. If the initial and boundary values disagree there, the solution has a jump or a corner.

Initial, boundary and terminal conditions

0 of 11 correct

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 7.
  8. 8.
  9. 9.
  10. 10.
  11. 11.
How to type answers
  • Powers with ^: x^7, 2^(1/3), a^-2.
  • Multiply with * or by writing side by side: 3x^2, 2(x+1).
  • ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
  • Your first answer to each question is saved: it counts towards your score and brings the question back for review.
  • Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.

Summary card

  • A PDE alone has far too many solutions. Conditions along the edges of its region, the set of (x,t)(x, t) where it holds, pick out one.
  • Initial condition: the profile u(x,0)=f(x)u(x, 0) = f(x). On the whole line it fixes the solution of the heat and transport equations.
  • Boundary conditions: values (or slopes) at the ends, for every time. The heat equation needs one at each end; the transport equation only at the inflow end.
  • With fixed end values the heat equation settles on a steady state, where uxx=0u_{xx} = 0: a straight line between the end values.
  • Terminal condition: the profile u(x,T)=g(x)u(x, T) = g(x) at a final time, solved backwards. With τ=T−t\tau = T - t, ut=−uτu_t = -u_\tau, and ut+uxx=0u_t + u_{xx} = 0 becomes the heat equation in τ\tau.
  • Well-posed: a solution exists, is unique, and moves only a little when the data do. The heat equation run backwards is not.

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.

  • The Heat Equation

    Paul's Online Notes. Notes.

    Where the heat equation comes from, with initial conditions and fixed-value and insulated boundary conditions.

  • Notes on Diffy Qs (Lebl), 4.6

    Jiří Lebl. Free book.

    A free differential equations textbook, including PDEs and the heat equation.