This post derives the distribution for an random variable that appears in the derivation of a result in another post.
In this post, I derive the distribution of the negative of a normally distributed random variable. Let’s say we have \(X \sim N(\mu, \sigma^2)\), and we want to find the distribution of \(Y=-X\).
I start with the identity:
\begin{align} P(Y \le y) = P(-X \le y) = P(X \ge -y) = 1 - P(X \le -y) \end{align}
Since \(X \sim N(\mu, \sigma^2)\), we have
\begin{align} P(X \le -y) = \int^{-y}_{-\infty} \frac{1}{\sqrt{2\pi\sigma^2}} \exp^{-\frac{(x-\mu)^2}{2\sigma^2}} dx \end{align}
Which gives us
\begin{align} P(Y \le y) = 1 - P(X \le -y) = 1 - \int^{-y}_{-\infty} \frac{1}{\sqrt{2\pi\sigma^2}} \exp^{-\frac{(x-\mu)^2}{2\sigma^2}} dx \end{align}
Using Leibniz integral rule, we have
\begin{align} f_{Y}(y) = \frac{\partial P(Y \le y)}{\partial y} = & - \frac{1}{\sqrt{2\pi\sigma^2}} \exp^{-\frac{(-y-\mu)^2}{2\sigma^2}} \left(\frac{\partial (-y)}{\partial y}\right) \\ = & - \frac{1}{\sqrt{2\pi\sigma^2}} \exp^{-\frac{(-y-\mu)^2}{2\sigma^2}} (-1) \\ = & \frac{1}{\sqrt{2\pi\sigma^2}} \exp^{-\frac{(-y-\mu)^2}{2\sigma^2}} \\ = & \frac{1}{\sqrt{2\pi\sigma^2}} \exp^{-\frac{(y+\mu)^2}{2\sigma^2}} \\ = & \frac{1}{\sqrt{2\pi\sigma^2}} \exp^{-\frac{(y-(-\mu))^2}{2\sigma^2}} \end{align}
This is nothing but the density function for a Normally distributed random variable with mean \(-\mu\) and variance \(\sigma^2\), hence \(Y = N(-\mu, \sigma^2)\)