Quiz 2

Week 4.1: Continuous Random Variables & PDFs

648 words
3 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Week 4.1: Continuous Random Variables & PDFs > **Prerequisites:** BSMA1002 (Stats 1) — discrete PMF, CDF > **Cross-links:** BSMA1001 (Maths 1) — integration > **Core question:** How do we handle random variables with uncountably infinite ranges? * * * ## 1.

Week 4.1: Continuous Random Variables & PDFs

Prerequisites: BSMA1002 (Stats 1) — discrete PMF, CDF Cross-links: BSMA1001 (Maths 1) — integration Core question: How do we handle random variables with uncountably infinite ranges?

1. Intuition: From Sums to Integrals

Discrete RVs take countable values (e.g., die rolls, counts). But many real quantities are continuous: height, time, temperature, weight. For these, P(X=x)=0\mathbb{P}(X = x) = 0 for any specific xx (since there are infinitely many values). Instead of probabilities at individual points, we talk about probability density — probability per unit interval.
Key analogy: PMF is like mass at discrete points; PDF is like density (mass per unit length).

2. Probability Density Function (PDF)

Definition (PDF) XX is continuous if there exists a function fX(x)0f_X(x) \geq 0 such that:
  1. fX(x)0f_X(x) \geq 0 for all xx
  2. fX(x)dx=1\int_{-\infty}^{\infty} f_X(x) \, dx = 1
  3. For any interval (a,b)(a,b): P(a<X<b)=abfX(x)dx\mathbb{P}(a < X < b) = \int_a^b f_X(x) \, dx Unlike PMF: fX(x)f_X(x) is not a probability. It is a density. Only integrals over intervals give probabilities.

3. Cumulative Distribution Function (CDF)

Definition (CDF) For any RV XX (discrete or continuous):
>FX(x)=P(Xx)=xfX(t)dt.>> F_X(x) = \mathbb{P}(X \leq x) = \int_{-\infty}^x f_X(t) \, dt. >
Relationship between PDF and CDF:
  • FX(x)=xfX(t)dtF_X(x) = \int_{-\infty}^x f_X(t) \, dt
  • fX(x)=FX(x)f_X(x) = F_X'(x) (where differentiable) CDF properties:
  1. FF is non-decreasing: x1<x2    F(x1)F(x2)x_1 < x_2 \implies F(x_1) \leq F(x_2)
  2. limxF(x)=0\lim_{x \to -\infty} F(x) = 0, limxF(x)=1\lim_{x \to \infty} F(x) = 1
  3. FF is right-continuous

4. Working with PDFs: Examples

Example 1: Verify PDF

fX(x)={2x,0x1,0,otherwise.f_X(x) = \begin{cases} 2x, & 0 \leq x \leq 1, \\ 0, & \text{otherwise}. \end{cases}
Check: 012xdx=[x2]01=1\int_0^1 2x \, dx = [x^2]_0^1 = 1. ✓ Find P(0.2<X<0.5)=0.20.52xdx=[x2]0.20.5=0.250.04=0.21\mathbb{P}(0.2 < X < 0.5) = \int_{0.2}^{0.5} 2x \, dx = [x^2]_{0.2}^{0.5} = 0.25 - 0.04 = 0.21.

Example 2: Find CDF from PDF

For the PDF above:
FX(x)={0,x<0,0x2tdt=x2,0x1,1,x>1.F_X(x) = \begin{cases} 0, & x < 0, \\ \int_0^x 2t \, dt = x^2, & 0 \leq x \leq 1, \\ 1, & x > 1. \end{cases}
Verify: FX(x)=2x=fX(x)F_X'(x) = 2x = f_X(x) for 0<x<10 < x < 1. ✓

Example 3: Find the constant cc

fX(x)={cx2,0x2,0,otherwise.f_X(x) = \begin{cases} c x^2, & 0 \leq x \leq 2, \\ 0, & \text{otherwise}. \end{cases}
Find cc: 02cx2dx=c83=1    c=38\int_0^2 c x^2 \, dx = c \cdot \frac{8}{3} = 1 \implies c = \frac{3}{8}.

5. Common Pitfalls

MistakeCorrection
fX(x)=P(X=x)f_X(x) = \mathbb{P}(X = x)fX(x)f_X(x) is density, not probability
fX(x)dx\int f_X(x) dx over wrong rangeAlways verify support
PDF values >1>1Fine! As long as integral =1=1

6. Mermaid: Discrete vs Continuous

(Diagram)

7. Practice Questions

Q1 (Easy)

A PDF is fX(x)=34(1x2)f_X(x) = \frac{3}{4}(1-x^2) for 1x1-1 \leq x \leq 1. Verify it's a valid PDF.
Full Solution
1134(1x2)dx=34[xx3/3]11=34[(11/3)(1+1/3)]=34[2/3+2/3]=3443=1\int_{-1}^1 \frac{3}{4}(1-x^2) dx = \frac{3}{4}[x - x^3/3]_{-1}^1 = \frac{3}{4}[(1-1/3) - (-1+1/3)] = \frac{3}{4}[2/3 + 2/3] = \frac{3}{4} \cdot \frac{4}{3} = 1. ✓

Q2 (Medium)

Find the CDF for fX(x)=12exf_X(x) = \frac{1}{2}e^{-|x|} (Laplace distribution).
Full Solution
For x<0x < 0: F(x)=x12etdt=12[et]x=12exF(x) = \int_{-\infty}^x \frac{1}{2}e^{t} dt = \frac{1}{2}[e^{t}]_{-\infty}^x = \frac{1}{2}e^x.
For x0x \geq 0: F(x)=012etdt+0x12etdt=12+12(1ex)=112exF(x) = \int_{-\infty}^0 \frac{1}{2}e^{t} dt + \int_0^x \frac{1}{2}e^{-t} dt = \frac{1}{2} + \frac{1}{2}(1-e^{-x}) = 1 - \frac{1}{2}e^{-x}.
So
>FX(x)={12ex,x<0,112ex,x0.>> F_X(x) = \begin{cases} \frac{1}{2}e^x, & x < 0, \\ 1 - \frac{1}{2}e^{-x}, & x \geq 0. \end{cases} >
Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.