# Green's Function

1. Mar 12, 2015

### joshmccraney

1. The problem statement, all variables and given/known data
Find Green's function for $u''(x) + u(x) = f(x)$ subject to $u(0) = A$ and $u(\pi) + u'(\pi) = B$.

2. Relevant equations
No set equation.

3. The attempt at a solution
I begin by recognizing that green's function $G$ satisfies $G''(x) + G(x) = \delta(x - x_0)$ subject to $G(0) = 0$ and $G(\pi) + G'(\pi) = 0$. Now when $x \neq x_0$ we have $G'' + G = 0$. Thus $G = A \sin x + B \cos x$. $G(0) = 0 \implies B=0$. However, $G(\pi) + G'(\pi) = 0 \implies A = 0$. Thus zero is the solution.

I know I'm doing something wrong. Any help is greatly appreciated.

2. Mar 12, 2015

### Svein

I think you are confusing Green's function and the solution to your equation (u(x)).

3. Mar 12, 2015

### joshmccraney

I don't think I am. I have gotten similar problems correct using this same technique, only the other problems had different boundary conditions. Maybe you (or someone) knows a different technique?

4. Mar 12, 2015

### Ray Vickson

For $x < x_0$ we have $G(x) = A_1 \sin(x) + B_1 \cos(x)$ and for $x > x_0$ we have $G(x) = A_2 \sin(x) + B_2 \cos(x)$. We want $G$ to be continuous at $x =x_0$. Furthermore, we have
$$\int_{x_0 - \epsilon}^{x_0+\epsilon} G''(x) \, dx + \int_{x_0 - \epsilon}^{x_0+\epsilon} G(x) \, dx = \int_{x_0 - \epsilon}^{x_0+\epsilon} \delta(x-x_0) \, dx = 1$$
The second term on the left goes to zero as $\epsilon \to 0$, while the first term on the left goes to $G'(x_0+0) - G'(x_0-0)$, so $G'(x)$ must have a jump discontinuity of size 1 as $x$ passes from left to right through $x_0$. Thus:
$$A_1 \sin(x_0) + B_1 \cos(x_0) = A_2 \sin(x_0) + B_2 \cos(x_0) \; \text{(continuity)}\\ 1+A_1 \cos(x_0) - B_1 \sin(x_0) = A_2 \cos(x_0) - B_2 \sin(x_0)\; \text{(jump disconuity)}$$
If $x_0 > 0$ we can have $G(0) = 0$ by taking $B_1 = 0$ and if $x_0 < \pi$ we can have $G(\pi) + G'(\pi) = 0$ by taking $A_2 + B_2 = 0$. This gives four equations in the four unknowns $A_1,B_1,A_2,B_2$.

5. Mar 12, 2015

### joshmccraney

Thanks Ray! I've got to go to bed now (it's late over here) but in the morning I'll post my solution if you want? If not, thanks so much!

6. Mar 12, 2015

### joshmccraney

Ohhh, and I think I see what you now mean, Svein! Thanks!

7. Mar 12, 2015

### Ray Vickson

Actually, the previous approach is too complicated. The problem is your insistence on the boundary conditions $G(0) = 0$ and $G(\pi) + G'(\pi) = 0$. These are unnecessary, as the place you want the BCs to apply is on the whole solution $u(x)$, which you can do by selecting the appropriate constants in the homogeneous solution.

More importantly, if you forget about the BCs on $G(x)$ you can re-use the same $G$ in many different problems, rather than developing a new one every time you change the BCs on the solution $u$.

So, I would just re-do the stuff above by setting (for instance) $G(x) = A \sin(x)$ for $x < x_0$ and $G(x) = B \cos(x)$ for $x > x_0$. Now the only conditions are continuity of $G$ at $x_0$ and the jump discontinuity in $G'(x)$ at $x_0$.

8. Mar 12, 2015

### joshmccraney

