# Green's function for the Laplacian on $\Omega =[-1, \; 1]$ with Dirichlet boundary conditions in 1D

I am trying to derive the 1D Green's function for $\frac{d^{2}}{dx^{2}}$ on $\Omega=[-1,\;1]$ with Dirichlet boundary conditions $u(-1)=u(1)=0$ using the method of images. I know that the fundamental solution for the Laplacian in 1D is $\Phi(x-x_{0})=\frac{|x-x_{0}|}{2}$ and therefore if $\frac{d^{2}u(x)}{dx^{2}}=f(x)$ (where $f(x)\in C_{c}^{2}(\mathbb{R})$), the solution is given by

$u(x)=\int_{-\infty}^{\infty}\Phi(x-x_{0})f(x_{0})dx_{0}, \qquad -\infty<x<\infty$

But I can't seem to construct a Green's function $G$ satisfying $\triangle G=\delta_{x_{0}}$ and $G(x=\pm 1) =0 \;$

As mentioned above, I would like to use the method of images, since I was able to solve this problem in 2D and 3D domains using this approach.

For any $x_{0} \in [-1,1]$, we want to add to $\mathbf{\Phi}$ a harmonic function $H(x)$ (so, a linear function seeing as the problem is in 1D), which will cancel $\mathbf{\Phi}$ at the boundary values. Note that at $x=1$, $\Phi =\frac{1-x_{0}}{2}$ and at $x=-1$, $\Phi =\frac{1+x_{0}}{2}$, thus
$H(x)=- \frac{1}{2}(1-x_{0}x)$
$G(x, x_{0})=\Phi(x-x_{0}) +H(x)$