Find the Green's function that satisfies:
$ x \frac {d^2G}{dx^2}-(2x+1)\frac {dG}{dx}+(x+1)G=\delta (x-s)$.
I have found it to be: $G= \begin {cases} e^x(\frac{1}2-\frac{x^2}{2}) & 0\leq x < s\leq 1 \\ e^x(\frac{1}2-\frac{x^2}{2}) & 0\leq s < x\leq 1 \end{cases}$.
With boundary conditions $G(0)=0, G(1)=0$
I'm not entirely happy with this answer as I would have thought that the function would differ for $x<s$ and $s<x$. As this is my first time doing Green's functions, I'm not sure if this is correct
Thanks
In general the way these things go is as follows. Suppose $f_1,f_2$ are the general solutions to the homogeneous ODE. For fixed $s$, $G$ needs to have the following properties:
$$G(0)=0 \\ \lim_{x \to s^-} G(x)=\lim_{x \to s^+} G(x) \\ \lim_{x \to s^+} G'(x)=\lim_{x \to s^-} G'(x)+1/s \\ G(1)=0.$$
The third equation is where the Dirac delta is actually entering, and it appears as $1/x$ because the equation says that $xG''$ is the derivative of a thing with a jump of size $1$ at $x=s$, and integrating by parts tells you that $xG''$ is the derivative of $xG'-G$. For reasons relating to distribution theory the entire jump must be in $G'$, so you get these equations.
Now
$$G(x)=\begin{cases} a_1 f_1 + a_2 f_2 & x \leq s \\ b_1 f_1 + b_2 f_2 & x \geq s \end{cases}$$
and you are left to solve a system of linear equations for the coefficients. These equations read
$$a_1 f_1(0) + a_2 f_2(0) = 0 \\ b_1 f_1(1) + b_2 f_2(1) = 0 \\ a_1 f_1(s) + a_2 f_2(s) = b_1 f_1(s) + b_2 f_2(s) \\ b_1 f_1'(s) + b_2 f_2'(s) = a_1 f_1'(s) + a_2 f_2'(s) + 1/s.$$
This system can be solved to give you the coefficients, which specify $G$.
Allowing $s$ to be non-fixed then gives you $G(x,s)$, with basically everything going through the same except that all the derivatives and integrals that happened above are with respect to $x$ specifically now.
In your situation with $f_1(x)=e^x,f_2(x)=x^2 e^x$ the equations read
$$a_1 = 0 \\ eb_1 + eb_2 = 0 \\ a_1 e^s + a_2 s^2 e^s = b_1 e^s + b_2 s^2 e^s \\ b_1 e^s + b_2 (2s + s^2) e^s = a_1 e^s + a_2 (2s+s^2) e^s + 1/s.$$
Replace $b_2=-b_1$ and $a_2=\frac{b_1(1-s^2)}{s^2}$ and substitute into the fourth equation to find $b_1$, then you're done.
As Lutz suggested, you can clean this up somewhat by choosing $f_1$ and $f_2$ such that the first two equations read, for example, $a_1=0,b_2=0$, which makes the third and fourth equations less complicated after substitution.