I have the Differential Equation:
$$u_{xx} = \cases{1; \ -1\le x \le1\\ 0;-\infty<x<-1,1<x<\infty} \\ u(-1) = -1,u(1) =1$$The forcing term on the right hand side is a square wave from x = -1 to 1.
If we are finding Green's function we want to find a function which satisfies the following differential equation $\frac{\partial^2 G(x,x')}{\partial x^2} = \delta(x-x')$ with the following Boundary Conditions $G(-1,x') = -1,G(1,x') =1$.
As I understand it, we have an impulse at some point $x'$ and there is an impulse response at all points $x>x'$ and $x<x'$ which gives us 2 separate equations for Green's function for each case. Using the homogeneous equation, we get the two equations for Green's function:
$$G(x,x') = Ax + B; x<x' \\ G(x,x') = Cx +D;x>x'$$ Applying the Boundary Condition for $x=-1$ gives $G(-1,x') = -A+B = 0 \rightarrow A = B \rightarrow G(x,x') = A(x+1); x<x'$,
Applying the Boundary Condition for $x=1$ gives $G(1,x') = C+D = 0 \rightarrow C = -D \rightarrow G(x,x') = D(1-x);x>x'$,
NEW WORKINGS
Combining these BCs with the conditions that (i) $G(x'+0,x') = G(x'-0,x')$ and (ii) $\frac{\partial G(x'+0,x')}{\partial x} - \frac{\partial G(x'-0,x')}{\partial x} = 1$ gives the following: $$(i):A(x'+1) = D(1-x') \rightarrow A = \frac{D-A}{x'}-D \\ (ii):A+D=1 \rightarrow A = 1-D$$
And plugging in (ii) into (i) gives: $1-D = \frac{D-(1-D)}{x'}-D \rightarrow 1 = \frac{2D-1}{x'} \rightarrow D = \frac{1+x'}{2}$ And plugging this result back (ii) gives: $A = 1 + \frac{1+x'}{2}$. This gives the final forms of Green's function as: $$G(x,x') = (1+\frac{1+x'}{2})(1+x); x<x' \\ G(x,x') = (\frac{1+x'}{2})(1-x);x>x'$$
So our integral for $u(x) = \int_{-\infty}^{\infty}G(x,x')f(x')dx'$ becomes:
$$u(x) = \int_{-1}^x(1+\frac{1+x'}{2})(1+x)*1dx'+\int_x^1(\frac{1+x'}{2})(1-x)*1dx'$$
$$u(x) = (1+x)\int_{-1}^x 1+\frac{1+x'}{2} dx' + (1-x)\int_x^1 \frac{1+x'}{2}dx' = (1+x)(x'|_{-1}^{x}+\frac{1}{2}(x'^2/2+x')|_{-1}^{x}) + \frac{(1-x)}{2}(x'+x'^2/2)|_x^1 \\ = (1+x)\bigg((1+x)+\frac{1}{2}\Big(\frac{x^2-1}{2}+(1+x)\Big)\bigg) + \frac{(1-x)}{2}\bigg((1-x)+\frac{1-x^2}{2}\bigg)$$
I slightly modified this from THIS EXAMPLE, but they had $x'$ in one of their 2 equations for Green's function, but I didn't see an explanation or working for how $x'$ got in there. I'm assuming if I made a mistake, it would be with respect to that, but please let me know if that and/or something else was an issue. Thanks!