---
# System prepended metadata

title: Notes of Probability - CH5
tags: [probability]

---

# Chapter 5--Distributions of Functions of Random Variables
## Functions of Random One Variable
1. $題目給出以下2個條件:$
$f(x)的函式以及Y對X的方程式 \Longrightarrow$
$把Y對X的方程式改成X對Y的方程式，此方程式等同於v(y)，然後再藉由v(y)求出v'(y)$
$接著就能得知g(y)=f(x) \cdot |v'(y)| 其中f(x)的x是由y取代掉的$
$eg. f(x) = 2x, Y=3X+1:$
$y = 3x+1 \Longrightarrow x = \cfrac{1}{3} \cdot (y-1) = v(y)$
$\Longrightarrow v'(y) = 1/3$
$\because f(x) = 2x, \ x = \cfrac{1}{3} \cdot (y-1), \ v'(y) = 1/3$
$\therefore g(y) = 2 \cdot \cfrac{1}{3} \cdot (y-1) \cdot \cfrac{1}{3} = \cfrac{2}{9} \cdot (y-1)$
* tips: 善用前幾章學到的分配公式(記得f(x)長怎樣)
* tips: $v'(y)$必定為正數，所以須加絕對值
2. $find \ the \ pdf \ of \ X:$ 
$從P[X \le x]出發，把題目給的條件放入做代換，換成Y(或是其他任意變數)=X的方程式$
$之後再把f(x)積分，上界為剛剛的X方程式，下界為題目給定的條件$
$這樣得出的結論為cdf$
$而pdf則是把cdf微分即可$
* tips: 新函數的範圍把變數代換成X就好
* tips: 微分的同時需參考ex1的chain rule

**3. $背!!!:Cauchy \ distribution$**
$\ \ \ \ 從 \ uniform \ distribution \ 以上下界為(-\pi /2, \pi/2)，X=tanW，W的分配就是 \ Cauchy \ distribution$
$\ \ \ \ Cauchy \ distribution:$
* $f(x) = \cfrac{1}{\pi \cdot(1+x^2)}$
* $F(x) = \cfrac{1}{\pi} \cdot arctan(x) + \cfrac{1}{2}$

$\ \ \ \ if \ X \ is \ cauchy \ distribution \Longrightarrow$
$\ \ \ \ P(X>1):\cfrac{1}{2}-\cfrac{arctan(1)}{\pi}=\cfrac{1}{2}-\cfrac{\pi/4}{\pi}$
$\ \ \ \ P(X>5):\cfrac{1}{2}-\cfrac{arctan(5)}{\pi}$

4. $特殊函數Y = X^2$
$P[Y\le y] = P[x^2\le y] = P[-\sqrt{y} \le x \le \sqrt{y}] = \underbrace{P[x \le \sqrt{y}]}_{1式} - \underbrace{P[x \le -\sqrt{y}]}_{2式}$
$分成1式2式分開算再相減$


## Transformations of two random variables
1. Jocobian $(J)$ : $\begin{vmatrix}
 \cfrac{\partial{x_1}}{\partial{y_1}} &  \cfrac{\partial{x_1}}{\partial{y_2}} \\
 \cfrac{\partial{x_2}}{\partial{y_1}} &  \cfrac{\partial{x_2}}{\partial{y_2}}
\end{vmatrix}$ ，簡單來說 $J$ 是用來做變數代換
eg. let $X_1,X_2$ be **independent** random variables with pdf: $f(x) = e^{-x},\ 0<x< \infty \Longrightarrow$
$\because$ independent $\therefore$ the joint pdf is : $f(x_1) \cdot f(x_2) = e^{-x_1-x_2},\ 0<x_1< \infty,\ 0<x_2< \infty$
$\Longrightarrow Y_1 = X_1 - X_2, \ Y_2 = X_1 + X_2$
$\therefore x_1 = \cfrac{y_1+y_2}{2}, \ x_2 = \cfrac{y_2-y_1}{2}$
$\Longrightarrow J=\begin{vmatrix}
1/2 & 1/2 \\
-1/2 & 1/2
\end{vmatrix} =1/2$

* tips:
    i.  先把 $Y = aX+ b$ 換算成 $X = cY + d$ 的運算式
    ii. 再使用 $J$ 算出代換時所需要的數(上排是 $x_1$ 中對 $y_1$ 及 $y_2$ 的偏微分，下排則是 $x_2$ 中對 $y_1$ 及 $y_2$ 的偏微分)
    iii. 找出 $f(x)$
    iv. 藉由 $f(x)$ 找出 $f(x_1,x_2)$
    v. 找出 $f(x_1,x_2)$ 之後再乘上 $\mid J \mid$ 得出 $g(y_1,y_2)$
    vi. $g(y_1) = \int^{y_2上界}_{y_2下界} g(y_1,y_2)\ dy_2$ <br/> $\ \ \ \ g(y_2) = \int^{y_1上界}_{y_1下界} g(y_1,y_2)\ dy_1$
    



## Several Random Variables





## The Moment-Generating Function Tecchnique









## Random Functions Associated with Normal Distribution