moving stuff around

This commit is contained in:
2026-06-22 16:37:57 -07:00
parent 4ab87d74c2
commit b9018b3ae5
42 changed files with 1 additions and 1 deletions
@@ -0,0 +1,203 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "a6732353-51d5-4478-9cf8-5834e57e5a4e",
"metadata": {},
"source": [
"# Chapter 1 Notes"
]
},
{
"cell_type": "markdown",
"id": "48d9ec9e-83da-40ca-ae79-3c45f8af137c",
"metadata": {},
"source": [
"## Main Concepts\n",
"\n",
"Outcome: A result of a random experiment.\n",
"\n",
"Sample Space: The set of all possible outcomes.\n",
"\n",
"Event: A subset of the sample space.\n",
"\n",
"Inclusion-exclusion principle holds for probability\n",
"\n",
"Consider a sample space S. If S is a countable set, this refers to a discrete probability\n",
"mode\n"
]
},
{
"cell_type": "markdown",
"id": "7ac122be-50b2-423c-b88f-e4b3327b21bd",
"metadata": {},
"source": [
"## Example Problems"
]
},
{
"cell_type": "markdown",
"id": "7fb87a35-a470-4d98-935f-80c814e3f95d",
"metadata": {},
"source": [
"Example 1.5 - soln\n",
"\n",
"- there are 10 people with white shirts and 8 people with red shirts;\n",
"- 4 people have black shoes and white shirts\n",
"- 3 people have black shoes and red shirts\n",
"- the total number of people with white or red shirts or black shoes is 21\n",
"\n",
"Let A be the set of people with white shirts, B be the set of people with red shirts and let C be the set of people with black shoes.\n",
"\n",
"\\begin{align*}\n",
"|A|=10 \\\\\n",
"|B|=8 \\\\\n",
"|A \\cap C| = 4 \\\\\n",
"|B \\cap C| = 3 \\\\\n",
"|A \\cup B \\cup C| = 21\n",
"\\end{align*}\n",
"\n",
"Now we solve for $|C|$:\n",
"\n",
"\\begin{align*}\n",
"|A| + |B| + |C| - |A \\cap B| - |A \\cap C| - |B \\cap C| + |A \\cap B \\cap C| = 21 \\\\\n",
"10 + 8 + |C| - 0 - 4 - 3 - 0 = 21 \\\\\n",
"18 + |C| - 7 = 21 \\\\\n",
"|C| + 11 = 21 \\\\\n",
"|C| = 10\n",
"\\end{align*}\n",
"\n",
"$\\therefore$ number of people with black shoes is 10\n"
]
},
{
"cell_type": "markdown",
"id": "72b40733-531a-48f3-9879-75601684afc2",
"metadata": {},
"source": [
"Example 1.11 - soln\n",
"\n",
"Suppose we have the following information:\n",
"1. There is a 60 percent chance that it will rain today.\n",
"2. There is a 50 percent chance that it will rain tomorrow.\n",
"3. There is a 30 percent chance that it does not rain either day.\n",
"\n",
"T = rains\n",
"F = no rain\n",
"\n",
"$S = \\{(F, F), (F, T), (T, F), (T, T)\\}$\n",
"\n",
"$P((T, F) \\cup (T, T)) = 0.6$\n",
"\n",
"$P((F, T) \\cup (T, T)) = 0.5$\n",
"\n",
"$P((F, F)) = 0.3$\n",
"\n",
"\\begin{align*}\n",
"P(S) = 1 \\\\\n",
"P(\\{(F, F)\\} \\cup \\{(F, T)\\} \\cup \\{(T, F)\\} \\cup \\{(T, T)\\}) = 1 \\\\\n",
"P((F,F)) + P(\\{(F, T)\\} \\cup \\{(T, F)\\} \\cup \\{(T, T)\\}) = 1 \\\\\n",
"0.3 + P(\\{(F, T)\\} \\cup \\{(T, F)\\} \\cup \\{(T, T)\\}) = 1 \\\\\n",
"P(\\{(F, T)\\} \\cup \\{(T, F)\\} \\cup \\{(T, T)\\}) = 0.7 \\\\\n",
"P(\\{(F, T)\\} \\cup \\{(T, T)\\}) + P((T, F)) = 0.7 \\\\\n",
"0.5 + P((T, F)) = 0.7 \\\\\n",
"P((T, F)) = 0.2 \\\\\n",
"P(\\{(T, F)\\} \\cup \\{(T, T)\\}) + P((F, T)) = 0.7 \\\\\n",
"P((F, T)) = 0.1\n",
"\\end{align*}\n",
"\n",
"Find the following probabilities:\n",
"\n",
"a. The probability that it will rain today or tomorrow.\n",
"\n",
"\\begin{align*}\n",
"P((T, F) \\cup (F, T) \\cup (T, T)) = 0.7\n",
"\\end{align*}\n",
"\n",
"b. The probability that it will rain today and tomorrow.\n",
"\n",
"\\begin{align*}\n",
"P((T, T)) = 1 - 0.3 - 0.2 - 0.1 = 0.4\n",
"\\end{align*}\n",
"\n",
"c. The probability that it will rain today but not tomorrow.\n",
"\n",
"\\begin{align*}\n",
"P((T, F)) = 0.2\n",
"\\end{align*}\n",
"\n",
"d. The probability that it either will rain today or tomorrow, but not both.\n",
"\n",
"\\begin{align*} \n",
"P(\\{(T, F)\\} \\cup \\{(F, T)\\}) = P((T, F)) + P((F, T)) = 0.2 + 0.1 = 0.3\n",
"\\end{align*}\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "8b5131dd-5ebd-4156-b808-f8df273317fb",
"metadata": {},
"source": [
"Example 1.12 - soln\n",
"\n",
"$S = \\{ -1, 0, 1, 2, 3, ... \\}$\n",
"\n",
"$\\forall x \\in S, P(x) = \\frac{1}{2^{x + 2}}$\n",
"\n",
"What is the probability that I win more than or equal to 1 dollar and less than 4 dollars?\n",
"\n",
"\\begin{align*} \n",
"P({1, 2, 3}) = P(1) + P(2) + P(3) \\\\\n",
"= 1/8 + 1/16 + 1/32\n",
"\\end{align*}\n",
"\n",
"What is the probability that I win more than 2 dollars?\n",
"\n",
"\\begin{align*} \n",
"\\sum_{i=3}^{\\infty} P(i) = P(3) + P(4) + P(5) + P(6) + ... \\\\\n",
"= 1/32 + 1/64 + 1/128 + 1/256 + ... \\\\\n",
"=\\frac{\\frac{1}{32}}{1 - \\frac{1}{2}}\n",
"=\\frac{1}{16}\n",
"\\end{align*}"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "69962960-18a6-436b-b9eb-9a6dfae7559a",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "11163495-a6cc-43b9-bf41-02748b13d210",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "roadmap (3.14.5)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -0,0 +1,16 @@
# Introduction to Probability, Statistics, and Random Processes - Hossein Pishro-Nik
[pdf](./Introduction%20to%20Probability,%20Statistics,%20and%20Random%20Processes%20-%20Hossein%20Pishro-Nik.pdf)
total pages=1007
**Currently reading:** chapter 3, page 236
TODO:
- 3.2.5 problems
- ch3 end of chapter problems
- 4.1.4 problems
- 4.2.6 problems
- 4.3.3 problems
- ch4 end of chapter problems
@@ -0,0 +1,222 @@
State De Morgan's Law for $n$ sets
---
For any sets $A_1, A_2, \dots, A_n$:
$$\left(\bigcup_{i=1}^n A_i\right)^c = \bigcap_{i=1}^n A_i^c$$
$$\left(\bigcap_{i=1}^n A_i\right)^c = \bigcup_{i=1}^n A_i^c$$
The complement of a union is the intersection of complements, and vice versa.
===
State the Distributive Law for sets $A$, $B$, and $C$
---
$$A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$$
$$A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$$
===
State the inclusion-exclusion principle for a finite collection of sets $A_1, A_2, A_3, \dots A_n$ where $n=2$
---
$n = 2$ case:
$|A \cup B| = |A| + |B| - |A \cap B|$
---
$n = 3$ case:
$|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|$
---
For a finite collection of sets $A_1, A_2, A_3, \dots A_n$, we have
$\left| \bigcup_{i=1}^n A_i \right| = \sum_{i=1}^n |A_i| - \sum_{i < j} |A_i \cap A_j| + \sum_{i < j < k} |A_i \cap A_j \cap A_k| - \dots + (-1)^{n-1} |A_1 \cap A_2 \cap \dots \cap A_n|$
===
For the function
$$f: A \to B$$
State the following of $f$:
1. Domain
2. Co-domain
3. Range
---
1. $A$
2. $B$
3. Set of all possible outputs of $f$ (not necessarily $B$)
===
State definition for each the following:
1. Random experiment
2. Outcome
3. Sample space
4. Event
---
1. A **random experiment** is a process by which we observe something uncertain
2. An **outcome** is a result of a random experiment
3. The **sample space** $S$ is the set of all possible outcomes
4. An **event** is a subset of the sample space
===
State the Axioms of Probability
---
**Axioms of Probability**
1. For any event $A$, $P(A) \geq 0$
2. $P(S) = 1$
3. If $A_1, A_2, A_3, \dots$ are disjoint events, then $P(A_1 \cup A_2 \cup A_3 \cup \dots) = P(A_1) + P(A_2) + P(A_3) + \dots$
===
In a finite sample space $S$, where all outcomes are equally likely, what is the probability of any event $A$?
---
$P(A) = \frac{|A|}{|S|}$
===
What is $P(A^c)$ in terms of $P(A)$?
---
$$P(A^c) = 1 - P(A)$$
Follows from the axioms: $A$ and $A^c$ are disjoint, and $A \cup A^c = S$, so $P(A) + P(A^c) = P(S) = 1$.
===
Define conditional probability $P(A|B)$
---
The probability of $A$ given $B$ (when $P(B) > 0$):
$$P(A|B) = \frac{P(A \cap B)}{P(B)}$$
In the equally-likely case:
$$P(A|B) = \frac{|A \cap B|}{|B|}$$
===
State the chain rule of probability for $n$ events
---
$$P(A_1 \cap A_2 \cap \cdots \cap A_n) = P(A_1)\,P(A_2|A_1)\,P(A_3|A_1,A_2)\cdots P(A_n|A_1,A_2,\dots,A_{n-1})$$
Each factor conditions on all previously listed events.
===
What conditions must hold for three events $A$, $B$, $C$ to be independent?
---
All four conditions must hold:
1. $P(A \cap B) = P(A)P(B)$
2. $P(A \cap C) = P(A)P(C)$
3. $P(B \cap C) = P(B)P(C)$
4. $P(A \cap B \cap C) = P(A)P(B)P(C)$
Pairwise independence alone is **not** sufficient.
===
What does it mean for $n$ events $A_1, A_2, \dots, A_n$ to be independent?
---
Every subset of the events must satisfy the product rule. That is, for all $i < j < k < \dots$:
$$P(A_i \cap A_j) = P(A_i)P(A_j)$$
$$P(A_i \cap A_j \cap A_k) = P(A_i)P(A_j)P(A_k)$$
$$\vdots$$
$$P(A_1 \cap A_2 \cap \cdots \cap A_n) = \prod_{i=1}^n P(A_i)$$
===
If $A_1, A_2, \dots, A_n$ are independent, what is $P(A_1 \cup A_2 \cup \cdots \cup A_n)$?
---
$$P(A_1 \cup A_2 \cup \cdots \cup A_n) = 1 - \prod_{i=1}^n (1 - P(A_i))$$
Derived by taking the complement (none of the events occur) and using independence.
===
What is the difference between disjoint and independent?
---
- Disjoint: $A$ and $B$ cannot occur at the same time. $A \cap B = \empty$
- Independent: $A$ does not give any information about $B$
===
State the Law of Total Probability using event $B$ and its complement
---
$$P(A) = P(A|B)\,P(B) + P(A|B^c)\,P(B^c)$$
===
State the general Law of Total Probability for a partition of the sample space
---
If $B_1, B_2, B_3, \dots$ is a partition of $S$, then for any event $A$:
$$P(A) = \sum_i P(A \cap B_i) = \sum_i P(A|B_i)\,P(B_i)$$
===
State Bayes' Rule for two events $A$ and $B$
---
For $P(A) \neq 0$:
$$P(B|A) = \frac{P(A|B)\,P(B)}{P(A)}$$
===
State Bayes' Rule when $B_1, B_2, \dots$ form a partition of $S$
---
For any event $A$ with $P(A) \neq 0$:
$$P(B_j|A) = \frac{P(A|B_j)\,P(B_j)}{\displaystyle\sum_i P(A|B_i)\,P(B_i)}$$
The denominator expands $P(A)$ via the Law of Total Probability.
===
State the meaning of conditionally independent between events $A$ and $B$ given event $C$. Note $P(C) \gt 0$.
---
$$P(A \cap B \mid C) = P(A \mid C)P(B \mid C)$$
===
State the multiplication rule for $P(A \cap B)$
---
$$P(A \cap B) = P(A|B)\,P(B) = P(B|A)\,P(A)$$
Rearrangement of the definition of conditional probability.
@@ -0,0 +1,17 @@
For any event $A$, prove $P(A^c) = 1 - P(A)$
---
$$
1 = P(S)
= P(A \cup A^c)
= P(A) + P(A^c)
$$
===
Prove $P(A \setminus B) = P(A) - P(A \cap B)$
---
TODO
@@ -0,0 +1,216 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "206bf674",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"sns.set_theme(style=\"whitegrid\", context=\"notebook\")"
]
},
{
"cell_type": "markdown",
"id": "612bd02c",
"metadata": {},
"source": [
"# Chapter 1 Summary Notes"
]
},
{
"cell_type": "markdown",
"id": "be70f5df",
"metadata": {},
"source": [
"## Intro (1.0.0 - 1.3.1)\n",
"\n",
"**Theorem 1.1: De Morgan's law** \\\n",
"For any sets $A_1, A_2, A_3, \\dots A_n$, we have\n",
"- $(A_1 \\cup A_2 \\cup A_3 \\cup \\dots A_n)^c = A_1^c \\cap A_2^c \\cap A_3^c \\cap \\dots A_n^c$\n",
"- $(A_1 \\cap A_2 \\cap A_3 \\cap \\dots A_n)^c = A_1^c \\cup A_2^c \\cup A_3^c \\cup \\dots A_n^c$\n",
"\n",
"**Theorem 1.2: Distributive law** \\\n",
"For any sets $A, B,$ and $C$ we have\n",
"- $A \\cap (B \\cup C) = (A \\cap B)\\cup(A \\cap C)$\n",
"- $A \\cup (B \\cap C) = (A \\cup B)\\cap(A \\cup C)$\n",
"\n",
"**Inclusion-exclusion principle** \\\n",
"For a finite collection of sets $A_1, A_2, A_3, \\dots A_n$, we have\n",
"\n",
"$\\left| \\bigcup_{i=1}^n A_i \\right| = \\sum_{i=1}^n |A_i| - \\sum_{i < j} |A_i \\cap A_j| + \\sum_{i < j < k} |A_i \\cap A_j \\cap A_k| - \\dots + (-1)^{n-1} |A_1 \\cap A_2 \\cap \\dots \\cap A_n|$\n",
"\n",
"$n = 2$ case:\n",
"\n",
"$|A \\cup B| = |A| + |B| - |A \\cap B|$\n",
"\n",
"$n = 3$ case:\n",
"\n",
"$|A \\cup B \\cup C| = |A| + |B| + |C| - |A \\cap B| - |A \\cap C| - |B \\cap C| + |A \\cap B \\cap C|$\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "c7475d4f",
"metadata": {},
"source": [
"## Random experiments (1.3.1 - 1.4)\n",
"\n",
"- A **random experiment** is a process by which we observe something uncertain\n",
"- An **outcome** is a result of a random experiment\n",
"- The **sample space** $S$ is the set of all possible outcomes\n",
"- An **event** $A$ is any subset of $S$\n",
"\n",
"> In the context of a random experiment, the sample space is our *universal set*\n",
"\n",
"**Axioms of Probability**\n",
"\n",
"1. For any event $A$, $P(A) \\geq 0$\n",
"2. $P(S) = 1$\n",
"3. If $A_1, A_2, A_3, \\dots$ are disjoint events, then $P(A_1 \\cup A_2 \\cup A_3 \\cup \\dots) = P(A_1) + P(A_2) + P(A_3) + \\dots$\n",
"\n",
"**Some notation**\n",
"\n",
"- $P(A \\cap B) = P(A$ and $B) = P(A,B)$\n",
"- $P(A \\cup B) = P(A$ or $B)$\n",
"\n",
"In a finite sample space $S$, where all outcomes are equally likely, the probability of any event $A$ can be found by\n",
"\n",
"\\begin{align*}\n",
"P(A) = \\frac{|A|}{|S|}\n",
"\\end{align*}"
]
},
{
"cell_type": "markdown",
"id": "b705ef32",
"metadata": {},
"source": [
"## Conditional probability (1.4.0)\n",
"\n",
"If $A$ and $B$ are twos events in sample space $S$, then the **conditional probability of $A$ given $B$** is defined as\n",
"\n",
"\\begin{align*}\n",
"P(A|B) = \\frac{P(A \\cap B)}{P(B)}, \\text{when } P(B) > 0\n",
"\\end{align*}\n",
"\n",
"or\n",
"\n",
"\\begin{align*}\n",
"P(A|B) = \\frac{|A \\cap B|}{|B|}, \\text{when } P(B) > 0\n",
"\\end{align*}\n",
"\n",
"For events $A, B,$ and $C$, with $P(C) \\gt 0$, we have\n",
"\n",
"- $P(A^c|C) = 1 - P(A|C)$\n",
"- $P(\\empty|C) = 0$\n",
"- $P(A|C) \\leq 1$\n",
"- $P(A \\setminus B|C) = P(A|C) - P(A \\cap B|C)$\n",
"- $P(A \\cup B|C) = P(A|C) + P(B|C) - P(A \\cap B|C)$\n",
"- if $A \\subset B$ then $P(A|C) \\leq P(B|C)$\n",
"\n",
"![](../public/conditional_prob_tree.png)"
]
},
{
"cell_type": "markdown",
"id": "188a8fc2",
"metadata": {},
"source": [
"## Independence (1.4.1)\n",
"\n",
"**Definition.** Two events $A$ and $B$ are *independent* if $P(A \\cap B) = P(A)P(B)$. AKA $P(A|B) = P(A)$\n",
"\n",
"**Definition.** Three events $A, B,$ and $C$ are independent if **all** of the following conditions hold:\n",
"- $P(A \\cap B) = P(A)P(B)$\n",
"- $P(A \\cap C) = P(A)P(C)$\n",
"- $P(B \\cap C) = P(B)P(C)$\n",
"- $P(A \\cap B \\cap C) = P(A)P(B)P(C)$\n",
"\n",
"**Definition.** $N$ events $A_1, A_2, A_3, \\dots, A_n$ are independent if **all** the following conditions holds:\n",
"- $P(A_i \\cap B_j) = P(A_i)P(A_j)$\n",
"- $P(A_i \\cap A_j \\cap A_k) = P(A_i)P(A_j)P(A_k)$ where $i \\in [1:n+1]$, $j \\in [i:n+1]$, $k \\in [j:n+1]$\n",
"- $\\dots$\n",
"- $P(A_1 \\cap A_2 \\cap A_3 \\cap \\dots \\cap A_n) = \\prod_{i=1}^nP(A_i)$\n",
"\n",
"**Lemma.** \\\n",
"If $A$ and $B$ are independent then\n",
"- $A$ and $B^c$ are independent\n",
"- $A^c$ and $B$ are independent\n",
"- $A^c$ and $B^c$ are independent\n",
"\n",
"**Definition.** If $A_1, A_2, \\dots, A_n$ are independent then\n",
"$$P(A_1 \\cup A_2 \\cup \\dots \\cup A_n) = 1 - (1 - P(A_1))(1 - P(A_2))\\dots(1 - P(A_n))$$"
]
},
{
"cell_type": "markdown",
"id": "90cf5b00",
"metadata": {},
"source": [
"## Law of Total Probability (1.4.2)\n",
"\n",
"$$P(A) = P(A|B)P(B) + P(A|B^c)P(B^c)$$\n",
"\n",
"**Definition.** Law of Total Probability: \\\n",
"If $B_1, B_2, B_3, \\dots $ is a partition of the sample space $S$, then for any event $A$ we have\n",
"\n",
"$$P(A) = \\sum_i P(A \\cap B_i) = \\sum_i P(A|B_i)P(B_i)$$"
]
},
{
"cell_type": "markdown",
"id": "c33df800",
"metadata": {},
"source": [
"## Bayes' Rule (1.4.3)\n",
"\n",
"**Definition.** Bayes' Rule\n",
"\n",
"- For any two events $A$ and $B$, where $P(A) \\neq 0$, we have\n",
"\n",
"$$P(B|A) = \\frac{P(A|B)P(B)}{P(A)}$$\n",
"\n",
"- If $B_1, B_2, B_3, \\dots$ form a partition of the sample space $S$, and $A$ is any event with $P(A) \\neq 0$, we have\n",
"\n",
"$$P(B_j|A) = \\frac{P(A|B_j)P(B_j)}{\\sum_i P(A|B_i)P(B_i)}$$"
]
},
{
"cell_type": "markdown",
"id": "849d7c99",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "roadmap (3.14.5)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -0,0 +1,139 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "c58309b2",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"sns.set_theme(style=\"whitegrid\", context=\"notebook\")"
]
},
{
"cell_type": "markdown",
"id": "a6732353-51d5-4478-9cf8-5834e57e5a4e",
"metadata": {},
"source": [
"# Chapter 2 Notes"
]
},
{
"cell_type": "markdown",
"id": "9f0046c2",
"metadata": {},
"source": [
"## Counting (2.0.0 - 2.1.5)\n",
"\n",
"***Definition.*** Multiplication Principle: \\\n",
"Suppose that we perform $r$ experiments such that the $k\\text{th}$ experiment has $n_k$ possible outcomes, for $k=1,2,\\dots,r$. Then there are a total of $n_1 \\times n_2 \\times n_3 \\times \\dots \\times n_r$ possible outcomes for the sequence of $r$ experiments\n",
"\n",
"### Terminology\n",
"\n",
"- **Sampling**: Sampling from a set means choosing an element from that set. We\n",
"often **draw** a sample at random from a given set in which each element of the\n",
"set has equal chance of being chosen\n",
"\n",
"- **With or without replacement**: Usually we draw multiple samples from a set. If\n",
"we put each object back after each draw, we call this sampling with\n",
"replacement. In this case a single object can be possibly chosen multiple times.\n",
"For example, if A = {a1, a2, a3, a4} and we pick 3 elements with replacement, a\n",
"possible choice might be (a3, a1, a3). Thus \"with replacement\" means \"repetition\n",
"is allowed.\" On the other hand, if repetition is not allowed, we call it sampling\n",
"without replacement\n",
"\n",
"- **Ordered or unordered**: If ordering matters (i.e.: a1, a2, a3 ≠ a2, a3, a1), this is\n",
"called ordered sampling. Otherwise, it is called unordered\n",
"\n",
"### Counting Formulas\n",
"\n",
"- **ordered sampling with replacement:** $n^k$\n",
"\n",
"- **ordered sampling without replacement:** $n$ permute $k$ $\\quad$ ie $P^n_k = \\frac{n!}{(n - k)!}$\n",
"\n",
"- **unordered sampling without replacement:** $n$ choose $k$ $\\quad$ ie $\\binom{n}{k} = \\frac{n!}{k!(n-k)!}$\n",
"\n",
"- **unordered sampling with replacement:** $\\binom{n + k - 1}{k}$"
]
},
{
"cell_type": "markdown",
"id": "2e93e0fe",
"metadata": {},
"source": [
"## Problem Solving Principles"
]
},
{
"cell_type": "markdown",
"id": "87279e59",
"metadata": {},
"source": [
"When solving a combinatorics problem, consider:\n",
"1. Does order matter?\n",
" - Yes → Permutations\n",
" - No → Combinations\n",
"\n",
" - \"Are HHHTT and THHHT the same outcome to me?\"\n",
"\n",
"2. Are we sampling with of without replacement?\n",
" - Without replacement → Hypergeometric (phone problem)\n",
" - With replacement → Binomial (coin flips)\n",
" \n",
" \"Can the same item be chosen twice?\"\n",
"3. Are the \"groups\" labeled or unlabeled?\n",
" - Labeled/distinguishable → Just multiply combinations\n",
" - Unlabeled/interchangeable → Divide by k!\n",
"\n",
" \"Does it matter which group is called group 1?\"\n",
"4. Are the items distinguishable?\n",
" - Distinguishable → Each item is unique, classical probability applies\n",
" - Indistinguishable → Outcomes are not equally likely, be careful\n",
"\n",
" \"Could I label these items 1 to n?\"\n",
"5. Is complement of inclusion-exclusion easier?\n",
" - Complement → When \"at least\" or \"at most\" language appears\n",
" - Inclusion-Exclusion → When events overlap\n",
"\n",
" \"Is the opposite event simpler to count?\"\n",
"6. Am I counting each outcome exactly once? \n",
" - If yes, done. Otherwhise we are overcounting or undercounting"
]
},
{
"cell_type": "markdown",
"id": "9c5783dc",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "roadmap (3.14.5)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -0,0 +1,101 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "206bf674",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"sns.set_theme(style=\"whitegrid\", context=\"notebook\")"
]
},
{
"cell_type": "markdown",
"id": "612bd02c",
"metadata": {},
"source": [
"# Chapter 4 Example Problems"
]
},
{
"cell_type": "markdown",
"id": "5ce47b88",
"metadata": {},
"source": [
"4.2 \n",
"\n",
"a. \n",
"\n",
"$\\int_{-\\infty}^{\\infty}f_X(u)du = 1$\n",
"\n",
"ie\n",
"\n",
"\\begin{align*}\n",
"\\int_{-\\infty}^{0^+}f_X(u)du + \\int_{0}^{\\infty}f_X(x)dx = 1 \\\\\n",
"0 + \\int_{0}^{\\infty}ce^{-x}dx = 1 \\\\\n",
"c\\cdot\\lim_{t \\to \\infty }\\int_{0}^{t}e^{-x}dx = 1 \\\\\n",
"c\\cdot\\lim_{t \\to \\infty } [-e^{-x}]_0^t = 1 \\\\\n",
"c\\cdot\\lim_{t \\to \\infty } ((-e^{-t}) - (-e^{-0})) = 1 \\\\\n",
"c\\cdot\\lim_{t \\to \\infty } (-e^{-t} + 1) = 1 \\\\\n",
"c\\cdot 1 = 1 \\\\\n",
"c = 1\n",
"\\end{align*}\n",
"\n",
"b.\n",
"\n",
"Note that\n",
"\n",
"$$F_X(x) = \\int_{-\\infty}^x f_X(u)du$$\n",
"\n",
"and $c=1$\n",
"\n",
"so\n",
"\n",
"\\begin{align*}\n",
"F_X(x) = \\begin{cases} \n",
"1-e^{-x} & \\text{for } x \\geq 0 \\\\ \n",
"0 & \\text{otherwise} \n",
"\\end{cases}\n",
"\\end{align*}\n",
"\n",
"c. $F_X(3) - F_X(1) = $"
]
},
{
"cell_type": "markdown",
"id": "95a3b21c",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "roadmap (3.14.5)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -0,0 +1,176 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "c58309b2",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"sns.set_theme(style=\"whitegrid\", context=\"notebook\")"
]
},
{
"cell_type": "markdown",
"id": "a6732353-51d5-4478-9cf8-5834e57e5a4e",
"metadata": {},
"source": [
"# Chapter 4 Notes"
]
},
{
"cell_type": "markdown",
"id": "9f0046c2",
"metadata": {},
"source": [
"## Continuous Random Variables and their Distributions (4.1.0)"
]
},
{
"cell_type": "markdown",
"id": "ea9b1f96",
"metadata": {},
"source": [
"***Definition*** A random variable $X$ with CDF $F_X(x)$ is said to be continuous if $F_X(x)$ is a continuous for all $x \\in \\mathbb{R}$"
]
},
{
"cell_type": "markdown",
"id": "a96da4d3",
"metadata": {},
"source": [
"## Probability Density Function (PDF) (4.1.1)"
]
},
{
"cell_type": "markdown",
"id": "c62129a5",
"metadata": {},
"source": [
"***Definition*** Consider a continuous random variable $X$ with an absolutely continuous CDF $F_X(x)$. The function $f_X(x)$ defined by\n",
"\n",
"$$f_X(x) = \\frac{dF_X(x)}{dx} = F'_X(x) \\quad \\text{if } F_X(x) \\text{ is differentiable at } x$$\n",
" \n",
"is called the probability density function (PDF) of $X$."
]
},
{
"cell_type": "markdown",
"id": "df411869",
"metadata": {},
"source": [
"NOTE: The PDF being constant implies uniformity\n",
"\n",
"NOTE: For small values of $\\delta$,\n",
"\n",
"$$P(x \\lt X \\leq x + \\delta) \\approx f_X(x)\\delta$$\n",
"\n",
"Thus if $f_X(x_1) \\gt f_X(x_2)$, we can say $P(x_1 \\lt X \\leq x_1 + \\delta) \\gt P(x_2 \\lt X \\leq x_2 + \\delta)$, ie the value of $X$ is more likely to be around $x_1$ then $x_2$\n",
"\n",
"NOTE: The CDF can be obtained from the PDF via (assuming absolute continuity)\n",
"\n",
"$$F_X(x) = \\int_{-\\infty}^x f_X(u)du$$"
]
},
{
"cell_type": "markdown",
"id": "f29a3bfb",
"metadata": {},
"source": [
"***Properties*** Consider a continuous random variable $X$ with PDF $f_X(x)$. We have\n",
"- $f_X(x) \\geq 0, \\forall x \\in \\mathbb{R}$\n",
"- $\\int_{-\\infty}^{\\infty}f_X(u)du = 1$\n",
"- $P(a \\lt X \\leq b) = F_X(b) - F_X(a) = \\int_a^bf_X(u)du$\n",
"- For a set $A$, $P(X \\in A) = \\int_Af_X(u)du$. However, set $A$ must satisfy:"
]
},
{
"cell_type": "markdown",
"id": "6f546fed",
"metadata": {},
"source": [
"***Definition*** If $X$ is a continuous random variable, we can write the range of $X$ as\n",
"\n",
"$$R_X = \\{ x \\mid f_X(x) \\gt 0 \\}$$"
]
},
{
"cell_type": "markdown",
"id": "170db3a0",
"metadata": {},
"source": [
"***Property*** The expected value if a continuous random variable $X$ is\n",
"\n",
"$$E[X] = \\int_{-\\infty}^{\\infty}xf_X(x)dx$$"
]
},
{
"cell_type": "markdown",
"id": "deccea51",
"metadata": {},
"source": [
"***Property*** Law of the unconscious statistician (LOTUS) for continuous random variables\n",
"\n",
"$$E[g(X)] = \\int_{-\\infty}^{\\infty}g(x)f_X(x)dx$$\n"
]
},
{
"cell_type": "markdown",
"id": "c0a20195",
"metadata": {},
"source": [
"***Property*** Variance for a continuous random variable $X$, we can write\n",
"\n",
"\\begin{align*}\n",
"\\text{Var}(X) &= E[(X - E[x])^2] = \\int_{-\\infty}^{\\infty}(x - E[X])^2f_X(x)dx \\\\\n",
"&= E[X^2] - E[X]^2 = \\int_{-\\infty}^{\\infty}x^2f_X(x)dx - E[X]^2\n",
"\\end{align*}"
]
},
{
"cell_type": "markdown",
"id": "6f2f6b72",
"metadata": {},
"source": [
"## Functions of Continuous Random Variables"
]
},
{
"cell_type": "markdown",
"id": "f4a95738",
"metadata": {},
"source": [
"***Theorem***"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "roadmap (3.14.5)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -0,0 +1,7 @@
# Algorithmic Trading - Winning Strategies and their rationale
[pdf](./Algorithmic%20Trading%20Winning%20Strategies%20and%20their%20rationale.pdf)
total pages=225
**Currently reading:** chapter 1, page 19
@@ -0,0 +1,51 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"id": "93b4302b",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"sns.set_theme(style=\"whitegrid\", context=\"notebook\")"
]
},
{
"cell_type": "markdown",
"id": "bdd46cba",
"metadata": {},
"source": [
"# Chapter 1 Notes"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "roadmap (3.14.5)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
@@ -0,0 +1,51 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"id": "93b4302b",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import sys\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import pandas as pd\n",
"import seaborn as sns\n",
"\n",
"sns.set_theme(style=\"whitegrid\", context=\"notebook\")"
]
},
{
"cell_type": "markdown",
"id": "bdd46cba",
"metadata": {},
"source": [
"# Notes"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "roadmap (3.14.5)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}