Mean of Posterior distribution If $X_1,\ldots,X_n$ be iid $\sim N(\theta,\sigma^2)$, and let $\theta$ has double exponential distribution,
$\pi(\theta) =\frac{e^{-|\theta|/a}}{2a}$, with $a>0$ known.
Find mean of the posterior distribution.
My Work
We need to find joint distribution of $f(\theta|x)$ , where $x$ is vector
$f(\theta|x) = \frac{e^{-|\theta|/a}}{2a}\frac{1}{(2\pi\sigma^2)^{n/2}}. e^{-n(x-\theta)^2/{2\sigma^2}}$
$f(\theta|x) \propto e^{\frac{-n(x-\theta)^2}{2\sigma^2}-\frac{|\theta|}{a}}$
I understand that I need to consider two cases, one for positive $\theta$ and one for negative. But I am finding hard time to go further.
Please suggest some feedback or help.
 A: To compute the posterior distribution $\theta$ based on the sample $x_1,\ldots,x_n$, note that the required expression is $f(\theta | x_1,\ldots,x_n)$ not $f(\theta | x)$. The posterior then can be computed as follows:
\begin{align}
f(\theta | x_1,\ldots,x_n) &\propto f(x_1,\ldots,x_n | \theta) \pi(\theta)\\
 &\propto \prod_{i=1}^n e^{-\frac{1}{2}(x_i - \theta)^2} \times e^{-|\theta|/a}\\
 &= e^{-\frac{1}{2}\sum_{i=1}^n (x_i - \theta)^2 - \frac{|\theta|}{a}}\\
 &\propto \text{exp}\left\{-\frac{1}{2}\left(n\theta^2 - 2\theta\sum_{i=1}^n x_i + 2\frac{|\theta|}{a}\right)\right\}
\end{align}
To compute the normalisation constant $C = \int_{\theta \in \mathbb{R}} \text{exp}\left\{-\frac{1}{2}\left(n\theta^2 - 2\theta\sum_{i=1}^n x_i + 2\frac{|\theta|}{a}\right)\right\} \text{d}\theta$, split the integral into two, where you integrate the over the negative and positive values of $\theta$ separately. Let's take the positive region:
\begin{align}
C_+ 
&=\int_{0}^{\infty}  \text{exp}\left\{-\frac{1}{2}\left(n\theta^2 - 2\theta\sum_{i=1}^n x_i + 2\frac{\theta}{a}\right)\right\}\text{d}\theta \\
&= \int_{0}^{\infty}  \text{exp}\left\{-\frac{n}{2}\left\{\theta^2 - \frac{2}{n}\left(\sum_{i=1}^n x_i -\frac{1}{a}\right) \theta \right\} \right\} \text{d}\theta \\
&= \underbrace{\int_{0}^{\infty} \text{exp}\left\{-\frac{n}{2}\left\{\left(\theta - \frac{1}{n}\left(\sum_{i=1}^n x_i -\frac{1}{a}\right)\right)^2 \right\} \right\} \text{d}\theta }_{\text{see the erf function}} \times \text{constant indep of $\theta$}
\end{align}
The last line comes from completing the square. I leave you to fill in the blanks. Also, the other integral (the integral for $\theta <0$) can be computed similarly. 
To compute the posterior mean, you need to compute $\int_{0}^{\infty} \theta \text{exp}\left\{-\frac{1}{2}\left(n\theta^2 - 2\theta\sum_{i=1}^n x_i + 2\frac{|\theta|}{a}\right)\right\}  \text{d}\theta$ (and its counterpart for the negative $\theta$ range). These integrals can be computed using integration by parts.
