% vim: tw=50
% 26/02/2022 11AM

\begin{proof}
    \begin{itemize}
        \item (right-continuous) Sufficient to prove
            \[ F_X \left( x + \frac{1}{n} \right) \to
            F_X(x) \]
            as $n \to \infty$.
            \[ A_n = \left\{ x < X \le x + \frac{1}{n} \right\} \]
            \emph{decreasing events}, with
            \[ \bigcap_{n \ge 1} A_n = \emptyset \]
            so
            \[ \PP(A_n) = F_X \left( x + \frac{1}{n}
            \right) - F_X(x) \to 0 \]
        \item (left-limits) $F_X \left( x -
            \frac{1}{n} \right)$ is a sequence
            \emph{increasing} bounded above by
            $F_X(x)$. $\left\{X_n \le x - \frac{1}{n}
            \right\}$ is a \emph{increasing}
            sequence of events with
            \[ \bigcup_{n \ge 1} \left\{ X \le x -
            \frac{1}{n} \right\} = \{X < x\} \]
            so
            \[ F_X \left( x - \frac{1}{n} \right)
            = \PP \left( X \le x - \frac{1}{n}
            \right) \to \PP(X < x) \]
        \item ($\lim_{x \to \infty} F_X(x) = 1$)
            $\{X \le n\}$ increasing events,
            \[ \bigcup_{n \ge 1} \{X \le n\} =
            \Omega \]
            so
            \[ F_X(n) = \PP(X \le n) \to
            \PP(\Omega) = 1 \]
        \item Similar for $\lim_{x \to -\infty}
            F_X(x) = 0$.
    \end{itemize}
\end{proof}

\begin{definition*}
    \begin{itemize}
        \item A random variable is
            \emph{continuous} if $F$ is
            continuous. This implies that
            \begin{itemize}
                \item \eqnoskip
                    \[ F_X(x) = F_X(x^-) \iff
                    \PP(X \le x) = \PP(X < x)
                    \iff \PP(X = x) = 0 \qquad
                    \forall\,\, x \]
                \item and \emph{in this course}
                    $F$ is also differentiable so
                    that
                    \[ F_X(x) = \PP(X \le x) =
                    \int_{u = -\infty}^x f_X(u)
                    \dd u \]
                    (cf Part II P \& M)
                    where $f_X : \RR \to \RR$ has
                    the properties:
                    \begin{itemize}
                        \item $f_X(x) \ge 0$ for
                            all $x$
                        \item
                            $\int_{-\infty}^\infty
                            f_X(x) \dd x = 1$
                    \end{itemize}
                    $f_X$ is the \emph{probability
                    density function} of $X$
                    (\emph{PDF} or
                    ``\emph{density}'').
            \end{itemize}
    \end{itemize}
\end{definition*}

\noindent
\ul{Intuitive Meaning}:

\begin{center}
    \includegraphics[width=0.6\linewidth]
    {images/5b091a6ca2f711ec.png}
\end{center}
\[ \PP(x < X \le x + \delta x) = \int_x^{x +
\delta x} f_X(u) \dd u \approx \delta x \cdot f(x) \]
\[ \PP(a < X \le b) = \int_a^b f_X(x) \dd x =
\PP(a \le X < b) \]
So for $S \subset \RR$ ($S$ ``nice'' for example
interval or countable union of intervals).
\[ \PP(X \in S) = \int_S f_X(u) \dd u \]

\subsubsection*{Key Takeaways}

\begin{itemize}
    \item The CDF is a collection of probabilities
    \item PDF is \emph{not} a probability. How to
        use? Integrate it to get a probability.
\end{itemize}

\subsubsection*{Examples}

\begin{enumerate}[(1)]
    \item Uniform distribution $X \sim U[a, b]$
        ($a, b \in \RR$, $a < b$).
        \[ f_X(x) = \begin{cases}
            \frac{1}{b - a} & x \in [a, b] \\
            0 & \text{otherwise}
        \end{cases} \]
        \[ F_X(x) = \int_a^x f_X(u) \dd u \frac{x
        - a}{b - a} \]
        for $a \le x \le b$. \\
        Question: ``Limit of discrete uniform
        random variables?''
    \item Exponential distribution $\lambda > 0$.
        \[ X \sim \mathrm{Exp}(\lambda) \]
        \[ f_X(x) = \begin{cases}
            \lambda e^{-\lambda x} & x > 0 \\
            0 & \text{otherwise}
        \end{cases} \]
        Check:
        \begin{enumerate}[(i)]
            \item $\ge 0$? Yes
            \item $\int_0^\infty f_X(x) =
                [-e^{-\lambda x}]_0^\infty = 1$.
        \end{enumerate}
        \[ F_X(x) = \PP(X \ge x) = \int_0^x
        \lambda e^{-\lambda u} \dd u = 1 -
        e^{-\lambda x} \]
        Remember:
        \[ \PP(X \ge x) = 1 - F_X(x) + \PP(X = x)
        = e^{-\lambda x} \]
        ``Limit of (rescaled) geometric
        distribution''. Good way to model
        \emph{arrival times} ``how long to wait
        before something happens'' $\to$ link to
        Poisson usage $\leftrightarrow$ Part II
        Applied Probability.
\end{enumerate}

\subsubsection*{Memoryless Probability}

(Conditional $\PP$ works as before). $X \sim
\mathrm{Exp}(\lambda)$, $s, t > 0$.
\begin{align*}
    \PP(X \ge s + t \mid X \ge s)
    &= \frac{\PP(X \ge s + t)}{\PP(X \ge s)} \\
    &= \frac{e^{-\lambda (s + t)}}{e^{-\lambda s}}
    \\
    &= e^{-\lambda t} \\
    &= \PP(X \ge t)
\end{align*}
Exercise: $X$ memoryless $\iff X \sim
\mathrm{Exp}(\lambda)$. (continuous random
variable with a density).

\subsubsection*{Expectation of Continuous Random Variables}

\begin{definition*}
    $X$ has density $f_X$. The \emph{expectation}
    is
    \[ \EE[X] := \int_{-\infty}^\infty xf_X(x) \dd
    x \]
    and
    \[ \EE[g(X)] := \int_{-\infty}^\infty
    g(x)f_X(x) \dd x \]
\end{definition*}

\noindent
\ul{Technical Comment}: assumes at most one of
\[ \int_{-\infty}^0 |x|f_X(x) \dd x \]
and
\[ \int_0^\infty xf_X(x) \dd x \]
is infinite. \myskip
\ul{Linearity of expectation}:
\[ \EE[\lambda X + \mu Y] = \lambda \EE[X] + \mu
\EE[Y] \]
as before.

\begin{claim*}
    $X \ge 0$. Then
    \[ \EE[X] = \int_0^\infty \PP(X \ge x) \dd x \]
\end{claim*}

\begin{proof}
    \begin{align*}
        \EE[X]
        &= \int_0^\infty x f_X(x) \dd x \\
        &= \int_0^\infty \left( \int_0^x 1 \dd u
        \right) f_X(x) \dd x \\
        &= \int_0^\infty \dd u \int_u^\infty \dd x
        f_X(x) \\
        &= \int_0^\infty \dd u \PP(X \ge u)
    \end{align*}
\end{proof}
