# Using Green's function to solve $y''=1$ with $y(0)=y(1)=0$

I know the solution to $y''=1$ with $y(0)=y(1)=0$ should be $y=(x-.5)^2/2$. I need to use Green's function to obtain the same result.

I begin with the definition of Green's function as the solution to the associated equation

$$G'' = \delta(x_0)$$

which I separate into cases $x<x_0$ and $x>x_0$ which have corresponding functions

$$G_1 = c_1+c_2x$$

$$G_2 = c_3+c_4x$$

Applying the boundary condition $G(0)=0=c_1$ we get $G_1 = c_2x$. Applying the other, $G_2(1)=0=c_3+c_4\implies c_4=-c_3$. Enforcing the continuity condition

$$c_2x_0=c_3+c_4x_0=c_3(1-x_0)$$

and enforcing that $G'$ has a jump of 1 at $x_0$

$$-c_3-c_2=1 \implies c_3=-1-c_2$$

Then putting these last two together

$$c_2x_0 = (-1-c_2)(1-x_0)$$

which eventually implies

$$c_2=x_0-1, \qquad c_3=-x_0$$

Now to use what I've found to get the solution to the differential equation is the step where I'm really uncertain, but I think what I'm supposed to do is evaluate the following.

$$\int_0^x(x_0-1)x\ dx_0 + \int_x^1(-x_0)(1-x)\ dx_0$$

which is

$$x(x^2/2-x) + (1-x)\left(-\frac{1-x^2}{2}\right)$$

which I simplify to

$$\frac{-x^2+x-1}{2}$$

which, although close, is not the right answer. Noteworthy is that its derivative is $-1$ and it does not quite satisfy the boundary conditions.

• The function $y=(x-5)^2/2$ or $y=(x-.5)^2/2$ does not satisfy BCs:$y(0)=y(1)=0$. – daulomb Dec 2 '17 at 22:19
• It must be $y=\frac{x^2}{2}-\frac{x}{2}$ according to BCs. – daulomb Dec 2 '17 at 22:26

$G_1(x,s)=c_1x+c_2$ when $x\leq s$ with $G_1(0, s)=0$ and $G_2(x,s)=d_1x+d_2$ when $x>s$ with $G_2(1, s)=0$ and form $G(x, s)=G_1(x,s)$ if $x\leq s$ and $G(x, s)=G_2(x,s)$ if $x>s$. Using boundary conditions for $G_1$ and $G_2$ we have $G_1(x, s)=c_1x$ and $G_2(x,s)=d_1(x-1)$. We determine $c_1$ and $d_1$ by using continuity of $G$ and jump of the derivatives at $s$. You eventually find that $G_1(x, s)=x(s-1)$ if $0\leq x\leq s$; $G_2(x,s)=s(x-1)$ if $s<x\leq 1$ and so $y(x)=\int_0^1G(x,s)ds= \int_0^xG_2(x,s)ds+\int_x^1G_1(x,s)ds= \int_0^xs(x-1)ds+\int_x^1x(s-1)ds=\frac{x^2(x-1)}{2}-\frac{x(x-1)^2}{2}=\frac{x(x-1)}{2}$.
• How do you get your result for $G_1(x,s)$? Isn't this supposed to merely be the solution to $G''=0$ with initial condition $G(0)=0$? – Addem Dec 2 '17 at 22:36
• I may not know the construction of Green's function--I just have the definition that it satisfies $\mathcal{L}[G]=\delta(s)$ and is continuous at $s$ and has a jump in the derivative at $s$ equal to 1. Is this the wrong definition? – Addem Dec 2 '17 at 22:38
• You are actually solve $G_{xx}(x, s)=\delta(x-s)$, where $\delta$ is Dirac delta. We use the fact that $\delta(x-s)=0$ when $x\neq s$. – daulomb Dec 2 '17 at 22:39
• That's what I thought, so when $x<s$ do we not effectively have $G_{xx}=0$ so that $G = c_1+c_2x$? I don't see how the $x^2/2$ gets in. – Addem Dec 2 '17 at 22:40