# Solution {-}

Consider a random variable $X$ with an exponential probability function given as:
\begin{equation*}
  f_X(x)=
  \begin{cases}
    e^{-x}, &x \geq 0 \\
    0, &x < 0 \\
  \end{cases}
\end{equation*}

a) Compute $P(X \geq 2)$:


```python
from sympy import exp, integrate, symbols, oo

x = symbols('x')

PX2 = integrate(exp(-x), (x, 2, oo))
PX2
```




$\displaystyle e^{-2}$



b) Compute $P(1 \leq X \leq 2)$:


```python
P1X2 = integrate(exp(-x), (x, 1, 2))
P1X2
```




$\displaystyle - \frac{1}{e^{2}} + e^{-1}$



c) Compute $E(X)$, $E(X^2)$ and $Var(X)$:


```python
EX = integrate(x*exp(-x), (x, 0, oo))
EX
```




$\displaystyle 1$




```python
EX2 = integrate(x**2*exp(-x), (x, 0, oo))
EX2
```




$\displaystyle 2$




```python
VarX = EX2 - EX**2
VarX
```




$\displaystyle 1$



057f1fb33b8e46dcf1cbae3829118aa6adfc7c10
ipynb
Jupyter Notebook
Problem 1.22.ipynb
mfkiwl/GMPE340
3602b8ba859a2c7db2cab96862472597dc1ac793
MIT
2021-09-07T09:36:36.000Z
2021-09-07T09:36:36.000Z
Problem 1.22.ipynb
mfkiwl/GMPE340
3602b8ba859a2c7db2cab96862472597dc1ac793
MIT
Problem 1.22.ipynb
mfkiwl/GMPE340
3602b8ba859a2c7db2cab96862472597dc1ac793
MIT
2021-09-20T18:48:20.000Z
2021-09-20T18:48:20.000Z
Qwen/Qwen-72B
1. YES
2. YES