Math 257/316 Section 201 Midterm 2 Solutions

Math 257/316 Section 201
Midterm 2
Solutions
Problem 1.
a) [10 points] For the function f (x) = x2 on [0, 1], sketch (roughly) its odd, and even
2-periodic extensions, and find its Fourier sine series, and its Fourier cosine series,
using (if you need it) for k = 1, 2, 3, . . .,
Z
0
1
2(−1)k
x cos(kπx)dx = 2 2 ,
k π
2
1
Z
x2 sin(kπx)dx =
0
2((−1)k − 1) (−1)k
−
.
k3 π3
kπ
Using the hints, for k = 1, 2, 3, . . . , the F.S.S. and F.C.S. coefficients are (respectively)
Z
2 1 2
2((−1)k − 1) (−1)k
bk =
x sin(kπx)dx = 2
−
,
1 0
k3 π3
kπ
Z
2 1 2
4(−1)k
ak =
x cos(kπx)dx = 2 2 ,
1 0
k π
while
2
a0 =
1
so
F.S.S. of f = 2
1
Z
0
2
x2 dx = ,
3
∞ X
2((−1)k − 1)
k3 π3
k=1
F.C.S. of f =
(−1)k
−
sin(kπx),
kπ
∞
1
4 X (−1)k
+ 2
cos(kπx).
3 π
k2
k=1
b) [15 points] Solve the following problem for the heat equation with non-zero derivative
(flux) BCs:

ut = uxx
0 < x < 1, t > 0

ux (0, t) = 0, ux (1, t) = 2
t>0

u(x, 0) = 0
0≤x≤1
1
There is no steady-state, so we first seek a particular solution of the form v(x, t) =
Ax2 + Bx + Ct. To satisfy the heat equation we require
0 = vt − vxx = C − 2A
=⇒ C = 2A,
and to satisfy the BCs we require
0 = vx (0, t) = (2Ax + B)|x=0 = B,
2 = vx (1, t) = (2Ax)|x=1 = 2A,
so A = 1, B = 0, C = 2, and v(x, t) = x2 + 2t. Then we write
u(x, t) = v(x, t) + w(x, t) = x2 + 2t + w(x, t)
and notice that
wt − wxx = ut − vt − (uxx − vxx ) = ut − uxx − 2 + 2 = 0
wx (0, t) = ux (0, t) − vx (0, t) = 0 − 0 = 0,
wx (1, t) = ux (1, t) − vx (1, t) = 2 − 2 = 0
2
w(x, 0) = u(x, 0) − v(x, 0) = 0 − x ,
and we know the solution to this problem is
∞
w(x, t) =
a0 X
2 2
+
ak cos(kπx)e−k π t ,
2
k=1
where the ak are the F.C.S. coefficients of the function −x2 on [0, 1], which we he
have from part (a) (up to a minus sign). So:
u(x, t) = x2 + 2t −
∞
1
4 X (−1)k
2 2
− 2
cos(kπx)e−k π t .
3 π
k2
k=1
2
Problem 2.
a) [19 points] Solve the following equation describing diffusion with growth, subject to
non-zero BCs:

ut = α2 uxx + u
0 < x < L, t > 0

u(0, t) = 0, u(L, t) = 1
t>0

u(x, 0) = 0
0≤x≤L
but leave any Fourier coefficients in terms of integrals (i.e. do not take time to
evaluate these integrals). Hint: first find the steady-state, then use separation of
variables to find the remainder.
A steady-state v(x) must solve α2 v 00 (x) + v(x) = 0, i.e. v 00 = − α12 v, whose general
solution is v(x) = A sin(x/α) + B cos(x/α). The BCs require
0 = v(0) = B,
1
,
sin(L/α)
1 = v(L) = A sin(L/α) =⇒ A =
sin(x/α)
(provided sin(L/α) 6= 0 – let’s assume this) so v(x) = sin(L/α)
is the steady-state.
Now writing u(x, t) = v(x) + w(x, t) we find that w solves:
wt = ut = α2 uxx + u = α2 vxx + v + α2 wxx + w = α2 wxx + w
w(0, t) = u(0, t) − v(0) = 0 − 0 = 0,
w(L, t) = u(L, t) − v(L) = 1 − 1 = 0
w(x, 0) = u(x, 0) − v(x) = −v(x).
Doing separation of variables, w(x, t) = X(x)T (t) leads to
T0
1
X 00
−
=
= const. = −λ2 < 0.
α2 T
α2
X
Indeed, we know this X problem well: X 00 (x) = −λ2 X(x), X(0) = 0 = X(L) only
has non-zero solutions for negative separation constant (which is why we wrote it as
−λ2 < 0), and these are
Xk (x) = sin(kπx/L),
λk = kπ/L,
k = 1, 2, 3, . . . .
The the solutions of the corresponding T problem,
T 0 = (1−α2 λ2 )T = (1−α2 k 2 π 2 /L2 )T
are Tk (t) = e(1−α
2 k 2 π 2 /L2 )t
so the general solution is
w(x, t) =
∞
X
bk sin(kπx/L)e(1−k
k=1
3
2 α2 π 2 /L2 )t
,
(or any multiple),
and it remains to satisfy the IC:
−v(x) = w(x, 0) =
∞
X
sin(kπx/L),
k=1
a Fourier sine series. Thus
Z
Z L
2
2 L
v(x) sin(kπx/L)dx = −
sin(x/α) sin(kπx/L)dx,
bk = −
L 0
L sin(L/α) 0
and the full solution is
∞
u(x, t) =
sin(x/α) X
2 2 2
2
+
bk sin(kπx/L)e(1−k α π /L )t
sin(L/α)
k=1
with the above formula for bk .
b) [6 points] Determine the long-time (t → ∞) behaviour of the solution (considering
all possible positive values of the diffusion rate α2 ).
There are two cases:
1. α2 > L2 /π 2 : then all the exponentials are decaying to zero, and so we have
convergence to the steady state
lim u(x, t) = v(x)
t→∞
(diffusion beats growth)
2. α2 < L2 /π 2 : then the first exponential is growing with t, and so u(x, t) becomes
infinite as t → ∞ (growth beats diffusion)
(recall we excluded the possibility α2 = L2 /π 2 when we assumed sin(L/α) 6= 0).
4