{
 "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$ choose $k$ $\\quad$ ie $\\binom{n}{k} = \\frac{n!}{k!(n-k)!}$\n",
    "\n",
    "- **unordered sampling without replacement:** $n$ permute $k$ $\\quad$ ie $P^n_k = \\frac{n!}{(n - k)!}$\n",
    "\n",
    "- **unordered sampling with replacement:** $\\binom{n + k - 1}{k}$"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2b937ed3",
   "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
}