Thanks, and I see your point. This is great!!!

9. Mar 13, 2015

### vela

Staff Emeritus
I'm going to disagree a bit with Ray's last post. You need to apply homogeneous boundary conditions when finding the Green's function. In fact, that's what you've done when you say that $G(x)=A_1\sin x$ for $x<x_0$. You can only discard the cosine term because you require that G(0)=0.

The solution u(x) to the differential equation with the inhomogeneous boundary conditions consists of a particular solution, which you can write in terms of $f$ and the Green's function, and a homogeneous solution, with its arbitrary constants. You set the values of those constants so that the inhomogeneous boundary conditions are satisfied.

10. Mar 13, 2015

### Ray Vickson

We could have obtained a perfectly good Green's function for this problem if we had taken, instead, $G(x) = A \cos(x)$ for $x < x_0$ and $G(x) = B \sin(x)$ for $x > x_0$. We would get a different $G$, of course, and hence a different inhomogeneous solution $\int_0^{\pi} G(x,x_0) f(x_0) \, dx_0$, whose conditions at 0 and $\pi$ would also be different. But to get the whole solution $u(x)$ we would just need to use altered boundary conditions on the homogeneous solution.

11. Mar 13, 2015

### Svein

(Lecturer mode on): The problem in the OP is what we call a Sturm-Liouville problem. It is based on a differential operator S = (p(x)⋅u'(x))' - q(x)⋅u(x). In the OP, p(x)≡1 and q(x)≡-1. The operator S is symmetrical with respect to the standard L2 scalar product.

Now, if the equation S = 0 has no solution among the twice differentiable functions with given boundary conditions, the operator S is said to be non-singular. It can be shown that if S is non-singular, an inverse operator A exists, which is a Fredholm operator with a continuous symmetric kernel. This kernel is called Green's function. Operating on the equation S = f with the operator A, we get A(S) = A(f). Since A(S)=u, we have u = A(f).
(Lecturer mode off) Whew - anybody want to finish this?

12. Mar 14, 2015

### vela

Staff Emeritus
You're right. However, the correct solution to this particular problem depends on the definition of the Green's function the OP is supposed to use. It's not uncommon that the definition includes satisfying a set of homogeneous boundary conditions.

13. Mar 16, 2015

### Svein

To create Green's function, we need two solutions of S=0, fulfilling one of the boundary conditions each. Now, as has been shown already, u2(x) = sin(x) is a solution that satisfies u2(0) = 0. In the same way u1(x) = cos(x) - sin(x) satisfies u1(π) + u1'(π) = 0. Therefore, Green's function is given by $\frac{1}{c_{0}}u1(x)u2(\xi)=\frac{1}{c_{0}}(cos(x)-sin(x))sin(\xi)$ for ξ<x and $\frac{1}{c_{0}}u1(\xi)u2(x)=\frac{1}{c_{0}}(cos(\xi)-sin(\xi))sin(x)$ for ξ>x (c0 is a constant to be calculated).

14. Mar 16, 2015

### Ray Vickson

One perfectly good Green's function that does not satisfy both boundary conditions is
$$G_1(x,s) = \begin{cases} 0 & x < s \\ \sin(x-s) & x \geq s \end{cases}$$
Another perfectly good Green's function would be
$$G_2(x,s) = \begin{cases} \sin(s-x) & x < s \\ 0 & x \geq s \end{cases}$$
Each of them satisfies one of the two boundary conditions, but not the other. There are other Green's functions for the problem that do not satisfy either boundary condition, such as $G_3(x,s) = G_1(x,s) + \cos(x-s)$. However, in all cases the solution
$$u(x) = A \sin(x) + B \cos(x) + \int_0^{\pi} G(x,s) f(s) \, ds$$
can be made to satisfy the boundary conditions $u(0)=0, u(\pi) + u'(\pi) = 0$ by adjusting the values of $A,B$ in the homogeneous solution.