Find the green function for the following BVP by using dirac delta function and solve the BVP using Green function Here's the question: 
$y'' + y = x^2 + 1, y(0) = 5, y(1) = 0$
I manage to get a solution to be this:
$y = -6\cot(1)\sin(x) + 6\cos(x) + x^2 - 1 - 2\cos(1)\sin(x) + 2\cot(1)\sin(1)\sin(x)$
Can somebody help me check if my $y_p$ is correct?
Thanks!

First of all, the last two terms of your solution cancel out since 
$\cot(1)\sin(1) = \cos(1)$.
Then, $$y_p = -6\cot(1)\sin(x) + 6\cos(x) + x^2 - 1$$
 $$y'_p = -6\cot(1)\cos(x) + 6\sin(x) + 2x$$
$$y''_p = 6\cot(1)\sin(x) - 6\cos(x) + 2$$
Thus, $y''_p + y_p = x^2 +1 $, and the boundary conditions are also satisfied,
$$y(0) = -6\cot(1)\sin(0) + 6\cos(0) + x^2 - 1 = 5$$
$$y(1) = -6\cot(1)\sin(1) + 6\cos(1) + 1^2 - 1 = 0$$
So yes, it works.
