###### tags: `111-2學校上課`
###### tags: `功課`
# 機率HW7
## 資工二 110590064 劉韶軒
## Probelm 1
> When a certain car breaks down, the time that it takes to fix it (in hours) is a random variable with the density function
> $f(x)=c^{-3x};0<=x$
> $f(x)=0;otherwise$
> Calculate the value of c. (b.) Find the probability that when this car breaks down, it takes at most 30 minutes to fix it.
### Answer(a)
$\text{Let }\int_0^{\infty}c\cdot e^{-3x}dx=1\\
c\cdot\lim\limits_{t\to\infty}\int_0^te^{-3x}dx=1\\
\text{Let }u=-3x\\
du=-3dx\\
c\cdot\lim\limits_{t\to\infty}\int_0^{-3t}e^u\cdot\frac{-1}{3}du=1\\
=-\frac{c}{3}\cdot\lim\limits_{t\to\infty}\int_0^{-3t}e^udu=1\\
=-\frac{c}{3}\cdot\lim\limits_{t\to\infty}(e^{-3t}-1)=1\\
=-\frac{c}{3}\cdot(-1)=1\\
c=3$
### Answer(b)
$\int_0^{\frac{1}{2}}3e^{-3x}dx\\
=3\int_0^{\frac{1}{2}}e^{-3x}dx\\
\text{Let }u=-3x\\
du=-3dx\\
=-\int_0^{-\frac{3}{2}}e^udu\\
=-(e^{-\frac{3}{2}}-1)\\
=1-e^{-\frac{3}{2}}\\
\approx0.77686$
## Problem 2
>The distribution function for the duration of a certain soap opera (in tens of hours)
>$F(X)=1-\frac{16}{x^2};x>=4$
>$F(X)=0;otherwise$
>Calculate f , the probability density function of the soap opera (b.) What is the probability that the soap opera takes at most 50 hours? At least 60 hours? Between 50 and 70 hours? Between 10 and 35 hours?
### Answer (a)
$f(x)=\frac{dF(x)}{dx}=\begin{cases}
\frac{32}{x^2},\quad x\ge4\\
0,\quad overwise
\end{cases}$
### Answer (b)
$P(X\le50)=F(50)\approx0.9936\\
P(X\le60)=F(60)\approx0.99555\\
P(50\le X\le70)=F(70)-F(50)\approx0.00313\\
P(10\le X\le35)=F(35)-F(10)\approx0.14693$
## Problem 3
>Let X be a continuous random variable with the density function
>$f(x)=\frac{1}{4};if~x\in(-2,2)$
>$f(x)=0;otherwise$
>Using the method of distribution functions, find the probability density functions of Y = X 3 and Z = X 4 .
### Answer
$$
P(X=x)=\begin{cases}
\frac{1}{4},\quad -2\le x\le2\\
0,\quad O.W.
\end{cases}\\
F_Y(y)=P(Y\le y)=P(X^3\le y)=P(X\le\sqrt[3]{y})=F_X(\sqrt[3]{y})\\
=\int_{-2}^{\sqrt[3]{y}}\frac{1}{4}dx=\frac{1}{4}(\sqrt[3]{y}+2)=\frac{\sqrt[3]{y}}{4}+\frac{1}{2}\\
P(Y=y)=\frac{dF_Y(y)}{dy}=\frac{1}{12\sqrt[3]{y^2}}\\
F_Z(z)=P(Z\le z)=P(X^4\le z)=P(-\sqrt[4]{z}\le Z\le\sqrt[4]{z})=\\
=\int_{-\sqrt[4]{z}}^{\sqrt[4]{z}}\frac{1}{4}dx=\frac{1}{4}(\sqrt[4]{z}+\sqrt[4]{z})=\frac{\sqrt[4]{z}}{2}\\
P(Z=z)=\frac{dF_Z(z)}{dz}=\frac{1}{8\sqrt[4]{z^3}}
$$
## Problem 4
> $Let~the~probability~density~function~of~a~ random~variable~X~be~\\f(x)=\lambda*e^{-\lambda*x}~0<=x<∞ \\f(x)=0~otherwise.\\~Using~the~method~of~ distribution~functions,~calculate~the~\\probability~density~of~Y =\sqrt[3]{X}.$
### Answer
$F(y)=P(Y<=y)\\=P(\sqrt[3]{x^2}<=y)\\=P({x}<=y^\frac{3}{2})\\=∫_{0}^{y^\frac{3}{2}}{\lambda*e^{-\lambda*x}}dx\\=\lambda*∫_{0}^{y^\frac{3}{2}}{e^{-\lambda*x}}dx\\=\left.\lambda[\frac{1} {\lambda}*e^{-\lambda*x}]\right|^{y^\frac{3}{2}}_{0}\\=\left.[e^{-\lambda*x}]\right|^{y^\frac{3}{2}}_{0}\\=1-e^{-\lambda*y^\frac{3}{2}}\\\frac{d}{dy}(1-e^{-\lambda*y^\frac{3}{2}})=\frac{3}{2}*\lambda*e^{y^\frac{3}{2}}*y^{\frac{1}{2}}$
## Problem 5
> $Let~the~probability~density~function~of~a ~random~variable~X~be~f(x)\\=3e^{-3x}~0<=0<∞0~othewise\\Then,calculate~E(e^x).$
### Answer
$Y = g(X) = e^X$
$E(e^X) = ∫ g(X) * f(X) dX$
$For~x >= 0: \\E(e^X) \\= ∫ e^x * 3e^{-3x} dx \\= 3 ∫ e^{x - 3x} dx \\= 3e^{-2x} ∫ e^x dX \\= 3e^{-2x} * e^x + C \\= 3e^{-2x} * e^x + C$
$For~x < 0:0$
$\lim\limits_{x \to ∞} E(e^X) = 3e^{-2x} * e^x + C = \lim\limits_{x \to ∞}{\frac{e^x}{3e^{-2x}}} + C = 0\\c=0$
## Problem 6
> $$ Let~the~probability~density~function~of~a~random~variable~X~be\\ ~f(x)=\frac{1}{2}e^{|x|}-∞ < x < ∞.\\Then,~calculate~Var(X).$$
### Answer
$f(x)=\frac{1}{2}e^{|x|}\\E[X^2] = ∫x^2 * f(x) dx = ∫x^2 * \frac{1}{2}e^{|x|} dx\\E[X^2] = \\∫(x^2 * \frac{1}{2}e^x) dx (for~x > 0) +\\ ∫(x^2 * \frac{1}{2}e^{-x}) dx (for~x < 0)\\\frac{1}{2} * ∫x^2 * e^x dx=\frac{1}{2}e^{x}(x^2-2x+2)\\\frac{1}{2} * ∫x^2 * e^{-x}dx=\frac{1}{2}e^{-x}(x^2+2x+2)\\\lim\limits_{x \to 0^{+}}\frac{1}{2}{e^{x}(x^2-2x+2)}=1\\\lim\limits_{x \to 0^{-}}\frac{1}{2}{e^{-x}(x^2+2x+2)}=1\\c=1\\E(x^2)=\frac{1}{2}e^{x}(x^2-2x+2)+\frac{1}{2}e^{-x}(x^2+2x+2)+1$
$E[X] = ∫x * f(x) dx = ∫x * \frac{1}{2}e^{|x|} dx\\E[X] = ∫(x * \frac{1}{2}e^x) dx (for~x >= 0) +\\ ∫(x * \frac{1}{2}e^{x}) dx=\frac{1}{2}e^{x}*(x-1)\\∫(x * \frac{1}{2}e^{-x})dx=-\frac{1}{2}e^{-x}*(x+1)\\\\\lim\limits_{x \to 0^{+}}{\frac{1}{2}e^{x}*(x-1)}=\lim\limits_{x \to 0^{-}}{-\frac{1}{2}e^{-x}*(x+1)}=\frac{1}{2}=c\\E(X)=\frac{1}{2}e^{x}*(x-1)-\frac{1}{2}e^{-x}*(x+1)$
$Var(x)=E[X^2] - E[X]^2=(\frac{1}{2}e^{x}(x^2-2x+2)+\frac{1}{2}e^{-x}(x^2+2x+2)+1)\\-(\frac{1}{2}e^{x}*(x-1)-\frac{1}{2}e^{-x}*(x+1))^2$