{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# 2. Discrete random variables\n", "\n", "\n", " #### [Back to main page](https://petrosyan.page/fall2020math3215)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "___\n", "### Example 1\n", "\n", "Consider the double coin flip experiment $S=\\{HH, HT, TH, TT\\}$, and define a random variable which counts the number of heads in each outcome. Then \n", "$$X(HH)=2,\\;X(HT)=1,\\;X(TH)=1,\\; X(TT)=0.$$\n", " \n", "Observe that Range$(X)=\\{0,1,3\\}$ and the pmf of the random variable is \n", " \n", "$$f(0)=0.25,\\; f(1)=0.5,\\; f(2)=0.15.$$\n", "\n", "Below we draw the line graph and the histogram of the pmf of this random variable. Red circles represent the range of $X$." ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAskAAAE/CAYAAAC0Fl50AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjMsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+AADFEAAASUklEQVR4nO3df7Dld13f8dc7bMBAfhEQhZBAaiMKylSSxmCr0FokRhiYVtsg0qaDpSo6LaPtaGs1QKOD7eCggWqYYgumAYYyDLYJYluJaJNMCGA1QJo0CZOYCCaYbBYCZJN3/zgn8frOze7d7M09u/c+HjN39vz4nnM+97tn3vuc7/2eu9XdAQAA/sIRq14AAAAcakQyAAAMIhkAAAaRDAAAg0gGAIBBJAMAwCCSOaRU1XdW1bWrXsfBqqoXVtUtq14HwFapqmuq6oWrXgdsFpHMSlTVTVX1d+bt3f3R7n7WKtYEwMNbb25X1blV9ftJ0t3P6e6P7Oc5nllVXVW7HsWlwqYQybAOAxzg8GN2s5lEMoeUeZrC8sjFT1XV/6mqu6rqPVX1NWvuf0lVfbKq7qyq/11Vz93Hc39PVV27fJ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fTfLuJC9b8Zq2re7+vSRfWPU6doruvq27P768fHeSTyc5cbWrgoNiZm8xc3vrmNki+VBzYpKb11y/JTvsDcnOUFXPTPJtSa5c7UrgoJjZ7Ag7dWaL5EPLev9/uPNh2Faq6ugk/zXJP+/u3ateDxwEM5ttbyfPbJF8aLklyUlrrj89ya0rWgtsuqo6Mothe1F3v3/V64GDZGazre30mS2SDy1XJTm1qk6pqscmOSfJB1e8JtgUVVVJ/mOST3f3m1e9HtgEZjbblpktkg8p3b03yY8n+e0sTpB/b3dfs9pVbV9VdXGSy5M8q6puqapXr3pN29zfSPKqJH+7qj65/Dp71YuCR8rM3nrm9pba8TPbr4ADAIDBkWQAABhEMgAADCIZAAAGkQwAAINIBgCAQSQDAMAgkgEAYBDJAAAw/H98yaf6lbuQXQAAAABJRU5ErkJggg==\n", "text/plain": [ "