How do I find the exact solution to the boundary value problem $y'' = 4y' + y + 2 − 8x − x^ {2}$ , $y(0) = 0$ and $ y(4) = 16$? I am approaching this question by trying to guess the general solution to the boundary value problem. However I haven't come up with one. Can someone explain how to solve this question please?
 A: I will go through the details if you like, but the general solution is achieved by finding the complementary and particular solution, then adding the two together. You find the complementary solution by solving
\begin{equation*}
y''-4y'-y=0.
\end{equation*}
Assume solution it proportional to $e^{\lambda x}$ and substitute this in for $y.$ Find the derivatives and factor out $e^{\lambda x}.$ This will leave you with a polynomial. Find a solution for this. 
For the particular solution, it will be of the form
\begin{equation*}
y_p=c_1+c_2x+c_3x^2
\end{equation*}
where $c_1,c_2,c_3$ are unknown constants. Find $y'_p$ and $y''_p$ and substitute this into the differential equation. To find the constants, you equate the coefficients of $1,x$ and $x^2$. Does that help? 
A: I thought it would be instructive to show the use of Laplace Transforms to solve a boundary value problem.
Recall that 
$$\mathscr{L}\{y'\}(s) = sY(s) -y(0)$$
and 
$$\mathscr{L}\{y''\}(s) = s^2Y(s) -sy(0)-y'(0)$$
Although $y'(0)$ is not specified in the boundary value problem, we will find a solution in terms of $y'(0)$ as an unknown, and find the full solution be enforcing $y(4)=16$.
We will also use
$$\mathscr{L}\{x\}(s) =\frac{1}{s^2} $$
and
$$\mathscr{L}\{x^2\}(s) =\frac{2}{s^3} $$
Then, we have 
$$Y(s)=\frac{\frac{2}{s}-\frac{8}{s^2}-\frac{2}{s^3}+y'(0)}{s^2-4s-1}=\frac{2}{s^3}+\frac{\sqrt{5}}{10} y'(0)\left(\frac{1}{s-2-\sqrt{5}}-\frac{1}{s-2+\sqrt{5}}\right)$$
whereupon inversion reveals that 
$$y(x)=x^2+\frac{\sqrt{5}}{10}y'(0)\left(e^{(2+\sqrt{5})x}-e^{(2-\sqrt{5})x}\right)$$
Now, enforcing $y(4)=16$ gives $y'(0)=0$ and thus the full solution becomes
$$y(x) = x^2$$
