Find the PDF of $Y = (X - \frac{1}{\theta})^2$ Let $X$ be a random variable with probability density function 
$f(x) =  \theta e^{(-\theta x)}$ for $x \geq 0$, otherwise $0$, when $\theta > 0$.
Let  $Y  = (X  - \frac{1}{\theta})^2$. Find pdf of $Y$. 
I'm just not sure how to incorporate $\theta$.  
 A: Let $Y = (X -\frac{1}{\theta})^{2}$ we want the  PDF of $Y$,
So Lets find the CDF of Y that is $F_{Y}(y)$ and to find the PDF we will differentiate $F_{Y}(y)$ so that $f(y) = F'_{Y}(y)$.
$F_{Y}(y) = P(Y \leq y) = P((X -\frac{1}{\theta})^{2} \leq y) = P(-\sqrt{y}+\frac{1}{\theta} \leq X  \leq \frac{1}{\theta}+\sqrt{y})$
$= F_{X}(\frac{1}{\theta}+\sqrt{y}) - F_{X}(-\sqrt{y}+\frac{1}{\theta})$
So $F_{Y} = F_{X}(\frac{1}{\theta}+\sqrt{y}) - F_{X}(-\sqrt{y}+\frac{1}{\theta})$
to obtain th PDF we differentiate the CDF
so differentiating we obtain
$f(y) = \frac{1}{2\sqrt{y}}f(\frac{1}{\theta}+\sqrt{y}) +\frac{1}{2\sqrt{y}} f(-\sqrt{y}+\frac{1}{\theta})$
$f(y) = \frac{1}{2\sqrt{y}}\theta e^{-\theta(\sqrt{y}+\frac{1}{\theta})} + \frac{1}{2\sqrt{y}}\theta e^{-\theta(-\sqrt{y}+\frac{1}{\theta})} = \frac{1}{2\sqrt{y}}\theta e^{-1}(e^{-\theta\sqrt{y}} + e^{\theta\sqrt{y}})$
A: It is important to specify the domains of each function. To begin with, the density of $X$ is:
$$
f_X(x)=\begin{cases} 0 & x<0 \\ \theta\,e^{-\theta\,x}& x\ge0\end{cases}
$$
Note that $f_X(x)$ is not continuous at $0$, so one would expect that something should happen near $Y=\frac{1}{\theta^2}$. The distribution is thus:
$$
F_X(x)=\begin{cases} 0 & x<0 \\ 1-e^{-\theta\,x}& x > 0\end{cases}
$$
and, although defining the value $x=0$ would give the correct value, one must remember that $F_X$ cannot be differentiated there.
Now, the derivation in BAYMAX's answer is correct:
$$
\begin{aligned}
F_Y(y)&=P(Y\le y)=P\left(\left(X-\frac{1}{\theta}\right)^2\le y\right)=P\left(\frac{1}{\theta}-\sqrt{y}\le X\le \frac{1}{\theta}+\sqrt{y}\right)  \\
&=F_X\left(\frac{1}{\theta}+\sqrt{y}\right)-F_X\left(\frac{1}{\theta} - \sqrt{y}\right)
\end{aligned}
$$
However, before computing the derivative, let us check whether the arguments of $F_X$ are positive. The first one is positive for sure, but for the second term different cases may occur:


*

*Let $0 < y < \frac{1}{\theta^2}$. Then both arguments are positive and we take the derivative on the second branch of $F_X$:
$$
f_Y(y)=\frac{\theta\,e^{-1}}{2\,\sqrt{y}}\left(e^{-\theta\,\sqrt{y}}+e^{\theta\,\sqrt{y}}\right)
$$

*Let $ y > \frac{1}{\theta^2}$. Then the second argument is negative and we just have to take into account the first one:
$$
f_Y(y)=\frac{\theta\,e^{-1}}{2\,\sqrt{y}} \,e^{-\theta\,\sqrt{y}}
$$


Finally, the density of $Y$ is:
$$
f_Y(x)=\begin{cases} 0 & x<0 \\\\
\displaystyle \frac{\theta\,e^{-1}}{2\,\sqrt{y}}\left(e^{-\theta\,\sqrt{y}}+e^{\theta\,\sqrt{y}}\right) & 0 < y < \frac{1}{\theta^2} \\\\
\displaystyle \frac{\theta\,e^{-1}}{2\,\sqrt{y}} \,e^{-\theta\,\sqrt{y}} & y > \frac{1}{\theta^2}\end{cases}
$$
NOTE 1: If we only take into account the second branch, then $\lim_{y\to\infty} f_Y(y)\ne 0$ and the required condition $\int_{-\infty}^\infty f_Y(y) dy=1$ would not hold.
NOTE 2: $f_Y(y)$ is not bounded near $y=0$ but this is not a problem, see e.g. Difference between Probability and Probability Density
