\documentclass[11pt]{article}
\input{headers01}

\usepackage{fancyhdr}   
\pagestyle{fancy}      
\lhead{CS 355, Fall 2025}               
\rhead{Name: Hemanta K. Maji} %%% <-- REPLACE Hemanta K. Maji WITH YOUR NAME HERE

\begin{document}

\title{Homework 1}

\date{}

\maketitle 

\thispagestyle{fancy}  
\pagestyle{fancy}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%% PLEASE LIST COLLABORATORS BELOW  %%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\bfseries Collaborators :} 
%%% List your collaborators and any online resources here.

\newpage
\centering
{\Huge{Practice Questions}}

These are practice questions.
They will \textbf{NOT} be graded.
We have also provided the final answers.
However, it is up to you to understand how or why the given solution is correct.

You do not need to submit these on Gradescope.
However, you may find it easier to just include them in the pdf.
In that case, please do not mark these questions on Gradescope.

\newpage

\begin{enumerate}
    \item {\bfseries Basic Probabilities (0 points)}
    \begin{enumerate}
        \item {\bfseries (0 points)}
        Consider 7 balls: 3 yellow, 2 red, and 2 green. 
        I pick one ball uniformly at random. 
        What is the probability that I pick a red ball?
        
        {\bfseries Solution.}
        
        $\frac{2}{7}$
    
        \vfill
    
        \item {\bfseries (0 points)}
        Consider 7 balls: 3 yellow, 2 red, and 2 green. 
        I pick one of them uniformly at random. 
        What is the probability that it is NOT a red ball?
        
        {\bfseries Solution.}
        
        $\frac57$
    
        \vfill
    \end{enumerate}
    \newpage

    \item {\bfseries Conditional Probabilities and Bayes’ Rule (0 points)}
    $$\Pr[X=x]=0.5$$
    $$\Pr[Y=y]=0.3$$
    $$\Pr[X=x, Y=y]=0.15$$

    What is $\Pr[X=x\vert Y=y]$?
    
    {\bfseries Solution.}
    
    $\frac12$
    \vfill

    \newpage

    \item {\bfseries Conditional Probabilities and Bayes' Rule (0 points)}
    Write $\Pr[X=x\vert Y=y]$ in terms of $\Pr[Y=y\vert X=x]$. That is, $\Pr[X=x\vert Y=y] = \lambda\cdot\Pr[Y=y\vert X=x]$ where $\lambda$ is some expression.
    
    {\bfseries Solution.}

    $$\Pr[X=x\vert Y=y] = \frac{\Pr[X=x]}{\Pr[Y=y]}\cdot \Pr[Y=y\vert X=x]$$
    or
    $$\lambda=\frac{\Pr[X=x]}{\Pr[Y=y]}$$
    \vfill


    \newpage

    \item {\bfseries Understanding Joint Distribution (0 points)}
    Twelve balls will be tossed into six bins numbered $\{1, 2, 3, 4, 5,6\}$. 
    Each ball is thrown into a bin uniformly and independently into the bins. 
    For $i\in\{1,2,3,4,5,6\}$, let $X_i$ represent the {\em number} of balls that fall into bin $i$.
    
    \begin{enumerate}
        \item {\bfseries (0 points)}
        Find $\prob{[X_1 = 12]}.$ 
    
        {\bfseries Solution.} 
        
        $\frac{1}{6^{12}}=\frac{1}{2176782336}$
    
        \vfill
    
        \item {\bfseries (0 points)} 
        Find the (marginal) distribution of $X_5$.
    
        {\bfseries Solution.} 
        
         The marginal distribution of random variable $X_5$ is binomial with parameters $n=12$, and $p=\frac16$:
            $$\prob{[X_5 = k]} = {\binom{12}{k}} \cdot \left( \frac{1}{6}\right)^k \cdot \left( \frac{5}{6}\right)^{12-k}.$$
    
        \vfill
    
    
        \item {\bfseries (0 points)}
        Find $\prob{[X_2 = 2  ~\vert~ X_1 + X_3 + X_5  = 5]}.$
    
        {\bfseries Solution.} 

        $\frac{224}{729}$
        \vfill
        
    \end{enumerate}

\end{enumerate}



\newpage
\centering
{\Huge{Homework Questions}}

These are homework questions and will be graded.
Please make sure to clearly mark each problem on Gradescope.
\newpage


\begin{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\item {\bfseries Basic Probabilities (2 points)}
    Consider 7 balls: 3 white and 4 black. 
    I pick two balls uniformly at random without replacement.
    What is the probability that both balls are black?
    
    {\bfseries Solution.}\newline 

    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\item {\bfseries Polya's Urn (4+5 points)}
\begin{enumerate}
    \item {\bfseries (4 points)}
    Suppose there are $R>1$ red balls and $G>1$ green balls in a box. We pick a ball from the box uniformly at random. 
    If it is red, we put it back in the box; otherwise, we throw it away. 
    After that, we pick another ball from the box uniformly at random. 
    What is the probability that the first ball we picked is green, conditioned on the fact that the second ball we picked is red? 
    
    {\bfseries Solution.} 
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
    \newpage

    \item {\bfseries (5 points)}
    Suppose there are $R>1$ red and $B>1$ blue balls in an urn. 
    We sample a ball uniformly at random.
    We replace the ball in the urn and add one additional ball of the SAME color. 
    After that, we sample a ball and report its color.

    What is the distribution of the second ball's color?

    {\bfseries Solution.}
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
\end{enumerate}
\newpage


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\item {\bfseries Sending One Bit (5+5+5 points)}

Alice intends to send a bit $b\in\{0,1\}$ to Bob. 
When Alice sends the bit, it goes through a series of $n$ relays before reaching Bob.
Each relay flips the received bit independently with probability $p$ before forwarding that bit to the next relay.

    \begin{enumerate}
    \item {\bfseries (5 points)} 
    Show that Bob will receive the correct bit with a probability 
        $$\sum_{k = 0}^{\lfloor n/2 \rfloor} {\binom{n}{2k}} \cdot p^{2k} \cdot (1 - p)^{n - 2k}.$$
    Hint: You solution should work irrespective of whether Alice sends $0$ or $1$.
 
    {\bfseries Solution.}
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
    \newpage
      
    \item {\bfseries (5 points)} 
    Let us consider an alternative way to calculate this probability.
    We say that the relay has {\em{bias}} $q$ if the probability it flips the bit is $(1-q)/2$.
    The bias $q$ is a real number between $-1$ and $+1$.
    Show that sending a bit through two relays with bias $q_1$ and $q_2$ is equivalent to sending a bit through a single relay with bias $q_1 \cdot q_2$.
    
    {\bfseries Solution.}
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE

    \vfill
      
    \item {\bfseries (5 points)} 
    Prove that the probability you receive the correct bit when it passes through $n$ relays is $$\frac{1+(1-2p)^n}{2}.$$
   
    {\bfseries Solution.}
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE

    \vfill
    
    \end{enumerate}
\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\item {\bfseries Expected Values (3+5 points)}
\begin{enumerate}
    \item {\bfseries (3 points)}
    Imagine the following game.
    A player rolls a fair six-sided die.
    
    If an odd number is rolled, the player loses and has to give the host the roll number times 10 dollars.
    For example, if 3 is rolled, the player gives the host 30 dollars.
    
    If an even number is rolled, the player wins, and the host gives the player the rolled number times 10 dollars.
    For example, if 4 is rolled, the player gets 40 dollars.
    
    What is the expected value for the player in this game?

    {\bfseries Solution.}
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE

    \newpage

    \item {\bfseries (5 points)}
    Imagine a bag with 2 while balls and 1 red ball.
    Every time, you will select one ball from the bag and remove it.
    If it is not the red ball, you again pick out another ball.
    What is the expected number of balls you need to take out from the bag to until you have red ball?
    (Note that the red ball itself is included. If you picked a white ball first, then the red ball, then you have taken 2 balls out of the bag.)

    {\bfseries Solution.}

    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE

\end{enumerate}


\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\item {\bfseries Mixing Two Boxes (3 points)}
Experiment 1: 
I have two boxes, each with a mix of some red and blue balls. 
I will select one of the boxes uniformly at random (with a probability of 0.5), then select one of the balls from that box uniformly at random and report its color.

Experiment 2: 
I pour all the balls from both boxes into one large box.
After that, I select one of the balls from this large box uniformly at random and report its color.

Are the two color distributions identical, irrespective of how many red/blue balls were in the two boxes? Please Justify your answer.

{\bfseries Solution.}
    
\   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE

\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%% PROBLEM 6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\item {\bfseries (10 points)} 
Recall that $x \mod p$ means the remainder of $x$ when divided by $p$.
For example, ``$13$ divided by $3$'' is $4$ with remainder $1$ because $13=4\cdot 3 + 1$. 
We write this as: $13\mod 3 = 1$.
    \begin{enumerate}
    \item{\bfseries (5 points)}
    Recall the definition of binomial coefficient $\binom pk \defeq \frac{p!}{k!(p-k)!}$. 
    For a prime $p$, prove that $p$ divides $\binom pk$, if $k\in\{1,2,\dotsc,p-1\}$. 
    
    {\bfseries Solution.}  
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
    \newpage
    
    \item{\bfseries (5 points) }
    Recall that $(1+x)^p = \sum_{k=0}^p \binom pk x^k$. 
    Prove by induction on $x$ that, for any $x\in\{1,2,\dotsc,p-1\}$, we have 
        $$\overbrace{x\times x \times \dotsi \times x}^{p\text{-times}}\mod p=x$$
    
    {\bfseries Solution.} 
    
    \   %%% <-- ERASE THIS LINE AND WRITE YOUR SOLUTION HERE
    
    \end{enumerate}
\newpage


    
\end{enumerate}
\end{document}
