# Proof on how to sample from a truncated exponential distribution

I understand that if i want a sample from an exponential distribution left truncated at a, i can just take a sample from a regular exponential distribution and add the value of a to every single observation. This makes intuitive sense, since the pdf of such a truncated distribution with scale 1 would just be: $$f(x) = e^{-(x-a)}$$. I imagine it is quite easy, but how would i mathematically proof, that the sample would indeed equate to a sample directly drawn from the truncated distribution? Besides, does this method work for any continuous distribution?

To prove this, just show that if $$Z$$ is a usual exponential random variable (with parameter $$1$$) and if $$X = a+Z$$, then $$f_X(x) = e^{-(x-a)}$$ (for $$x \ge a$$ and $$0$$ otherwise). You can show this using the formula for the PDF of a transformation of a random variable, or by finding the CDF of $$X$$ and then differentiating it.
(I'm assuming you already know that the truncated distribution has PDF $$e^{-(x-a)}$$ (for $$x\ge a$$ and $$0$$ otherwise), but if you don't, to show this, you can compute $$P(Z \le x\mid Z > a)$$, and then differentiate with respect to $$x$$ to get the PDF of the truncated distribution.)