Our goal is to sample from the Laplace distribution conditioned on a linear subspace. Here are the details of this problem.


Let
$$p(x) \propto \exp(-\|x\|\_1/\sigma)$$
be the pdf of the Laplace distribution, where $x = (x\_1, \dots, x\_d)\in \mathbb{R}^d$. Consider the conditional distribution $p(x\,|\,\sum^d\_{i = 1}x\_i = 0)$, which is the Laplace distribution $p(x)$ supported on the linear subspace $\sum^d\_{i = 1}x\_i = 0$.


How does $p(x\,|\,\sum^d\_{i = 1}x\_i = 0)$ look like? Also, how do we sample from $p(x\,|\,\sum^d\_{i=1}x\_i)$?



What is the pdf of Laplace distribution conditioned on a plane? How can I sample from it?
Let $n:=d$. By rescalling, without loss of generality $\sigma=1$. 
Let $X\_1,\dots,X\_n$ be iid random variables (r.v.'s) with the standard Laplace distribution, so that the joint pdf of $X:=(X\_1,\dots,X\_n)$ is 
\begin{equation}
 f\_X(x)=\frac1{2^n}\,\exp\Big\{-\sum\_1^n|x\_i|\Big\}
\end{equation}
for $x=(x\_1,\dots,x\_n)$. Let $Y\_1:=X\_1+\dots+X\_n$, $Y\_2:=X\_2,\dots,Y\_n:=X\_n$, so that $X\_1=Y\_1-Y\_2-\dots-Y\_n$, $X\_2=Y\_2,\dots,X\_n=Y\_n$. So, $X=(X\_1,\dots,X\_n)$ and $Y:=(Y\_1,\dots,Y\_n)$ are related by an invertible linear transformation of determinant $1$. Therefore, using transformation technique for systems of r.v.'s/change of variables in multi-fold integrals, we see that the joint pdf of $Y=(Y\_1,\dots,Y\_n)$ is 
\begin{multline}
 f\_Y(y)=f\_X(y\_1-y\_2-\dots-y\_n, y\_2,\dots,y\_n) \\ 
 =\frac1{2^n}\,\exp\Big\{-|y\_1-y\_2-\dots-y\_n|-\sum\_2^n|y\_i|\Big\} 
\end{multline}
for $y=(y\_1,\dots,y\_n)$. Therefore, the joint distribution of $X=(X\_1,\dots,X\_n)$ given that $X\_1+\dots+X\_n=0$ is determined by the conditional joint pdf of $(Y\_2,\dots,Y\_n)$ given $Y\_1=0$, which is given by the expression 
\begin{equation}
f\_{Y\_2,\dots,Y\_n|Y\_1=0}(y\_2,\dots,y\_n)=\frac{f\_Y(0,y\_2,\dots,y\_n)}{f\_{Y\_1}(0)}, 
\end{equation}
where $f\_{Y\_1}$ 
is the pdf of $Y\_1$. 


So, to complete the calculation of $f\_{Y\_2,\dots,Y\_n|Y\_1=0}(y\_2,\dots,y\_n)$, it remains to compute $f\_{Y\_1}(0)$. This can be done quickly by using characteristic functions (c.f.'s). Indeed, the c.f. of $X\_1$ is given by 
\begin{equation}
 \phi(t)=\int\_{-\infty}^\infty e^{itx}\frac1{2}\,e^{-|x|}\,dx=\frac1{1+t^2}
\end{equation}
for real $t$. Hence, the c.f. of $Y\_1=X\_1+\dots+X\_n$ is $t\mapsto\frac1{(1+t^2)^n}$ and 
\begin{equation}
 f\_{Y\_1}(0)=\frac1{2\pi}\int\_{-\infty}^\infty e^{-it0}\frac{dt}{(1+t^2)^n}
 =2^{-2 n-1} \binom{2 n}{n}. 
\end{equation}


Thus, the conditional joint pdf of $(Y\_2,\dots,Y\_n)$ given $Y\_1=0$ is 
\begin{equation}
 2^{n+1}\exp\Big\{-|y\_2+\dots+y\_n|-\sum\_2^n|y\_i|\Big\}\Big/\binom{2 n}{n}. 
\end{equation}


To simulate this distribution, one can use [Markov chain Monte Carlo](https://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo) methods. 


