Constructing a Green's function for BVP 
Given BVP
$$ \begin{cases} y'' - y = f(x) \\ y( \pm \infty) = 0 \end{cases} $$
I need to find a Green's function $G(x,a)$ so that particular solution
  is given by $y_P(x) = \int\limits_{- \infty}^{\infty} G(x,a) f(a) da
 $.

Try:
First, easy to find homogeneous solution: $y(x) = C_1 e^x + C_2 x e^x $. Green Function $G(x,a)$, we know, satisfies $G''(x,a) - G(x,a) = \delta(x-a)$. Therefore,
$$ G(x,a) = \begin{cases} A_1 e^x + B_1 x e^x, \; \;\; \; x<a \\ A_2 e^x + B_2 x e^x, \; \; \; \; x>a \end{cases} $$
Using boundary condition we have
$$ \lim_{x \to \infty} A_2 e^x + B_2 x e^x = 0 \implies A_2 = B_2 = 0$$
and
$$ \lim_{x \to - \infty} A_1 e^x + B_1 x e^x = 0 \implies A_1,B_1 \; \; \text{can be any numbers}$$
Thus, we have if $x<a$
$$ G(x,a) = A_1 e^x + B_1 x e^x $$
and $0$ otherwise. Now, since $G(x,a) $ is continous at $a$, we have 
$$ A_1 e^a + B_1 a e^a = 0 \implies A_1 = - B_1 a $$
Thus, we have now $G(x,a) = B_1 x e^x - B_1 a e^x $. Now, $\partial_xG(x,a)$ has a jump discontinuity at $x=a$ of length $1$. Thus,
$$ B_1 e^a + B_1 a e^a - B_1 a e^a = 1 \implies B_1 = e^{-a}$$
Therefore, we conlude that 
$$ G(x,a) = x e^{x-a} + a $$
However, professor say that 
$$ G(x,a) = - \frac{1}{2} e^{-|x-a|} $$
What am I doing wrong??
 A: It appears your mistake is in the solution to the homogeneous equation:
$$
y''-y=0
$$
has characteristic equation $\lambda^2-1=0$, which yields $\lambda=\pm 1$, and therefore the solution to the homogeneous problem is
$$
y(x) = Ae^x+Be^{-x}
$$
From here, you will find that $A_1=0$ and $B_2=0$. Then continuity and jump condition will reveal the value for $A_2$ and $B_1$.
A: $\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
The general solution of your equation is given by:
\begin{align}
\mrm{y}\pars{x} & =
\mrm{y_{H}}\pars{x} + \int_{-\infty}^{\infty}\mrm{G}\pars{x,x'}\mrm{f}\pars{x'}\,\dd x'\tag{1}\label{1}
\end{align}
$\ds{\mrm{y_{H}}\pars{x}}$ is a solution of the homogeneous equation. Namely;
$\ds{\mrm{y_{H}}''\pars{x} - \mrm{y_{H}}\pars{x} = 0}$ such that
\begin{align}
\pars{\partiald[2]{}{x} - 1}\mrm{y}\pars{x}  & =
\int_{-\infty}^{\infty}\mrm{f}\pars{x'}
\pars{\partiald[2]{}{x} - 1}\mrm{G}\pars{x,x'}\,\dd x'\tag{2}\label{2}
\\[5mm]
\implies
\pars{\partiald[2]{}{x} - 1}\mrm{G}\pars{x,x'} & = \delta\pars{x - x'}
\label{3}\tag{3}
\end{align}
We can choose $\ds{\mrm{y_{H}}\pars{x}}$ such that it satisfies the boundary conditions
$\ds{\mrm{y}\pars{\pm\infty} = 0}$. For simplicity, we choose $\ds{\mrm{y_{H}}\pars{x} \equiv 0\,,\ \forall\ x \in \mathbb{R}}$ such that
\begin{equation}
\mrm{y}\pars{x}  =
\int_{-\infty}^{\infty}\mrm{G}\pars{x,x'}\mrm{f}\pars{x'}\,\dd x'
\tag{4}\label{4}
\end{equation}
and the integral, in the \eqref{4} RHS, must satisfies the above mentioned boundary conditions. That's accomplished by imposing
\begin{align}
\mrm{G}\pars{\pm\infty,y'} & = 0\,,\quad\forall\ y' \in \mathbb{R}
\label{5}\tag{5}
\end{align}
\eqref{3} is equivalent to
\begin{equation}
\left\{\begin{array}{rclcrcl}
\ds{\pars{\partiald[2]{}{x} - 1}\mrm{G}\pars{x,x'}} & \ds{=} & \ds{0}
& \mbox{if} & \ds{x} & \ds{\not=} & \ds{x'}
\\[2mm]
\ds{\left.\partiald{\mrm{G}\pars{x,x'}}{x}
\right\vert_{\ x\ =\ x'^{-}}^{\ x\ =\ x'^{+}}} & \ds{=} & \ds{1}&&& 
\end{array}\right.\label{6}\tag{6}
\end{equation}
Then, when $\ds{ x \not= x'}$, $\ds{\mrm{G}\pars{x,x'}}$ is a linear combination of $\ds{\expo{\pm x}}$. Namely,
\begin{equation}
\mrm{G}\pars{x,x'} =
\left\{\begin{array}{rcrcl}
\ds{A\expo{x} + B\expo{-x}} & \mbox{if} & \ds{x} & \ds{<} & \ds{x'} 
\\
\ds{C\expo{x} + D\expo{-x}} & \mbox{if} & \ds{x} & \ds{>} & \ds{x'} 
\end{array}\right.
\end{equation}
The boundary condition \eqref{5} obviously $\ds{\implies\ B = C = 0}$ such that 
\begin{equation}
\mrm{G}\pars{x,x'} =
\left\{\begin{array}{rcrcl}
\ds{A\expo{x}} & \mbox{if} & \ds{x} & \ds{<} & \ds{x'} 
\\
\ds{D\expo{-x}} & \mbox{if} & \ds{x} & \ds{>} & \ds{x'} 
\end{array}\right.
\end{equation}
Continuity of $\ds{\mrm{G}\pars{x,x'}\ \mbox{at}\ x = x'}$ and its derivative 'jump' $\ds{\pars{~\mbox{see}\ \eqref{6}~}}$ lead, respectively, to:
\begin{align}
&\left.\begin{array}{rcrcl}
\ds{\expo{x'}A} & \ds{-} & \ds{\expo{-x'}D} & \ds{=} & \ds{0}
\\
\ds{-\expo{x'}A} & \ds{-} & \ds{\expo{-x'}D} & \ds{=} & \ds{1}
\end{array}\right\}
\implies
\left\{\begin{array}{rcl}
\ds{A} & \ds{=} & \ds{-\,{1 \over 2}\,\expo{-x'}}
\\
\ds{D} & \ds{=} & \ds{-\,{1 \over 2}\,\expo{x'}}\end{array}\right.
\\[5mm] &\
\implies \mrm{G}\pars{x,x'} =
\left\{\begin{array}{rcrcl}
\ds{-\,{1 \over 2}\expo{x - x'}} & \mbox{if} & \ds{x} & \ds{<} & \ds{x'} 
\\[2mm]
\ds{-\,{1 \over 2}\expo{x' - x}} & \mbox{if} & \ds{x} & \ds{>} & \ds{x'} 
\end{array}\right.
\end{align}

The solution becomes:
$$\bbox[#ffe,15px,border:1px dotted navy]{\ds{%
\mrm{y}\pars{x} =
-\,{1 \over 2}\expo{-x}\int_{-\infty}^{x}\expo{x'}\mrm{f}\pars{x'}\,\dd x'
-\,{1 \over 2}\expo{x}\int_{x}^{\infty}\expo{-x'}\mrm{f}\pars{x'}\,\dd x'}}
$$
