# Probability HW3 ###### tags: `Probability` - [name=0716023 曾文鼎] ## 1a 機率總和為一。亦即: $$\int_{-\infty}^{\infty}f(x)\mathrm dx=1$$ 於是有: $$\begin{align} \int_{-\infty}^{\infty}f(x)\mathrm dx &= \int_{-\infty}^{\infty}\sqrt ke^{-k^2x^2-2k-1}\mathrm dx \\ &= \sqrt k \int_{-\infty}^{\infty} e^{-(kx+1)^2}\mathrm dx \\ &= \frac 1 {\sqrt k} \int_{-\infty}^{\infty} e^{-x^2}\mathrm dx \\ &= \sqrt{\frac \pi k} \lim_{x\to\infty}\text{erf}(x) \\ &= \sqrt{\frac \pi k} \\ &= 1 \end{align}$$ 故 $k=\pi$ 。第三個等號使用了鏈鎖律。 ## 1b * 當 $\sigma=0$ 時, $Y\equiv0$ 永不出錯,出錯機率為 $0$ 。以下僅討論 $\sigma \neq 0$ 的情況。 已知 $Y$ 的 PDF 為 $$\begin{align} & f(x)= \frac{1}{\sigma\sqrt{2\pi}}\exp\left(\frac{-(x-\mu)^2}{2\sigma^2}\right)=\frac{1}{\sigma\sqrt{2\pi}}\exp\left(\frac{-x^2}{2\sigma^2}\right) \end{align}$$ 故 $$\begin{align} \Pr(Y\geq 1) &= \int_{1}^{\infty} f(x) \mathrm dx \\ &= \int_{-\infty}^{-1} f(x) \mathrm dx \\ &= \frac 1 2 \left( 1+ \text{erf} \left(\frac {-1}{\sigma\sqrt 2}\right) \right) \end{align}$$ 同理 $$\Pr(Y<-1) = \frac 1 2 \left( 1+ \text{erf} \left(\frac {-1}{\sigma\sqrt 2}\right) \right)$$ 故出錯的機率為 $$\Pr\Big(Y<-1|X=+1\Big)+\Pr\Big(Y\geq1|X=-1\Big)=\frac 1 2 \left( 1+ \text{erf} \left(\frac {-1}{\sigma\sqrt 2}\right) \right)$$ ## 2 因為 $Y=aX+b$ ,故當 $Y=x$ 時 $X=\dfrac{x-b}{a}$ 。若 $a>0$ 則適用 $X$ 的情況: * $Y$ 的 PDF 為 $$f(x)=\begin{equation}\begin{cases}\lambda \exp\left(-\lambda \dfrac{x-b}{a}\right) & \text{if}~x\geq 0, \\ 0 & \text{if}~x<0. \end{cases}\end{equation}$$ * $Y$ 的 CMF 為 $(a>0)$ $$f(x)=\begin{equation}\begin{cases} 1- \exp\left(-\lambda \dfrac{x-b}{a}\right) & \text{if}~x\geq 0, \\ 0 & \text{if}~x<0. \end{cases}\end{equation}$$ 若 $a<0$ 則要調整: * $Y$ 的 PDF 為 $$f(x)=\begin{equation}\begin{cases}\lambda \exp\left(-\lambda \dfrac{x-b}{a}\right) & \text{if}~x\leq 0, \\ 0 & \text{if}~x>0. \end{cases}\end{equation}$$ * $Y$ 的 CMF 為 $$f(x)=\begin{equation}\begin{cases} \displaystyle\int_{-\infty}^x \lambda \exp\left(-\lambda \frac{x-b}{a}\right) \mathrm dt = -a\exp\left(\frac{\lambda(-x+b)}{a}\right) & \text{if}~x\leq0, \\ -a\exp\left(\dfrac{\lambda b}{a} \right) & \text{if}~x>0. \end{cases}\end{equation}$$ 以下找出 $Y$ 為指數分布的前提。因為指數分布在 $x<0$ 時遵守 $f(x)=0$ ,所以可以直接排除 $a<0$ 的情況。以下均認定 $a>0$ 。 改寫 $Y$ 的 PDF 函式 $(x\geq0)$ ,得到 $f(x)=\left(e^{b/a}\lambda\right)=\exp\left(\dfrac{-\lambda x}{a}\right)$ ,故當 $e^{b/a}\lambda=\frac{\lambda}{a}$ 時, $Y$ 呈現指數分布。於是 $$\begin{align} & e^{b/a}\lambda =\frac{\lambda}{a} \\ \implies & e^{b/a} = \frac{1}{a} \\ \implies & \frac b a = \ln\left(\frac{1}{a}\right) \\ \implies & b = -a \ln a \end{align}$$ 故當 $b=-a\ln a$ 時, $Y$ 呈現指數分布。 ## 3 已知 $$f(x)=\frac{1}{\sigma\sqrt{2\pi}}e^{\frac{-x^2}{2\sigma^2}}$$ 故 $$\begin{align} -\int_{-\infty}^{\infty} f(x)\ln(f(x)) \mathrm dx &= -\int_{-\infty}^{\infty} \frac{1}{\sigma\sqrt{2\pi}}e^{\frac{-x^2}{2\sigma^2}} \ln\left(\frac{1}{\sigma\sqrt{2\pi}}e^{\frac{-x^2}{2\sigma^2}}\right) \mathrm dx \\ &= \frac{-1}{\sigma\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{\frac{-x^2}{2\sigma^2}}\left(\frac{-x^2}{2\sigma^2}-\ln\sigma\sqrt{2\pi}\right) \mathrm dx \\ &= \frac{-1}{\sigma\sqrt{2\pi}} \int_{-\infty}^{\infty} \left( \frac{-x^2}{2\sigma^2} \right)e^{\frac{-x^2}{2\sigma^2}} \mathrm dx + \frac{\ln\sigma\sqrt{2\pi}}{\sigma\sqrt{2\pi}} \int_{-\infty}^{\infty} e^{\frac{-x^2}{2\sigma^2}} \mathrm dx \\ &= \frac{-1}{\sqrt{\pi}} \int_{-\infty}^{\infty} \left( -x^2 \right)e^{-x^2} \mathrm dx + \frac{\ln\sigma\sqrt{2\pi}}{\sqrt{\pi}} \int_{-\infty}^{\infty} e^{-x^2} \mathrm dx \\ &= \frac{-1}{\sqrt{\pi}} \left( \left[\frac{xe^{-x^2}}{2}\right]^{\infty}_{-\infty} -\int_{-\infty}^{\infty} \frac{e^{-x^2}}{2} \mathrm dx \right) + \frac{\ln\sigma\sqrt{2\pi}}{\sqrt{\pi}} \int_{-\infty}^{\infty} e^{-x^2} \mathrm dx \\ &= \frac{-1}{\sqrt{\pi}} \left( -\int_{-\infty}^{\infty} \frac{e^{-x^2}}{2} \mathrm dx \right) + \frac{\ln\sigma\sqrt{2\pi}}{\sqrt{\pi}} \int_{-\infty}^{\infty} e^{-x^2} \mathrm dx \\ &= \frac{\ln\sigma\sqrt{2\pi}+\frac 1 2}{\sqrt{\pi}} \int_{-\infty}^{\infty} e^{-x^2} \mathrm dx \\ &= \frac{\ln\sigma\sqrt{2\pi}+\frac 1 2}{\sqrt{\pi}} \lim_{x\to\infty}\sqrt\pi\text{erf}(x) \\ &= \ln\sigma\sqrt{2\pi}+\frac 1 2 \\ &= \frac 1 2 \ln\left(2\pi e\sigma^2\right) \end{align}$$ Q.E.D 。 第四個等號使用了鏈鎖律。第五個等號使用了分部積分。 ## 4a 已知標準常態分布的 PDF 為 $$f(x)=\frac{1}{\sqrt{2\pi}}e^{-x^2/2}$$ 故其期望值為 $$\begin{align} \mu &=\int_{-\infty}^{\infty} x \frac{1}{\sqrt{2\pi}}e^{-x^2/2} \mathrm dx =0 \end{align}$$ 上式可用對稱性質明顯觀察出。 其變異數為 $$\begin{align} \text{Var}[X] &=\int^{\infty}_{-\infty}x^2f(x)\mathrm dx-\mu^2 \\ &= \int^{\infty}_{-\infty}x^2\frac{1}{\sqrt{2\pi}}e^{\frac{-x^2}2} \mathrm dx \\ &= \sqrt{\frac{2}{\pi}} \int^{\infty}_{-\infty}\frac{x^2}{2}e^{\frac{-x^2}2} \mathrm dx \\ &= \frac{2}{\sqrt \pi} \int^{\infty}_{-\infty}x^2e^{{-x^2}} \mathrm dx \\ &= \frac{2}{\sqrt \pi} \left( \left[\frac{xe^{-x^2}}{2}\right]^{\infty}_{-\infty} -\int_{-\infty}^{\infty} \frac{e^{-x^2}}{2} \mathrm dx \right) \\ &= \frac{2}{\sqrt \pi} \left( -\int_{-\infty}^{\infty} \frac{-e^{-x^2}}{2} \mathrm dx \right) \\ &= \frac{1}{\sqrt \pi} \int_{-\infty}^{\infty} e^{-x^2} \mathrm dx \\ &= \lim_{x\to\infty} \text{erf}(x) \\ &= 1 \end{align}$$ Q.E.D 。 ## 4b * 先推導 $\displaystyle\int_0^{\infty} xe^{-x}\mathrm dx$ 的值。等等會用到。 $$\begin{align} \int_0^{\infty} xe^{-x}\mathrm dx &= \left[-x\mathrm{e}^{-x}\right]^{\infty}_{0} - \int^{\infty}_{0}-\mathrm{e}^{-x}\mathrm dx \\ &= -\int^{\infty}_{0}-\mathrm{e}^{-x}\mathrm dx \\ &= -\left[e^{-x}\right]^{\infty}_{0} \\ &= 1 \end{align}$$ 已知指數分布的 PMF 為 $$f(x)=\lambda e^{-\lambda x}~(x\geq 0)$$ 故其期望值為 $$\begin{align} \mu &= \int_{0}^{\infty} x\lambda e^{-\lambda x} \mathrm dx \\ &= \frac 1 \lambda \int_{0}^{\infty} xe{^{-x}} \mathrm dx \\ &= \frac 1 \lambda \end{align}$$ 其變異數為 $$\begin{align} \text{Var}[X] &=\int^{\infty}_{0}x^2f(x)\mathrm dx-\mu^2 \\ &= \int^{\infty}_{0}x^2\lambda e^{-\lambda x}\mathrm dx- \frac{1}{\lambda^2} \\ &= \frac{1}{\lambda}\int^{\infty}_{0}(x\lambda)^2 e^{-\lambda x}\mathrm dx- \frac{1}{\lambda^2} \\ &= \frac{1}{\lambda^2}\int^{\infty}_{0}x^2 e^{-x}\mathrm dx- \frac{1}{\lambda^2} \\ &= \frac{1}{\lambda^2}\left( \left[-x^2e^{-x}\right]^{\infty}_{0} - \int^{\infty}_{0} -2xe^{-x}\mathrm dx\right) -\frac{1}{\lambda^2} \\ &= \frac{1}{\lambda^2}\left( -\int^{\infty}_{0} -2xe^{-x}\mathrm dx\right) -\frac{1}{\lambda^2} \\ &= \frac{1}{\lambda^2}\left(2\int^{\infty}_{0} xe^{-x}\mathrm dx\right) -\frac{1}{\lambda^2} \\ &= \frac{2}{\lambda^2} - \frac{1}{\lambda^2} \\ &= \frac 1 {\lambda^2} \end{align}$$ ## 5a 因為 $$\begin{align} \int_{-\infty}^{\infty}C\exp(-|x|)\mathrm dx &= 2\int_{0}^{\infty} C\exp(-x)\mathrm dx \\ &= -2C\left[\exp(-x)\right]^{\infty}_{0} \\ &= 2C \\ &= 1 \end{align}$$ 故 $2C=1\implies C=0.5$ 。 ## 5b 以下推導 $\mathbb E[x^{2n}]$ $$\begin{align} \mathbb E[x^{2n}] &= \int_{-\infty}^{\infty}x^{2n}\frac 1 2 e^{-|x|}\mathrm dx \\ &= \int_0^\infty \left|x^{2n}\right| e^{-|x|}\mathrm dx \\ &= \int_0^\infty x^{2n} e^{-x}\mathrm dx \\ &= \left[\frac{-x^{2n+1}}{e^x}\right]^{\infty}_0 +2n \int_{0}^{\infty}x^{2n-1}e^{-x}\mathrm dx \\ &= 2n \int_{0}^{\infty}x^{2n-1}e^{-x}\mathrm dx \\ &= 2n \left(\left[\frac{-x^{2n}}{e^x}\right]^{\infty}_0 +(2n-1) \int_{0}^{\infty}x^{2n-2}e^{-x}\mathrm dx\right) \\ &= 2n \left((2n-1) \int_{0}^{\infty}x^{2n-2}e^{-x}\mathrm dx\right) \\ &= 2n(2n-1) \left( \left[\frac{-x^{2n-1}}{e^x}\right]^{\infty}_0 +(2n-2)\int_{0}^{\infty}x^{2n-3}e^{-x}\mathrm dx\right) \\ &= 2n(2n-1) \left( (2n-2)\int_{0}^{\infty}x^{2n-3}e^{-x}\mathrm dx\right) \\ &= \cdots \\ &= (2n)! \int_{0}^{\infty}e^{-x}\mathrm dx \\ &= (2n)! \end{align}$$ 以下推導 $\mathbb E[x^{2n+1}]$ $$\begin{align} \mathbb E[x^{2n+1}] &= \int_{-\infty}^{\infty}x^{2n+1}\frac 1 2 e^{-|x|}\mathrm dx \\ &= \int_{-\infty}^{\infty} x \left|x^{2n}\right| \frac 1 2 e^{-|x|}\mathrm dx \\ &=0 \end{align}$$ 上式第三個等號成立,因為 $\displaystyle\int_0^\infty \left|x^{2n}\right| e^{-|x|}\mathrm dx=\mathbb E[x^2n]$ 收斂,且 $\mathbb E[x^{2n+1}]$ 左右對稱,上下相反。 ## $\Gamma(n)$ 以下推導 $\Gamma(n+1)$ $$\begin{align} \Gamma(n+1) &= \int_0^\infty x^{n} e^{-x}\mathrm dx \\ &= \left[\frac{-x^{n+1}}{e^x}\right]^{\infty}_0 +n \int_{0}^{\infty}x^{n-1}e^{-x}\mathrm dx \\ &= n \int_{0}^{\infty}x^{2n-1}e^{-x}\mathrm dx \\ &= n \left(\left[\frac{-x^{n}}{e^x}\right]^{\infty}_0 +(n-1) \int_{0}^{\infty}x^{n-2}e^{-x}\mathrm dx\right) \\ &= n \left((n-1) \int_{0}^{\infty}x^{n-2}e^{-x}\mathrm dx\right) \\ &= n(n-1) \left( \left[\frac{-x^{n-1}}{e^x}\right]^{\infty}_0 +(n-2)\int_{0}^{\infty}x^{n-3}e^{-x}\mathrm dx\right) \\ &= n(n-1) \left( (n-2)\int_{0}^{\infty}x^{n-3}e^{-x}\mathrm dx\right) \\ &= \cdots \\ &= n! \int_{0}^{\infty}e^{-x}\mathrm dx \\ &= n! \end{align}$$
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up