# Computing a Green's function - where did I go wrong?

This is from a homework problem that was recently returned to me in a numerical analysis course. The grader even noted that he didn't know where I went wrong but the solution was marked as incorrect. Here's the problem and the solution I gave for it (with minor adjustments). I have no idea what is wrong with this derivation. It's most likely something silly like a sign change. Someone please enlighten me.

Problem

Consider the following boundary value problem:

$$-u''(x) = f(x),\; x \in (a, b),\;u(a) = u(b) = 0$$

where $a < b$ are given real numbers. Find the Green's function for this problem; i.e. find a function $G = G(x, y)$ such that the solution of the boundary value problem can be written in the familiar way

$$u(x) = \int_a^b G(x, y)f(y)dy$$

Solution

We wish to find a function $G = G(x, y)$ such that $\frac{\partial^2 G}{\partial x^2} = G_{xx}(x, y) = -\delta(x - y)$, where $\delta$ is the Dirac delta functional distribution. Let the function $H$ be defined as follows:

$$H(x) := \int_{-\infty}^x \delta(x)$$

Observe that $H(x - y) = -G_x(x, y)$. The following limit applies:

$$\lim_{x \to y^-} G_x(x, y) \;-\; \lim_{x \to y^+} G_x(x, y) = 1$$

We want $G$ to be continuous at $y$ so have $\lim_{x\to y^+} G(x, y) = \lim_{x\to y^-} G(x, y)$

Use the boundary conditions to construct $G(a, y) = G(b, y) = 0$. We then get the following:

$$G(x, y) = \begin{cases} k_1(x - a) & \mathrm{if} & x \geq y \\ k_2(x - b) & \mathrm{if} & x < y \end{cases}$$

The constants must satisfy the following conditions.

$$k_2 - k_1 = 1 \qquad\qquad k_1(y - a) = k_2(y - b) \qquad\qquad k_2(b - a) = y - a$$

$$k_2 = \frac{y - a}{b - a} \qquad\qquad k_1 = \frac{y - b}{b - a}$$

This gives us the following Green's function:

$$G(x, y) = \begin{cases} \frac{(y - b)(x - a)}{b - a} & \mathrm{if} & a \leq y \leq x \\ \frac{(y - a)(x - b)}{b - a} & \mathrm{if} & x \leq y \leq b \end{cases}$$

• $\dfrac{(a-y) (b-x) \theta (x-y)}{a-b}+\dfrac{(a-x) (b-y) \theta (y-x)}{a-b}$ – Moo May 3 '16 at 4:55
• @Moo I have never seen this $\theta$ notation before. Is it supposed to be like my $H$ function? – MathNord May 3 '16 at 7:09
• Heaviside Unit Step Function. – Moo May 3 '16 at 7:17
• I have gone though your calculations now. Just one small mistake in the whole calculation as far as I can see: in the application of the boundary conditions you are mixing up the $x>y$ and $x<y$ branches. The $x=a$ boundary condition should be applied to the $x<y$ branch while you have applied it to the $x>y$ branch (and the opposite goes for the $x=b$ condition). The Greens function you find is correct in the sense that it leads to a solution of $-u''(x) = f(x)$ however it does not have the correct boundary conditions. The one given by Moo above is the one you should find if you correct this. – Winther May 3 '16 at 17:26
• The solutions were actually posted to my surprise, and though it was derived using a completely different method (integration by parts), the solution given was equivalent to the one given in the comment above. My boundary conditions are mixed up, as pointed out, and when that is changed, the solution I find is correct. – MathNord May 3 '16 at 20:35